diff --git a/src/main/java/anightdazingzoroark/prift/client/renderer/entity/ApatosaurusRenderer.java b/src/main/java/anightdazingzoroark/prift/client/renderer/entity/ApatosaurusRenderer.java index 2b8ae094..58284155 100644 --- a/src/main/java/anightdazingzoroark/prift/client/renderer/entity/ApatosaurusRenderer.java +++ b/src/main/java/anightdazingzoroark/prift/client/renderer/entity/ApatosaurusRenderer.java @@ -5,7 +5,10 @@ import anightdazingzoroark.prift.server.entity.RiftLargeWeaponType; import anightdazingzoroark.prift.server.entity.creature.Apatosaurus; import anightdazingzoroark.prift.server.entity.creature.RiftCreature; +import anightdazingzoroark.prift.server.entity.creature.Utahraptor; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.culling.ICamera; import net.minecraft.client.renderer.entity.RenderManager; import software.bernie.geckolib3.geo.render.built.GeoModel; import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer; @@ -16,6 +19,12 @@ public ApatosaurusRenderer(RenderManager renderManager) { this.shadowSize = 1.75f; } + @Override + public boolean shouldRender(RiftCreature livingEntity, ICamera camera, double camX, double camY, double camZ) { + Apatosaurus apatosaurus = (Apatosaurus) livingEntity; + return super.shouldRender(apatosaurus, camera, camX, camY, camZ) || apatosaurus.shouldRender(camera) || Minecraft.getMinecraft().player.isRidingOrBeingRiddenBy(apatosaurus); + } + @Override public void render(GeoModel model, RiftCreature animatable, float partialTicks, float red, float green, float blue, float alpha) { float scale = RiftUtil.setModelScale(animatable, 0.35f, 2.25f); diff --git a/src/main/java/anightdazingzoroark/prift/client/renderer/entity/ParasaurolophusRenderer.java b/src/main/java/anightdazingzoroark/prift/client/renderer/entity/ParasaurolophusRenderer.java index e6b363ea..5460814b 100644 --- a/src/main/java/anightdazingzoroark/prift/client/renderer/entity/ParasaurolophusRenderer.java +++ b/src/main/java/anightdazingzoroark/prift/client/renderer/entity/ParasaurolophusRenderer.java @@ -2,8 +2,12 @@ import anightdazingzoroark.prift.RiftUtil; import anightdazingzoroark.prift.client.model.RiftCreatureModel; +import anightdazingzoroark.prift.server.entity.creature.Apatosaurus; +import anightdazingzoroark.prift.server.entity.creature.Parasaurolophus; import anightdazingzoroark.prift.server.entity.creature.RiftCreature; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.culling.ICamera; import net.minecraft.client.renderer.entity.RenderManager; import software.bernie.geckolib3.geo.render.built.GeoModel; import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer; @@ -15,6 +19,12 @@ public ParasaurolophusRenderer(RenderManager renderManager) { this.shadowSize = 1; } + @Override + public boolean shouldRender(RiftCreature livingEntity, ICamera camera, double camX, double camY, double camZ) { + Parasaurolophus parasaurolophus = (Parasaurolophus) livingEntity; + return super.shouldRender(parasaurolophus, camera, camX, camY, camZ) || parasaurolophus.shouldRender(camera) || Minecraft.getMinecraft().player.isRidingOrBeingRiddenBy(parasaurolophus); + } + @Override public void render(GeoModel model, RiftCreature animatable, float partialTicks, float red, float green, float blue, float alpha) { float scale = RiftUtil.setModelScale(animatable, 0.3f, 1.5f); diff --git a/src/main/java/anightdazingzoroark/prift/client/renderer/entity/StegosaurusRenderer.java b/src/main/java/anightdazingzoroark/prift/client/renderer/entity/StegosaurusRenderer.java index 6ef877ae..62529def 100644 --- a/src/main/java/anightdazingzoroark/prift/client/renderer/entity/StegosaurusRenderer.java +++ b/src/main/java/anightdazingzoroark/prift/client/renderer/entity/StegosaurusRenderer.java @@ -3,7 +3,11 @@ import anightdazingzoroark.prift.RiftUtil; import anightdazingzoroark.prift.client.model.RiftCreatureModel; import anightdazingzoroark.prift.server.entity.creature.RiftCreature; +import anightdazingzoroark.prift.server.entity.creature.Stegosaurus; +import anightdazingzoroark.prift.server.entity.creature.Tyrannosaurus; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.culling.ICamera; import net.minecraft.client.renderer.entity.RenderManager; import software.bernie.geckolib3.geo.render.built.GeoModel; import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer; @@ -15,6 +19,12 @@ public StegosaurusRenderer(RenderManager renderManager) { this.shadowSize = 1.0f; } + @Override + public boolean shouldRender(RiftCreature livingEntity, ICamera camera, double camX, double camY, double camZ) { + Stegosaurus stegosaurus = (Stegosaurus) livingEntity; + return super.shouldRender(stegosaurus, camera, camX, camY, camZ) || stegosaurus.shouldRender(camera) || Minecraft.getMinecraft().player.isRidingOrBeingRiddenBy(stegosaurus); + } + @Override public void render(GeoModel model, RiftCreature animatable, float partialTicks, float red, float green, float blue, float alpha) { float scale = RiftUtil.setModelScale(animatable, 0.3f, 2.125f); diff --git a/src/main/java/anightdazingzoroark/prift/client/renderer/entity/TriceratopsRenderer.java b/src/main/java/anightdazingzoroark/prift/client/renderer/entity/TriceratopsRenderer.java index f4d7348d..40aa8735 100644 --- a/src/main/java/anightdazingzoroark/prift/client/renderer/entity/TriceratopsRenderer.java +++ b/src/main/java/anightdazingzoroark/prift/client/renderer/entity/TriceratopsRenderer.java @@ -3,7 +3,11 @@ import anightdazingzoroark.prift.RiftUtil; import anightdazingzoroark.prift.client.model.RiftCreatureModel; import anightdazingzoroark.prift.server.entity.creature.RiftCreature; +import anightdazingzoroark.prift.server.entity.creature.Stegosaurus; +import anightdazingzoroark.prift.server.entity.creature.Triceratops; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.culling.ICamera; import net.minecraft.client.renderer.entity.RenderManager; import software.bernie.geckolib3.geo.render.built.GeoModel; import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer; @@ -14,6 +18,12 @@ public TriceratopsRenderer(RenderManager renderManager) { this.shadowSize = 1.0f; } + @Override + public boolean shouldRender(RiftCreature livingEntity, ICamera camera, double camX, double camY, double camZ) { + Triceratops triceratops = (Triceratops) livingEntity; + return super.shouldRender(triceratops, camera, camX, camY, camZ) || triceratops.shouldRender(camera) || Minecraft.getMinecraft().player.isRidingOrBeingRiddenBy(triceratops); + } + @Override public void render(GeoModel model, RiftCreature animatable, float partialTicks, float red, float green, float blue, float alpha) { float scale = RiftUtil.setModelScale(animatable, 0.3f, 1.75f); diff --git a/src/main/java/anightdazingzoroark/prift/client/renderer/entity/UtahraptorRenderer.java b/src/main/java/anightdazingzoroark/prift/client/renderer/entity/UtahraptorRenderer.java index 4b8e1966..db6ef72e 100644 --- a/src/main/java/anightdazingzoroark/prift/client/renderer/entity/UtahraptorRenderer.java +++ b/src/main/java/anightdazingzoroark/prift/client/renderer/entity/UtahraptorRenderer.java @@ -3,7 +3,11 @@ import anightdazingzoroark.prift.RiftUtil; import anightdazingzoroark.prift.client.model.RiftCreatureModel; import anightdazingzoroark.prift.server.entity.creature.RiftCreature; +import anightdazingzoroark.prift.server.entity.creature.Triceratops; +import anightdazingzoroark.prift.server.entity.creature.Utahraptor; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.culling.ICamera; import net.minecraft.client.renderer.entity.RenderManager; import software.bernie.geckolib3.geo.render.built.GeoModel; import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer; @@ -14,6 +18,12 @@ public UtahraptorRenderer(RenderManager renderManager) { this.shadowSize = 1.0f; } + @Override + public boolean shouldRender(RiftCreature livingEntity, ICamera camera, double camX, double camY, double camZ) { + Utahraptor utahraptor = (Utahraptor) livingEntity; + return super.shouldRender(utahraptor, camera, camX, camY, camZ) || utahraptor.shouldRender(camera) || Minecraft.getMinecraft().player.isRidingOrBeingRiddenBy(utahraptor); + } + @Override public void render(GeoModel model, RiftCreature animatable, float partialTicks, float red, float green, float blue, float alpha) { float scale = RiftUtil.setModelScale(animatable, 0.3f, 1f); diff --git a/src/main/java/anightdazingzoroark/prift/server/entity/creature/Apatosaurus.java b/src/main/java/anightdazingzoroark/prift/server/entity/creature/Apatosaurus.java index 7fedc9f1..ab7a83fd 100644 --- a/src/main/java/anightdazingzoroark/prift/server/entity/creature/Apatosaurus.java +++ b/src/main/java/anightdazingzoroark/prift/server/entity/creature/Apatosaurus.java @@ -11,6 +11,7 @@ import anightdazingzoroark.prift.server.entity.projectile.RiftCannonball; import anightdazingzoroark.prift.server.entity.projectile.RiftCatapultBoulder; import anightdazingzoroark.prift.server.entity.projectile.RiftMortarShell; +import anightdazingzoroark.prift.server.enums.TameStatusType; import anightdazingzoroark.prift.server.items.RiftItems; import anightdazingzoroark.prift.server.items.RiftLargeWeaponItem; import anightdazingzoroark.prift.server.message.*; @@ -20,6 +21,7 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.culling.ICamera; import net.minecraft.client.settings.GameSettings; import net.minecraft.entity.*; import net.minecraft.entity.passive.EntityTameable; @@ -67,6 +69,18 @@ public class Apatosaurus extends RiftCreature { private EntityLivingBase passengerTwo; private int launchTick; public boolean dismount = false; + private RiftCreaturePart neck0Part; + private RiftCreaturePart neck1Part; + private RiftCreaturePart neck2Part; + private RiftCreaturePart neck3Part; + private RiftCreaturePart neck4Part; + private RiftCreaturePart neck5Part; + private RiftCreaturePart leftBackLegPart; + private RiftCreaturePart rightBackLegPart; + private RiftCreaturePart tail0Part; + private RiftCreaturePart tail1Part; + private RiftCreaturePart tail2Part; + private RiftCreaturePart tail3Part; public Apatosaurus(World worldIn) { super(worldIn, RiftCreatureType.APATOSAURUS); @@ -129,7 +143,104 @@ public void resetParts(float scale) { if (scale > this.oldScale) { this.oldScale = scale; this.removeParts(); - this.bodyPart = new RiftMainBodyPart(this, 1.5f, 0, 1, 1 * scale, 1 * scale, 0); + this.headPart = new RiftCreaturePart(this, 6.625f, 0, 4.5125f, 0.625f * scale, 0.5f * scale, 2f); + this.bodyPart = new RiftMainBodyPart(this, -0.75f, 0, 1.35f, 1.65f * scale, scale, 1f); + this.neck0Part = new RiftCreaturePart(this, 5.75f, 0, 4.25f, 0.5f * scale, 0.5f * scale, 1.5f); + this.neck1Part = new RiftCreaturePart(this, 5f, 0, 3.75f, 0.5f * scale, 0.5f * scale, 1.5f); + this.neck2Part = new RiftCreaturePart(this, 4.25f, 0, 3.25f, 0.5f * scale, 0.5f * scale, 1.5f); + this.neck3Part = new RiftCreaturePart(this, 3.5f, 0, 2.75f, 0.5f * scale, 0.625f * scale, 1.5f); + this.neck4Part = new RiftCreaturePart(this, 2.75f, 0, 2.5f, 0.5f * scale, 0.625f * scale, 1.5f); + this.neck5Part = new RiftCreaturePart(this, 1.75f, 0, 2.25f, 0.625f * scale, 0.625f * scale, 1.5f); + this.leftBackLegPart = new RiftCreaturePart(this, 2.375f, -150, 0, 0.625f * scale, 1.25f * scale, 0.5f); + this.rightBackLegPart = new RiftCreaturePart(this, 2.375f, 150, 0, 0.625f * scale, 1.25f * scale, 0.5f); + this.tail0Part = new RiftCreaturePart(this, -3.25f, 0, 1.9f, 0.675f * scale, 0.625f * scale, 0.5f); + this.tail1Part = new RiftCreaturePart(this, -4.75f, 0, 1.8f, 0.625f * scale, 0.6f * scale, 0.5f); + this.tail2Part = new RiftCreaturePart(this, -6f, 0, 1.7f, 0.625f * scale, 0.6f * scale, 0.5f); + this.tail3Part = new RiftCreaturePart(this, -7.25f, 0, 1.7f, 0.625f * scale, 0.45f * scale, 0.5f); + } + } + + @Override + public void updateParts() { + super.updateParts(); + if (this.neck0Part != null) this.neck0Part.onUpdate(); + if (this.neck1Part != null) this.neck1Part.onUpdate(); + if (this.neck2Part != null) this.neck2Part.onUpdate(); + if (this.neck3Part != null) this.neck3Part.onUpdate(); + if (this.neck4Part != null) this.neck4Part.onUpdate(); + if (this.neck5Part != null) this.neck5Part.onUpdate(); + if (this.leftBackLegPart != null) this.leftBackLegPart.onUpdate(); + if (this.rightBackLegPart != null) this.rightBackLegPart.onUpdate(); + if (this.tail0Part != null) this.tail0Part.onUpdate(); + if (this.tail1Part != null) this.tail1Part.onUpdate(); + if (this.tail2Part != null) this.tail2Part.onUpdate(); + if (this.tail3Part != null) this.tail3Part.onUpdate(); + + float sitOffset = (this.getTameStatus().equals(TameStatusType.SIT) && !this.isBeingRidden()) ? -1.125f : 0; + if (this.headPart != null) this.headPart.setPositionAndUpdate(this.headPart.posX, this.headPart.posY + sitOffset, this.headPart.posZ); + if (this.bodyPart != null) this.bodyPart.setPositionAndUpdate(this.bodyPart.posX, this.bodyPart.posY + sitOffset, this.bodyPart.posZ); + if (this.neck0Part != null) this.neck0Part.setPositionAndUpdate(this.neck0Part.posX, this.neck0Part.posY + sitOffset, this.neck0Part.posZ); + if (this.neck1Part != null) this.neck1Part.setPositionAndUpdate(this.neck1Part.posX, this.neck1Part.posY + sitOffset, this.neck1Part.posZ); + if (this.neck2Part != null) this.neck2Part.setPositionAndUpdate(this.neck2Part.posX, this.neck2Part.posY + sitOffset, this.neck2Part.posZ); + if (this.neck3Part != null) this.neck3Part.setPositionAndUpdate(this.neck3Part.posX, this.neck3Part.posY + sitOffset, this.neck3Part.posZ); + if (this.neck4Part != null) this.neck4Part.setPositionAndUpdate(this.neck4Part.posX, this.neck4Part.posY + sitOffset, this.neck4Part.posZ); + if (this.neck5Part != null) this.neck5Part.setPositionAndUpdate(this.neck5Part.posX, this.neck5Part.posY + sitOffset, this.neck5Part.posZ); + if (this.tail0Part != null) this.tail0Part.setPositionAndUpdate(this.tail0Part.posX, this.tail0Part.posY + sitOffset, this.tail0Part.posZ); + if (this.tail1Part != null) this.tail1Part.setPositionAndUpdate(this.tail1Part.posX, this.tail1Part.posY + sitOffset, this.tail1Part.posZ); + if (this.tail2Part != null) this.tail2Part.setPositionAndUpdate(this.tail2Part.posX, this.tail2Part.posY + sitOffset, this.tail2Part.posZ); + if (this.tail3Part != null) this.tail3Part.setPositionAndUpdate(this.tail3Part.posX, this.tail3Part.posY + sitOffset, this.tail3Part.posZ); + } + + @Override + public void removeParts() { + super.removeParts(); + if (this.neck0Part != null) { + this.world.removeEntityDangerously(this.neck0Part); + this.neck0Part = null; + } + if (this.neck1Part != null) { + this.world.removeEntityDangerously(this.neck1Part); + this.neck1Part = null; + } + if (this.neck2Part != null) { + this.world.removeEntityDangerously(this.neck2Part); + this.neck2Part = null; + } + if (this.neck3Part != null) { + this.world.removeEntityDangerously(this.neck3Part); + this.neck3Part = null; + } + if (this.neck4Part != null) { + this.world.removeEntityDangerously(this.neck4Part); + this.neck4Part = null; + } + if (this.neck5Part != null) { + this.world.removeEntityDangerously(this.neck5Part); + this.neck5Part = null; + } + if (this.leftBackLegPart != null) { + this.world.removeEntityDangerously(this.leftBackLegPart); + this.leftBackLegPart = null; + } + if (this.rightBackLegPart != null) { + this.world.removeEntityDangerously(this.rightBackLegPart); + this.rightBackLegPart = null; + } + if (this.tail0Part != null) { + this.world.removeEntityDangerously(this.tail0Part); + this.tail0Part = null; + } + if (this.tail1Part != null) { + this.world.removeEntityDangerously(this.tail1Part); + this.tail1Part = null; + } + if (this.tail2Part != null) { + this.world.removeEntityDangerously(this.tail2Part); + this.tail2Part = null; + } + if (this.tail3Part != null) { + this.world.removeEntityDangerously(this.tail3Part); + this.tail3Part = null; } } @@ -331,6 +442,11 @@ public Vec3d passengerPosTwo() { return new Vec3d(seatTwoX, this.posY + 2.25, seatTwoZ); } + @SideOnly(Side.CLIENT) + public boolean shouldRender(ICamera camera) { + return super.shouldRender(camera) || this.inFrustrum(camera, this.neck0Part) || this.inFrustrum(camera, this.neck1Part) || this.inFrustrum(camera, this.neck2Part) || this.inFrustrum(camera, this.neck3Part) || this.inFrustrum(camera, this.neck4Part) || this.inFrustrum(camera, this.neck5Part) || this.inFrustrum(camera, this.leftBackLegPart) || this.inFrustrum(camera, this.rightBackLegPart) || this.inFrustrum(camera, this.tail0Part) || this.inFrustrum(camera, this.tail1Part) || this.inFrustrum(camera, this.tail2Part) || this.inFrustrum(camera, this.tail3Part); + } + @Override public void controlInput(int control, int holdAmount, EntityLivingBase target) { EntityPlayer rider = (EntityPlayer) this.getControllingPassenger(); diff --git a/src/main/java/anightdazingzoroark/prift/server/entity/creature/Parasaurolophus.java b/src/main/java/anightdazingzoroark/prift/server/entity/creature/Parasaurolophus.java index 96615485..39c1a503 100644 --- a/src/main/java/anightdazingzoroark/prift/server/entity/creature/Parasaurolophus.java +++ b/src/main/java/anightdazingzoroark/prift/server/entity/creature/Parasaurolophus.java @@ -1,5 +1,6 @@ package anightdazingzoroark.prift.server.entity.creature; +import anightdazingzoroark.prift.server.enums.TameStatusType; import com.codetaylor.mc.athenaeum.util.Properties; import anightdazingzoroark.prift.RiftInitialize; import anightdazingzoroark.prift.RiftUtil; @@ -13,6 +14,7 @@ import com.google.common.base.Predicate; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.culling.ICamera; import net.minecraft.entity.*; import net.minecraft.entity.passive.EntityTameable; import net.minecraft.entity.player.EntityPlayer; @@ -32,6 +34,8 @@ import net.minecraft.world.World; import net.minecraft.world.storage.loot.LootTableList; import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import software.bernie.geckolib3.core.IAnimatable; import software.bernie.geckolib3.core.PlayState; import software.bernie.geckolib3.core.builder.AnimationBuilder; @@ -46,6 +50,11 @@ public class Parasaurolophus extends RiftCreature implements IWorkstationUser { public static final ResourceLocation LOOT = LootTableList.register(new ResourceLocation(RiftInitialize.MODID, "entities/parasaurolophus")); private static final DataParameter BLOWING = EntityDataManager.createKey(Parasaurolophus.class, DataSerializers.BOOLEAN); private static final DataParameter CAN_BLOW = EntityDataManager.createKey(Parasaurolophus.class, DataSerializers.BOOLEAN); + private RiftCreaturePart neckPart; + private RiftCreaturePart tail0Part; + private RiftCreaturePart tail1Part; + private RiftCreaturePart tail2Part; + private RiftCreaturePart tail3Part; public Parasaurolophus(World worldIn) { super(worldIn, RiftCreatureType.PARASAUROLOPHUS); @@ -102,7 +111,57 @@ public void resetParts(float scale) { if (scale > this.oldScale) { this.oldScale = scale; this.removeParts(); - this.bodyPart = new RiftMainBodyPart(this, 1.5f, 0, 1, 1 * scale, 1 * scale, 0); + this.headPart = new RiftCreaturePart(this, 2.875f, 0, 1.48f, 0.625f * scale, 0.5f * scale, 1.5f); + this.bodyPart = new RiftMainBodyPart(this, 1.375f, 0, 0.8f, 0.75f * scale, 0.8f * scale, 1f); + this.neckPart = new RiftCreaturePart(this, 2.125f, 0, 1.125f, 0.5f * scale, 0.7f * scale, 1.5f); + this.tail0Part = new RiftCreaturePart(this, -1.125f, 0, 1f, 0.4f * scale, 0.6f * scale, 0.5f); + this.tail1Part = new RiftCreaturePart(this, -1.625f, 0, 1.1f, 0.4f * scale, 0.45f * scale, 0.5f); + this.tail2Part = new RiftCreaturePart(this, -2.125f, 0, 1.05f, 0.4f * scale, 0.45f * scale, 0.5f); + this.tail3Part = new RiftCreaturePart(this, -2.875f, 0, 1.1f, 0.5f * scale, 0.35f * scale, 0.5f); + } + } + + @Override + public void updateParts() { + super.updateParts(); + if (this.neckPart != null) this.neckPart.onUpdate(); + if (this.tail0Part != null) this.tail0Part.onUpdate(); + if (this.tail1Part != null) this.tail1Part.onUpdate(); + if (this.tail2Part != null) this.tail2Part.onUpdate(); + if (this.tail3Part != null) this.tail3Part.onUpdate(); + + float sitOffset = (this.getTameStatus().equals(TameStatusType.SIT) && !this.isBeingRidden()) ? -0.6f : 0; + if (this.headPart != null) this.headPart.setPositionAndUpdate(this.headPart.posX, this.headPart.posY + sitOffset, this.headPart.posZ); + if (this.bodyPart != null) this.bodyPart.setPositionAndUpdate(this.bodyPart.posX, this.bodyPart.posY + sitOffset, this.bodyPart.posZ); + if (this.neckPart != null) this.neckPart.setPositionAndUpdate(this.neckPart.posX, this.neckPart.posY + sitOffset, this.neckPart.posZ); + if (this.tail0Part != null) this.tail0Part.setPositionAndUpdate(this.tail0Part.posX, this.tail0Part.posY + sitOffset, this.tail0Part.posZ); + if (this.tail1Part != null) this.tail1Part.setPositionAndUpdate(this.tail1Part.posX, this.tail1Part.posY + sitOffset, this.tail1Part.posZ); + if (this.tail2Part != null) this.tail2Part.setPositionAndUpdate(this.tail2Part.posX, this.tail2Part.posY + sitOffset, this.tail2Part.posZ); + if (this.tail3Part != null) this.tail3Part.setPositionAndUpdate(this.tail3Part.posX, this.tail3Part.posY + sitOffset, this.tail3Part.posZ); + } + + @Override + public void removeParts() { + super.removeParts(); + if (this.neckPart != null) { + this.world.removeEntityDangerously(this.neckPart); + this.neckPart = null; + } + if (this.tail0Part != null) { + this.world.removeEntityDangerously(this.tail0Part); + this.tail0Part = null; + } + if (this.tail1Part != null) { + this.world.removeEntityDangerously(this.tail1Part); + this.tail1Part = null; + } + if (this.tail2Part != null) { + this.world.removeEntityDangerously(this.tail2Part); + this.tail2Part = null; + } + if (this.tail3Part != null) { + this.world.removeEntityDangerously(this.tail3Part); + this.tail3Part = null; } } @@ -222,6 +281,11 @@ public Vec3d riderPos() { return new Vec3d(this.posX, this.posY - 0.35, this.posZ); } + @SideOnly(Side.CLIENT) + public boolean shouldRender(ICamera camera) { + return super.shouldRender(camera) || this.inFrustrum(camera, this.neckPart) || this.inFrustrum(camera, this.tail0Part) || this.inFrustrum(camera, this.tail1Part) || this.inFrustrum(camera, this.tail2Part) || this.inFrustrum(camera, this.tail3Part); + } + @Override public void controlInput(int control, int holdAmount, EntityLivingBase target) { if (control == 0) { diff --git a/src/main/java/anightdazingzoroark/prift/server/entity/creature/Triceratops.java b/src/main/java/anightdazingzoroark/prift/server/entity/creature/Triceratops.java index aa99f7b8..86427489 100644 --- a/src/main/java/anightdazingzoroark/prift/server/entity/creature/Triceratops.java +++ b/src/main/java/anightdazingzoroark/prift/server/entity/creature/Triceratops.java @@ -8,6 +8,7 @@ import anightdazingzoroark.prift.server.entity.ai.*; import anightdazingzoroark.prift.server.entity.interfaces.IChargingMob; import anightdazingzoroark.prift.server.enums.TameStatusType; +import net.minecraft.client.renderer.culling.ICamera; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.player.EntityPlayer; @@ -19,6 +20,8 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraft.world.storage.loot.LootTableList; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import software.bernie.geckolib3.core.IAnimatable; import software.bernie.geckolib3.core.PlayState; import software.bernie.geckolib3.core.builder.AnimationBuilder; @@ -158,6 +161,11 @@ public Vec3d riderPos() { return new Vec3d(xOffset, this.posY, zOffset); } + @SideOnly(Side.CLIENT) + public boolean shouldRender(ICamera camera) { + return super.shouldRender(camera) || this.inFrustrum(camera, this.hipPart) || this.inFrustrum(camera, this.leftBackLegPart) || this.inFrustrum(camera, this.rightBackLegPart) || this.inFrustrum(camera, this.tail0Part) || this.inFrustrum(camera, this.tail1Part) || this.inFrustrum(camera, this.tail2Part); + } + @Override public void controlInput(int control, int holdAmount, EntityLivingBase target) { if (control == 0) {