From 0f066fa65432bb3bb18b2a34e8b4d9b523a007cd Mon Sep 17 00:00:00 2001 From: David Berdik Date: Mon, 7 Mar 2022 15:05:17 -0500 Subject: [PATCH] Revert "Add explicit casting to fix problems with the remapper not working properly." This reverts commit 20b41b08bce0ae9dc987cebd042967ef41e08951. --- .../herobrine/NPC/Entity/HumanNPC.java | 11 +++++------ .../herobrine/entity/CustomSkeleton.java | 11 +++++------ .../herobrine/entity/CustomZombie.java | 19 +++++++++---------- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/main/java/net/theprogrammersworld/herobrine/NPC/Entity/HumanNPC.java b/src/main/java/net/theprogrammersworld/herobrine/NPC/Entity/HumanNPC.java index 42d9728..29ab703 100644 --- a/src/main/java/net/theprogrammersworld/herobrine/NPC/Entity/HumanNPC.java +++ b/src/main/java/net/theprogrammersworld/herobrine/NPC/Entity/HumanNPC.java @@ -2,7 +2,6 @@ package net.theprogrammersworld.herobrine.NPC.Entity; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; -import net.minecraft.world.entity.Entity; import net.theprogrammersworld.herobrine.Herobrine; import org.bukkit.Bukkit; @@ -54,7 +53,7 @@ public class HumanNPC { } public void setPitch(float pitch) { - ((Entity) getEntity()).setXRot(pitch); + ((HumanEntity) getEntity()).setXRot(pitch); } public void moveTo(Location loc) { @@ -87,7 +86,7 @@ public class HumanNPC { } public void setYaw(float yaw) { - ((Entity) getEntity()).setYRot(yaw); + ((ServerPlayer) getEntity()).setYRot(yaw); } public void lookAtPoint(Location point) { @@ -111,15 +110,15 @@ public class HumanNPC { } if (newYaw > 0.0D || newYaw < 180.0D) { - ((Entity) entity).setXRot((float) newPitch); - ((Entity) entity).setYRot((float) (newYaw - 90.0)); + entity.setXRot((float) newPitch); + entity.setYRot((float) (newYaw - 90.0)); entity.getBukkitEntity().setFlySpeed((float) (newYaw - 90.0) / 360); } } public void setYawA(float yaw) { - ((Entity) getEntity()).setYRot(yaw); + ((ServerPlayer) getEntity()).setYRot(yaw); } public org.bukkit.entity.Entity getBukkitEntity() { diff --git a/src/main/java/net/theprogrammersworld/herobrine/entity/CustomSkeleton.java b/src/main/java/net/theprogrammersworld/herobrine/entity/CustomSkeleton.java index 639fe2d..dff9b2f 100644 --- a/src/main/java/net/theprogrammersworld/herobrine/entity/CustomSkeleton.java +++ b/src/main/java/net/theprogrammersworld/herobrine/entity/CustomSkeleton.java @@ -12,7 +12,6 @@ import org.bukkit.Color; import net.minecraft.network.chat.TextComponent; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.level.Level; import net.theprogrammersworld.herobrine.Herobrine; @@ -36,10 +35,10 @@ public class CustomSkeleton extends net.minecraft.world.entity.monster.Skeleton public void spawnDemon(Location loc) { - ((LivingEntity) this).getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Herobrine.getPluginCore().getConfigDB().npc.getDouble("npc.Demon.Speed")); - ((LivingEntity) this).getAttribute(Attributes.MAX_HEALTH).setBaseValue(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Demon.HP")); - ((LivingEntity) this).setHealth(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Demon.HP")); - ((Entity) this).setCustomName(new TextComponent("Demon")); + this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Herobrine.getPluginCore().getConfigDB().npc.getDouble("npc.Demon.Speed")); + this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Demon.HP")); + this.setHealth(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Demon.HP")); + this.setCustomName(new TextComponent("Demon")); Skeleton entityCast = (Skeleton) this.getBukkitEntity(); @@ -69,7 +68,7 @@ public class CustomSkeleton extends net.minecraft.world.entity.monster.Skeleton .getInt("npc.Demon.Drops." + item + ".Count"))); } } - ((LivingEntity) this).setHealth(0.0f); + setHealth(0.0f); } @Override diff --git a/src/main/java/net/theprogrammersworld/herobrine/entity/CustomZombie.java b/src/main/java/net/theprogrammersworld/herobrine/entity/CustomZombie.java index 7abec40..c07839b 100644 --- a/src/main/java/net/theprogrammersworld/herobrine/entity/CustomZombie.java +++ b/src/main/java/net/theprogrammersworld/herobrine/entity/CustomZombie.java @@ -10,7 +10,6 @@ import org.bukkit.inventory.ItemStack; import net.minecraft.network.chat.TextComponent; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.level.Level; import net.theprogrammersworld.herobrine.Herobrine; @@ -35,11 +34,11 @@ public class CustomZombie extends net.minecraft.world.entity.monster.Zombie impl private void spawnArtifactGuardian(Location loc) { - ((LivingEntity) this).getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Herobrine.getPluginCore().getConfigDB().npc.getDouble("npc.Guardian.Speed")); - ((LivingEntity) this).getAttribute(Attributes.MAX_HEALTH).setBaseValue(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.HP")); - ((LivingEntity) this).setHealth(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.HP")); + this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Herobrine.getPluginCore().getConfigDB().npc.getDouble("npc.Guardian.Speed")); + this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.HP")); + this.setHealth(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.HP")); - ((Entity) this).setCustomName(new TextComponent("Artifact Guardian")); + this.setCustomName(new TextComponent("Artifact Guardian")); Zombie entityCast = (Zombie) this.getBukkitEntity(); @@ -55,11 +54,11 @@ public class CustomZombie extends net.minecraft.world.entity.monster.Zombie impl private void spawnHerobrineWarrior(Location loc) { - ((LivingEntity) this).getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Herobrine.getPluginCore().getConfigDB().npc.getDouble("npc.Warrior.Speed")); - ((LivingEntity) this).getAttribute(Attributes.MAX_HEALTH).setBaseValue(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.HP")); - ((LivingEntity) this).setHealth(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.HP")); + this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Herobrine.getPluginCore().getConfigDB().npc.getDouble("npc.Warrior.Speed")); + this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.HP")); + this.setHealth(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.HP")); - ((Entity) this).setCustomName(new TextComponent("Herobrine Warrior")); + this.setCustomName(new TextComponent("Herobrine Warrior")); Zombie entityCast = (Zombie) this.getBukkitEntity(); @@ -97,7 +96,7 @@ public class CustomZombie extends net.minecraft.world.entity.monster.Zombie impl .getInt("npc." + mobS + ".Drops." + item + ".Count"))); } } - ((LivingEntity) this).setHealth(0.0f); + setHealth(0.0f); } public MobType getHerobrineMobType() {