-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Proper mixin without breaking the ServerPlayer object (TrainCarts)
- Loading branch information
1 parent
fae0e6a
commit 2da32bb
Showing
10 changed files
with
153 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Used when a commit is pushed to the repository | ||
# This makes use of caching for faster builds and uploads the resulting artifacts | ||
name: build-commit | ||
|
||
on: [ push, workflow_dispatch ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Extract current branch name | ||
shell: bash | ||
# bash pattern expansion to grab branch name without slashes | ||
run: ref="${GITHUB_REF#refs/heads/}" && echo "branch=${ref////-}" >> $GITHUB_OUTPUT | ||
id: ref | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
- name: Set up JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 21 | ||
- name: Initialize caches | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/loom-cache | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-build-commit-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-commit- | ||
- name: Gradle deez | ||
uses: gradle/gradle-build-action@v3 | ||
- name: Build artifacts | ||
run: ./gradlew clean :build-logic:build GensouJankMod:build GensouJank:build | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: gensoujank-artifacts-${{ steps.ref.outputs.branch }} | ||
path: build/libs/*.jar | ||
# - name: Reposilite upload | ||
# run: ./gradlew publish | ||
# env: | ||
# USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_GENSOREPOUSERNAME }} | ||
# TOKEN: ${{ secrets.ORG_GRADLE_PROJECT_GENSOREPOPASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
GensouJankMod/src/main/java/net/gensokyoreimagined/gensoujankmod/ITouhouPlayer.java
This file was deleted.
Oops, something went wrong.
52 changes: 10 additions & 42 deletions
52
GensouJankMod/src/main/java/net/gensokyoreimagined/gensoujankmod/TouhouPlayer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,22 @@ | ||
package net.gensokyoreimagined.gensoujankmod; | ||
|
||
import com.mojang.authlib.GameProfile; | ||
import net.minecraft.server.MinecraftServer; | ||
import net.minecraft.server.level.ClientInformation; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import net.minecraft.world.entity.Pose; | ||
import net.minecraft.world.phys.AABB; | ||
import org.bukkit.craftbukkit.entity.CraftBlockDisplay; | ||
import org.bukkit.scheduler.BukkitTask; | ||
import org.bukkit.util.BoundingBox; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.UUID; | ||
|
||
public class TouhouPlayer extends ServerPlayer implements ITouhouPlayer { | ||
/** | ||
* The Y coordinate of the player's hitbox is adjusted by this amount when boss mode is enabled. | ||
*/ | ||
private static double adjustY = 1.2; | ||
public static void setAdjustY(double adjustY) { TouhouPlayer.adjustY = adjustY; } | ||
public void setAdjustYY(double adjustY) { TouhouPlayer.adjustY = adjustY; } | ||
|
||
/** | ||
* Whether to enable the smaller hitbox. | ||
*/ | ||
private boolean bossMode = false; | ||
public boolean isBossMode() { return bossMode; } | ||
public void setBossMode(boolean bossMode) { this.bossMode = bossMode; } | ||
public class TouhouPlayer { | ||
public UUID uuid; | ||
|
||
/** | ||
* The task upon debug mode to reveal the hitbox. | ||
*/ | ||
private BukkitTask debugTask = null; | ||
public BukkitTask getDebugTask() { return debugTask; } | ||
public void setDebugTask(BukkitTask debugTask) { this.debugTask = debugTask; } | ||
public double adjustY = TouhouPlayers.defaultAdjustY; | ||
public boolean bossMode = false; | ||
public BukkitTask debugTask; | ||
public BoundingBox lastBoundingBox; | ||
public CraftBlockDisplay hitbox; | ||
|
||
private BoundingBox lastBoundingBox = null; | ||
public BoundingBox getLastBoundingBox() { return lastBoundingBox; } | ||
public void setLastBoundingBox(BoundingBox lastBoundingBox) { this.lastBoundingBox = lastBoundingBox; } | ||
|
||
private CraftBlockDisplay hitbox = null; | ||
public CraftBlockDisplay getHitboxDisplay() { return hitbox; } | ||
public void setHitboxDisplay(CraftBlockDisplay hitbox) { this.hitbox = hitbox; } | ||
|
||
public TouhouPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) { | ||
super(server, world, profile, clientOptions); | ||
} | ||
|
||
@Override | ||
protected @NotNull AABB makeBoundingBox() { | ||
return bossMode ? getDimensions(Pose.SWIMMING).makeBoundingBox(this.position().add(0, adjustY, 0)) : super.makeBoundingBox(); | ||
public TouhouPlayer(UUID uuid) { | ||
this.uuid = uuid; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
GensouJankMod/src/main/java/net/gensokyoreimagined/gensoujankmod/TouhouPlayers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package net.gensokyoreimagined.gensoujankmod; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.UUID; | ||
|
||
public class TouhouPlayers { | ||
public static double defaultAdjustY = 1.2; | ||
public static Map<UUID, TouhouPlayer> players = new HashMap<>(); | ||
} |
21 changes: 0 additions & 21 deletions
21
...ankMod/src/main/java/net/gensokyoreimagined/gensoujankmod/mixin/core/MixinPlayerList.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.