From 6f2ef7719a078494f4b54b4570a833866f7f8654 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sun, 4 Oct 2020 12:59:31 +0200 Subject: [PATCH] Fixed fire overlays not rendering for disguises --- .../client/render/WorldRenderDelegate.java | 21 +++++++------------ .../entity/behaviour/EntityBehaviour.java | 2 +- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/client/render/WorldRenderDelegate.java b/src/main/java/com/minelittlepony/unicopia/client/render/WorldRenderDelegate.java index 87558b4e..767d56dd 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/render/WorldRenderDelegate.java +++ b/src/main/java/com/minelittlepony/unicopia/client/render/WorldRenderDelegate.java @@ -21,7 +21,6 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.Vector3f; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.state.property.Properties; import net.minecraft.util.math.Direction; import net.minecraft.util.math.MathHelper; @@ -55,6 +54,8 @@ public class WorldRenderDelegate { matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(roll)); } + int fireTicks = pony.getOwner().doesRenderOnFire() ? 1 : 0; + return pony.getSpellOrEmpty(DisguiseSpell.class, true).map(effect -> { effect.update(pony, false); @@ -62,10 +63,10 @@ public class WorldRenderDelegate { Entity e = ve.getAppearance(); if (e != null) { - renderDisguise(dispatcher, ve, e, x, y, z, tickDelta, matrices, vertexConsumers, light); + renderDisguise(dispatcher, ve, e, x, y, z, fireTicks, tickDelta, matrices, vertexConsumers, light); ve.getAttachments().forEach(ee -> { Vec3d difference = ee.getPos().subtract(e.getPos()); - renderDisguise(dispatcher, ve, ee, x + difference.x, y + difference.y, z + difference.z, tickDelta, matrices, vertexConsumers, light); + renderDisguise(dispatcher, ve, ee, x + difference.x, y + difference.y, z + difference.z, fireTicks, tickDelta, matrices, vertexConsumers, light); }); afterEntityRender(pony, matrices); @@ -86,7 +87,7 @@ public class WorldRenderDelegate { public void renderDisguise(EntityRenderDispatcher dispatcher, Disguise ve, Entity e, double x, double y, double z, - float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) { + int fireTicks, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) { if (ve.isAxisAligned() && (x != 0 || y != 0 || z != 0)) { Vec3d cam = MinecraftClient.getInstance().gameRenderer.getCamera().getPos(); @@ -124,7 +125,9 @@ public class WorldRenderDelegate { model.sneaking = e.isSneaking(); } + e.setFireTicks(fireTicks); dispatcher.render(e, x, y, z, e.yaw, tickDelta, matrices, vertexConsumers, light); + e.setFireTicks(0); if (model != null) { model.sneaking = false; @@ -160,14 +163,4 @@ public class WorldRenderDelegate { entity.prevPitch *= -1; entity.pitch *= -1; } - - public void applyWorldTransform(MatrixStack matrices, float tickDelta) { - PlayerEntity player = MinecraftClient.getInstance().player; - - if (player != null && MinecraftClient.getInstance().cameraEntity == player) { - float roll = Pony.of(player).getCamera().calculateRoll(); - - matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(roll)); - } - } } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java index d2c76ff5..d0bee262 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java @@ -194,7 +194,7 @@ public class EntityBehaviour { ((ItemWielder)to).updateItemUsage(from.getActiveHand(), from.getActiveItem(), from.getItemUseTimeLeft()); } - if (from.age < 100 || from instanceof PlayerEntity && ((PlayerEntity)from).isCreative()) { + if (from.age < 100 || from instanceof PlayerEntity && (((PlayerEntity)from).isCreative() || ((PlayerEntity)from).isSpectator())) { to.extinguish(); }