From d0885f4638b96650ee32d31ad61a7df38066e4ed Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Sun, 28 Jul 2024 22:31:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/renderer/entity/DroneRenderer.java | 40 +++--- .../superbwarfare/entity/DroneEntity.java | 118 +++++++++--------- .../entity/DroneGrenadeEntity.java | 1 - .../entity/model/DroneModel.java | 62 ++++----- .../event/ClientEventHandler.java | 16 +-- 5 files changed, 118 insertions(+), 119 deletions(-) diff --git a/src/main/java/net/mcreator/superbwarfare/client/renderer/entity/DroneRenderer.java b/src/main/java/net/mcreator/superbwarfare/client/renderer/entity/DroneRenderer.java index e0bbc1124..fcc9da79c 100644 --- a/src/main/java/net/mcreator/superbwarfare/client/renderer/entity/DroneRenderer.java +++ b/src/main/java/net/mcreator/superbwarfare/client/renderer/entity/DroneRenderer.java @@ -16,27 +16,27 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.PoseStack; public class DroneRenderer extends GeoEntityRenderer { - public DroneRenderer(EntityRendererProvider.Context renderManager) { - super(renderManager, new DroneModel()); - this.shadowRadius = 0.2f; - } + public DroneRenderer(EntityRendererProvider.Context renderManager) { + super(renderManager, new DroneModel()); + this.shadowRadius = 0.2f; + } - @Override - public RenderType getRenderType(DroneEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) { - return RenderType.entityTranslucent(getTextureLocation(animatable)); - } + @Override + public RenderType getRenderType(DroneEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) { + return RenderType.entityTranslucent(getTextureLocation(animatable)); + } - @Override - public void preRender(PoseStack poseStack, DroneEntity entity, BakedGeoModel model, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, float red, float green, - float blue, float alpha) { - float scale = 1f; - this.scaleHeight = scale; - this.scaleWidth = scale; - super.preRender(poseStack, entity, model, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, red, green, blue, alpha); - } + @Override + public void preRender(PoseStack poseStack, DroneEntity entity, BakedGeoModel model, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, float red, float green, + float blue, float alpha) { + float scale = 1f; + this.scaleHeight = scale; + this.scaleWidth = scale; + super.preRender(poseStack, entity, model, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, red, green, blue, alpha); + } - @Override - protected float getDeathMaxRotation(DroneEntity entityLivingBaseIn) { - return 0.0F; - } + @Override + protected float getDeathMaxRotation(DroneEntity entityLivingBaseIn) { + return 0.0F; + } } diff --git a/src/main/java/net/mcreator/superbwarfare/entity/DroneEntity.java b/src/main/java/net/mcreator/superbwarfare/entity/DroneEntity.java index 7c177f097..e22d374e4 100644 --- a/src/main/java/net/mcreator/superbwarfare/entity/DroneEntity.java +++ b/src/main/java/net/mcreator/superbwarfare/entity/DroneEntity.java @@ -71,12 +71,12 @@ public class DroneEntity extends PathfinderMob implements GeoEntity { public static final EntityDataAccessor CONTROLLER = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.STRING); public static final EntityDataAccessor AMMO = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.INT); public static final EntityDataAccessor KAMIKAZE = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.BOOLEAN); - public static final EntityDataAccessor MOVEX = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.FLOAT); - public static final EntityDataAccessor MOVEY = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.FLOAT); - public static final EntityDataAccessor MOVEZ = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor MOVE_X = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor MOVE_Y = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor MOVE_Z = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor ROT_X = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor ROT_Z = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.FLOAT); - public static final EntityDataAccessor ROTX = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.FLOAT); - public static final EntityDataAccessor ROTZ = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.FLOAT); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); private boolean move = false; @@ -108,11 +108,11 @@ public class DroneEntity extends PathfinderMob implements GeoEntity { this.entityData.define(LINKED, false); this.entityData.define(AMMO, 0); this.entityData.define(KAMIKAZE, false); - this.entityData.define(MOVEX, 0f); - this.entityData.define(MOVEY, 0f); - this.entityData.define(MOVEZ, 0f); - this.entityData.define(ROTX, 0f); - this.entityData.define(ROTZ, 0f); + this.entityData.define(MOVE_X, 0f); + this.entityData.define(MOVE_Y, 0f); + this.entityData.define(MOVE_Z, 0f); + this.entityData.define(ROT_X, 0f); + this.entityData.define(ROT_Z, 0f); } @Override @@ -153,11 +153,11 @@ public class DroneEntity extends PathfinderMob implements GeoEntity { compound.putString("Controller", this.entityData.get(CONTROLLER)); compound.putInt("ammo", this.entityData.get(AMMO)); compound.putBoolean("Kamikaze", this.entityData.get(KAMIKAZE)); - compound.putFloat("moveX", this.entityData.get(MOVEX)); - compound.putFloat("moveY", this.entityData.get(MOVEY)); - compound.putFloat("moveZ", this.entityData.get(MOVEZ)); - compound.putFloat("rotX", this.entityData.get(ROTX)); - compound.putFloat("rotZ", this.entityData.get(ROTZ)); + compound.putFloat("moveX", this.entityData.get(MOVE_X)); + compound.putFloat("moveY", this.entityData.get(MOVE_Y)); + compound.putFloat("moveZ", this.entityData.get(MOVE_Z)); + compound.putFloat("rotX", this.entityData.get(ROT_X)); + compound.putFloat("rotZ", this.entityData.get(ROT_Z)); } @Override @@ -173,15 +173,15 @@ public class DroneEntity extends PathfinderMob implements GeoEntity { if (compound.contains("Kamikaze")) this.entityData.set(KAMIKAZE, compound.getBoolean("Kamikaze")); if (compound.contains("moveX")) - this.entityData.set(MOVEX, compound.getFloat("moveX")); + this.entityData.set(MOVE_X, compound.getFloat("moveX")); if (compound.contains("moveY")) - this.entityData.set(MOVEY, compound.getFloat("moveY")); + this.entityData.set(MOVE_Y, compound.getFloat("moveY")); if (compound.contains("moveZ")) - this.entityData.set(MOVEZ, compound.getFloat("moveZ")); + this.entityData.set(MOVE_Z, compound.getFloat("moveZ")); if (compound.contains("rotX")) - this.entityData.set(ROTX, compound.getFloat("rotX")); + this.entityData.set(ROT_X, compound.getFloat("rotX")); if (compound.contains("rotZ")) - this.entityData.set(ROTZ, compound.getFloat("rotZ")); + this.entityData.set(ROT_Z, compound.getFloat("rotZ")); } @Override @@ -189,66 +189,66 @@ public class DroneEntity extends PathfinderMob implements GeoEntity { super.baseTick(); if (this.getPersistentData().getBoolean("left")) { - this.entityData.set(MOVEX,-1.5f); - this.entityData.set(ROTX,Mth.clamp(this.entityData.get(ROTX) + 0.05f, -0.5f, 0.5f)); + this.entityData.set(MOVE_X, -1.5f); + this.entityData.set(ROT_X, Mth.clamp(this.entityData.get(ROT_X) + 0.05f, -0.5f, 0.5f)); } if (this.getPersistentData().getBoolean("right")) { - this.entityData.set(MOVEX,1.5f); - this.entityData.set(ROTX,Mth.clamp(this.entityData.get(ROTX) - 0.05f, -0.5f, 0.5f)); + this.entityData.set(MOVE_X, 1.5f); + this.entityData.set(ROT_X, Mth.clamp(this.entityData.get(ROT_X) - 0.05f, -0.5f, 0.5f)); } - if (this.entityData.get(ROTX) > 0) { - this.entityData.set(ROTX, Mth.clamp(this.entityData.get(ROTX) - 0.025f, 0, 0.5f)); + if (this.entityData.get(ROT_X) > 0) { + this.entityData.set(ROT_X, Mth.clamp(this.entityData.get(ROT_X) - 0.025f, 0, 0.5f)); } else { - this.entityData.set(ROTX, Mth.clamp(this.entityData.get(ROTX) + 0.025f, -0.5f, 0)); + this.entityData.set(ROT_X, Mth.clamp(this.entityData.get(ROT_X) + 0.025f, -0.5f, 0)); } if (!this.getPersistentData().getBoolean("left") && !this.getPersistentData().getBoolean("right")) { - if (this.entityData.get(MOVEX) >= 0) { - this.entityData.set(MOVEX,Mth.clamp(this.entityData.get(MOVEX) - 0.3f, 0, 1)); + if (this.entityData.get(MOVE_X) >= 0) { + this.entityData.set(MOVE_X, Mth.clamp(this.entityData.get(MOVE_X) - 0.3f, 0, 1)); } else { - this.entityData.set(MOVEX,Mth.clamp(this.entityData.get(MOVEX) + 0.3f, -1, 0)); + this.entityData.set(MOVE_X, Mth.clamp(this.entityData.get(MOVE_X) + 0.3f, -1, 0)); } } if (this.getPersistentData().getBoolean("forward")) { - this.entityData.set(MOVEZ,this.entityData.get(MOVEZ) - 0.15f); - this.entityData.set(ROTZ,Mth.clamp(this.entityData.get(ROTZ) - 0.05f, -0.5f, 0.5f)); + this.entityData.set(MOVE_Z, this.entityData.get(MOVE_Z) - 0.15f); + this.entityData.set(ROT_Z, Mth.clamp(this.entityData.get(ROT_Z) - 0.05f, -0.5f, 0.5f)); } if (this.getPersistentData().getBoolean("backward")) { - this.entityData.set(MOVEZ,this.entityData.get(MOVEZ) + 0.15f); - this.entityData.set(ROTZ,Mth.clamp(this.entityData.get(ROTZ) + 0.05f, -0.5f, 0.5f)); + this.entityData.set(MOVE_Z, this.entityData.get(MOVE_Z) + 0.15f); + this.entityData.set(ROT_Z, Mth.clamp(this.entityData.get(ROT_Z) + 0.05f, -0.5f, 0.5f)); } - if (this.entityData.get(ROTZ) > 0) { - this.entityData.set(ROTZ, Mth.clamp(this.entityData.get(ROTZ) - 0.025f, 0, 0.5f)); + if (this.entityData.get(ROT_Z) > 0) { + this.entityData.set(ROT_Z, Mth.clamp(this.entityData.get(ROT_Z) - 0.025f, 0, 0.5f)); } else { - this.entityData.set(ROTZ, Mth.clamp(this.entityData.get(ROTZ) + 0.025f, -0.5f, 0)); + this.entityData.set(ROT_Z, Mth.clamp(this.entityData.get(ROT_Z) + 0.025f, -0.5f, 0)); } - if (this.entityData.get(MOVEZ) >= 0) { - this.entityData.set(MOVEZ,Mth.clamp(this.entityData.get(MOVEZ) - 0.1f, 0, 1)); + if (this.entityData.get(MOVE_Z) >= 0) { + this.entityData.set(MOVE_Z, Mth.clamp(this.entityData.get(MOVE_Z) - 0.1f, 0, 1)); } else { - this.entityData.set(MOVEZ,Mth.clamp(this.entityData.get(MOVEZ) + 0.1f, -1, 0)); + this.entityData.set(MOVE_Z, Mth.clamp(this.entityData.get(MOVE_Z) + 0.1f, -1, 0)); } if (this.getPersistentData().getBoolean("up")) { - this.entityData.set(MOVEY,-1.5f); + this.entityData.set(MOVE_Y, -1.5f); } if (this.getPersistentData().getBoolean("down")) { - this.entityData.set(MOVEY,1.5f); + this.entityData.set(MOVE_Y, 1.5f); } - if (this.entityData.get(MOVEY) >= 0) { - this.entityData.set(MOVEY,Mth.clamp(this.entityData.get(MOVEY) - 0.3f, 0, 1)); + if (this.entityData.get(MOVE_Y) >= 0) { + this.entityData.set(MOVE_Y, Mth.clamp(this.entityData.get(MOVE_Y) - 0.3f, 0, 1)); } else { - this.entityData.set(MOVEY,Mth.clamp(this.entityData.get(MOVEY)+ 0.3f, -1, 0)); + this.entityData.set(MOVE_Y, Mth.clamp(this.entityData.get(MOVE_Y) + 0.3f, -1, 0)); } this.setDeltaMovement(new Vec3( - this.getDeltaMovement().x + -this.entityData.get(MOVEZ) * 0.1f * this.getLookAngle().x, - this.getDeltaMovement().y + -this.entityData.get(MOVEY) * 0.05f, - this.getDeltaMovement().z + -this.entityData.get(MOVEZ) * 0.1f * this.getLookAngle().z + this.getDeltaMovement().x + -this.entityData.get(MOVE_Z) * 0.1f * this.getLookAngle().x, + this.getDeltaMovement().y + -this.entityData.get(MOVE_Y) * 0.05f, + this.getDeltaMovement().z + -this.entityData.get(MOVE_Z) * 0.1f * this.getLookAngle().z )); this.move = this.getPersistentData().getBoolean("left") @@ -282,11 +282,11 @@ public class DroneEntity extends PathfinderMob implements GeoEntity { if (this.getPersistentData().getBoolean("firing")) { if (control instanceof Player player) { if (this.entityData.get(AMMO) > 0) { - this.entityData.set(AMMO,this.entityData.get(AMMO) - 1); + this.entityData.set(AMMO, this.entityData.get(AMMO) - 1); droneDrop(player); } if (this.entityData.get(KAMIKAZE)) { - this.hurt(new DamageSource(level().registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypes.EXPLOSION),player), 10000); + this.hurt(new DamageSource(level().registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypes.EXPLOSION), player), 10000); } } this.getPersistentData().putBoolean("firing", false); @@ -359,7 +359,7 @@ public class DroneEntity extends PathfinderMob implements GeoEntity { stack.shrink(1); } if (this.entityData.get(AMMO) < 6) { - this.entityData.set(AMMO,this.entityData.get(AMMO) + 1); + this.entityData.set(AMMO, this.entityData.get(AMMO) + 1); if (player instanceof ServerPlayer serverPlayer) { serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.BULLET_SUPPLY.get(), SoundSource.PLAYERS, 0.5F, 1); } @@ -368,7 +368,7 @@ public class DroneEntity extends PathfinderMob implements GeoEntity { if (!player.isCreative()) { stack.shrink(1); } - this.entityData.set(KAMIKAZE,true); + this.entityData.set(KAMIKAZE, true); if (player instanceof ServerPlayer serverPlayer) { serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.BULLET_SUPPLY.get(), SoundSource.PLAYERS, 0.5F, 1); } @@ -392,8 +392,8 @@ public class DroneEntity extends PathfinderMob implements GeoEntity { this.yBodyRot = control.getYRot(); this.yHeadRot = control.getYRot(); this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED)); - float strafe = -this.entityData.get(MOVEX); - super.travel(new Vec3(2 * strafe, -this.entityData.get(MOVEY), -this.entityData.get(MOVEZ))); + float strafe = -this.entityData.get(MOVE_X); + super.travel(new Vec3(2 * strafe, -this.entityData.get(MOVE_Y), -this.entityData.get(MOVE_Z))); Vec3 vec3 = this.getDeltaMovement(); if (this.onGround()) { this.setDeltaMovement(vec3.multiply(0.7, 0.98, 0.7)); @@ -432,8 +432,7 @@ public class DroneEntity extends PathfinderMob implements GeoEntity { }); } - - if (this.entityData.get(KAMIKAZE)){ + if (this.entityData.get(KAMIKAZE)) { kamikazeExplosion(source.getEntity()); } @@ -490,7 +489,7 @@ public class DroneEntity extends PathfinderMob implements GeoEntity { return builder; } - private PlayState movementPredicate(AnimationState event) { + private PlayState movementPredicate(AnimationState event) { if (this.animationprocedure.equals("empty")) { if (!this.onGround()) { return event.setAndContinue(RawAnimation.begin().thenLoop("animation.drone.fly")); @@ -500,7 +499,7 @@ public class DroneEntity extends PathfinderMob implements GeoEntity { return PlayState.STOP; } - private PlayState procedurePredicate(AnimationState event) { + private PlayState procedurePredicate(AnimationState event) { if (!animationprocedure.equals("empty") && event.getController().getAnimationState() == AnimationController.State.STOPPED) { event.getController().setAnimation(RawAnimation.begin().thenPlay(this.animationprocedure)); if (event.getController().getAnimationState() == AnimationController.State.STOPPED) { @@ -535,9 +534,10 @@ public class DroneEntity extends PathfinderMob implements GeoEntity { private final ItemStackHandler inventory = new ItemStackHandler(9) { @Override public int getSlotLimit(int slot) { - return 64; + return super.getSlotLimit(slot); } }; + private final CombinedInvWrapper combined = new CombinedInvWrapper(inventory, new EntityHandsInvWrapper(this), new EntityArmorInvWrapper(this)); @Override diff --git a/src/main/java/net/mcreator/superbwarfare/entity/DroneGrenadeEntity.java b/src/main/java/net/mcreator/superbwarfare/entity/DroneGrenadeEntity.java index 11911c244..b085c78c5 100644 --- a/src/main/java/net/mcreator/superbwarfare/entity/DroneGrenadeEntity.java +++ b/src/main/java/net/mcreator/superbwarfare/entity/DroneGrenadeEntity.java @@ -22,7 +22,6 @@ import net.minecraftforge.network.PlayMessages; public class DroneGrenadeEntity extends ThrowableItemProjectile { - public DroneGrenadeEntity(EntityType type, Level world) { super(type, world); } diff --git a/src/main/java/net/mcreator/superbwarfare/entity/model/DroneModel.java b/src/main/java/net/mcreator/superbwarfare/entity/model/DroneModel.java index 58ef9812a..51ec48084 100644 --- a/src/main/java/net/mcreator/superbwarfare/entity/model/DroneModel.java +++ b/src/main/java/net/mcreator/superbwarfare/entity/model/DroneModel.java @@ -6,46 +6,46 @@ import software.bernie.geckolib.core.animation.AnimationState; import software.bernie.geckolib.model.GeoModel; import net.minecraft.resources.ResourceLocation; import net.mcreator.superbwarfare.entity.DroneEntity; + import static net.mcreator.superbwarfare.entity.DroneEntity.*; public class DroneModel extends GeoModel { - @Override - public ResourceLocation getAnimationResource(DroneEntity entity) { - return new ResourceLocation(ModUtils.MODID, "animations/drone.animation.json"); - } + @Override + public ResourceLocation getAnimationResource(DroneEntity entity) { + return new ResourceLocation(ModUtils.MODID, "animations/drone.animation.json"); + } - @Override - public ResourceLocation getModelResource(DroneEntity entity) { - return new ResourceLocation(ModUtils.MODID, "geo/drone.geo.json"); - } + @Override + public ResourceLocation getModelResource(DroneEntity entity) { + return new ResourceLocation(ModUtils.MODID, "geo/drone.geo.json"); + } - @Override - public ResourceLocation getTextureResource(DroneEntity entity) { - return new ResourceLocation(ModUtils.MODID, "textures/entity/drone.png"); - } + @Override + public ResourceLocation getTextureResource(DroneEntity entity) { + return new ResourceLocation(ModUtils.MODID, "textures/entity/drone.png"); + } - @Override - public void setCustomAnimations(DroneEntity animatable, long instanceId, AnimationState animationState) { - CoreGeoBone ammo1 = getAnimationProcessor().getBone("ammo1"); - CoreGeoBone ammo2 = getAnimationProcessor().getBone("ammo2"); - CoreGeoBone ammo3 = getAnimationProcessor().getBone("ammo3"); - CoreGeoBone ammo4 = getAnimationProcessor().getBone("ammo4"); - CoreGeoBone ammo5 = getAnimationProcessor().getBone("ammo5"); - CoreGeoBone ammo6 = getAnimationProcessor().getBone("ammo6"); - CoreGeoBone shell = getAnimationProcessor().getBone("shell"); - CoreGeoBone body = getAnimationProcessor().getBone("0"); + @Override + public void setCustomAnimations(DroneEntity animatable, long instanceId, AnimationState animationState) { + CoreGeoBone ammo1 = getAnimationProcessor().getBone("ammo1"); + CoreGeoBone ammo2 = getAnimationProcessor().getBone("ammo2"); + CoreGeoBone ammo3 = getAnimationProcessor().getBone("ammo3"); + CoreGeoBone ammo4 = getAnimationProcessor().getBone("ammo4"); + CoreGeoBone ammo5 = getAnimationProcessor().getBone("ammo5"); + CoreGeoBone ammo6 = getAnimationProcessor().getBone("ammo6"); + CoreGeoBone shell = getAnimationProcessor().getBone("shell"); + CoreGeoBone body = getAnimationProcessor().getBone("0"); ammo6.setHidden(animatable.getEntityData().get(AMMO) <= 5); - ammo5.setHidden(animatable.getEntityData().get(AMMO) <= 4); - ammo4.setHidden(animatable.getEntityData().get(AMMO) <= 3); - ammo3.setHidden(animatable.getEntityData().get(AMMO) <= 2); - ammo2.setHidden(animatable.getEntityData().get(AMMO) <= 1); - ammo1.setHidden(animatable.getEntityData().get(AMMO) <= 0); + ammo5.setHidden(animatable.getEntityData().get(AMMO) <= 4); + ammo4.setHidden(animatable.getEntityData().get(AMMO) <= 3); + ammo3.setHidden(animatable.getEntityData().get(AMMO) <= 2); + ammo2.setHidden(animatable.getEntityData().get(AMMO) <= 1); + ammo1.setHidden(animatable.getEntityData().get(AMMO) <= 0); shell.setHidden(!animatable.getEntityData().get(KAMIKAZE)); - - body.setRotZ(animatable.getEntityData().get(ROTX)); - body.setRotX(animatable.getEntityData().get(ROTZ)); - } + body.setRotZ(animatable.getEntityData().get(ROT_X)); + body.setRotX(animatable.getEntityData().get(ROT_Z)); + } } diff --git a/src/main/java/net/mcreator/superbwarfare/event/ClientEventHandler.java b/src/main/java/net/mcreator/superbwarfare/event/ClientEventHandler.java index 7df6290fd..062feaf39 100644 --- a/src/main/java/net/mcreator/superbwarfare/event/ClientEventHandler.java +++ b/src/main/java/net/mcreator/superbwarfare/event/ClientEventHandler.java @@ -28,8 +28,8 @@ import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import static net.mcreator.superbwarfare.entity.DroneEntity.ROTX; -import static net.mcreator.superbwarfare.entity.DroneEntity.ROTZ; +import static net.mcreator.superbwarfare.entity.DroneEntity.ROT_X; +import static net.mcreator.superbwarfare.entity.DroneEntity.ROT_Z; @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class ClientEventHandler { @@ -92,16 +92,16 @@ public class ClientEventHandler { if (drone != null) { - if (data.getDouble("droneRotZ") > drone.getEntityData().get(ROTZ)) { - data.putDouble("droneRotZ", Mth.clamp(data.getDouble("droneRotZ") - 0.3 * Math.pow(drone.getEntityData().get(ROTZ) - data.getDouble("droneRotZ"), 2),drone.getEntityData().get(ROTZ),Double.POSITIVE_INFINITY)); + if (data.getDouble("droneRotZ") > drone.getEntityData().get(ROT_Z)) { + data.putDouble("droneRotZ", Mth.clamp(data.getDouble("droneRotZ") - 0.3 * Math.pow(drone.getEntityData().get(ROT_Z) - data.getDouble("droneRotZ"), 2),drone.getEntityData().get(ROT_Z),Double.POSITIVE_INFINITY)); } else { - data.putDouble("droneRotZ", Mth.clamp(data.getDouble("droneRotZ") + 0.3 * Math.pow(drone.getEntityData().get(ROTZ) - data.getDouble("droneRotZ"), 2),Double.NEGATIVE_INFINITY,drone.getEntityData().get(ROTZ))); + data.putDouble("droneRotZ", Mth.clamp(data.getDouble("droneRotZ") + 0.3 * Math.pow(drone.getEntityData().get(ROT_Z) - data.getDouble("droneRotZ"), 2),Double.NEGATIVE_INFINITY,drone.getEntityData().get(ROT_Z))); } - if (data.getDouble("droneRotX") > drone.getEntityData().get(ROTX)) { - data.putDouble("droneRotX", Mth.clamp(data.getDouble("droneRotX") - 0.2 * Math.pow(drone.getEntityData().get(ROTX) - data.getDouble("droneRotX"), 2),drone.getEntityData().get(ROTX),Double.POSITIVE_INFINITY)); + if (data.getDouble("droneRotX") > drone.getEntityData().get(ROT_X)) { + data.putDouble("droneRotX", Mth.clamp(data.getDouble("droneRotX") - 0.2 * Math.pow(drone.getEntityData().get(ROT_X) - data.getDouble("droneRotX"), 2),drone.getEntityData().get(ROT_X),Double.POSITIVE_INFINITY)); } else { - data.putDouble("droneRotX", Mth.clamp(data.getDouble("droneRotX") + 0.2 * Math.pow(drone.getEntityData().get(ROTX) - data.getDouble("droneRotX"), 2),Double.NEGATIVE_INFINITY,drone.getEntityData().get(ROTX))); + data.putDouble("droneRotX", Mth.clamp(data.getDouble("droneRotX") + 0.2 * Math.pow(drone.getEntityData().get(ROT_X) - data.getDouble("droneRotX"), 2),Double.NEGATIVE_INFINITY,drone.getEntityData().get(ROT_X))); } event.setPitch((float) (pitch + data.getDouble("droneCameraRotX") - 0.15f * Mth.RAD_TO_DEG * data.getDouble("droneRotZ")));