Skip to content

Commit

Permalink
Fix rendering of flamethrower particles being incorrect for other cli…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
pupnewfster committed Jul 27, 2024
1 parent af08815 commit d742d96
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/mekanism/client/render/RenderTickHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,14 @@ public void tickEnd(ClientTickEvent.Post event) {
//Note: We check that the game mode is not null as if it is that means the world is unloading, and we don't actually want to be rendering
// as our data may be out of date or invalid. For example configs could unload while it is still unloading
if (minecraft.player != null && minecraft.player.level() != null && minecraft.gameMode != null && MekanismRenderer.isRunningNormally()) {
Player player = minecraft.player;
Level world = minecraft.player.level();
float partialTicks = minecraft.getTimer().getGameTimeDeltaPartialTick(false);
//Traverse active jetpacks and do animations
for (UUID uuid : Mekanism.playerState.getActiveJetpacks()) {
Player p = world.getPlayerByUUID(uuid);
if (p != null) {
Pos3D playerPos = new Pos3D(p).translate(0, p.getEyeHeight(), 0);
//TODO - 1.21: Figure out why this is incorrect for other clients when they are hovering
Vec3 playerMotion = p.getDeltaMovement();
float random = (world.random.nextFloat() - 0.5F) * 0.1F;
//This positioning code is somewhat cursed, but it seems to be mostly working and entity pose code seems cursed in general
Expand All @@ -272,7 +272,7 @@ public void tickEnd(ClientTickEvent.Post event) {
}
xRot = -xRot;
Pos3D eyeAdjustments;
if (p.isFallFlying() && (p != player || !minecraft.options.getCameraType().isFirstPerson())) {
if (p.isFallFlying() && (p != minecraft.player || !minecraft.options.getCameraType().isFirstPerson())) {
eyeAdjustments = new Pos3D(0, p.getEyeHeight(Pose.STANDING), 0).xRot(xRot).yRot(p.yBodyRot);
} else if (p.isVisuallySwimming()) {
eyeAdjustments = new Pos3D(0, p.getEyeHeight(), 0).xRot(xRot).yRot(p.yBodyRot).translate(0, 0.5, 0);
Expand Down Expand Up @@ -304,9 +304,9 @@ public void tickEnd(ClientTickEvent.Post event) {
//Traverse players and do animations for idle flamethrowers
for (Player p : world.players()) {
if (!p.swinging) {
if (player.isUsingItem()) {
InteractionHand usedHand = player.getUsedItemHand();
if (!(player.getItemInHand(usedHand).getItem() instanceof ItemFlamethrower)) {
if (p.isUsingItem()) {
InteractionHand usedHand = p.getUsedItemHand();
if (!(p.getItemInHand(usedHand).getItem() instanceof ItemFlamethrower)) {
//If we the used item isn't a flamethrower, grab the other hand's item for checks
// if it was an active flamethrower we just skip adding the idle particles
tryAddIdleFlamethrowerParticles(minecraft, p, usedHand == InteractionHand.MAIN_HAND ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND);
Expand Down

0 comments on commit d742d96

Please sign in to comment.