Revert "Add explicit casting to fix problems with the remapper not working properly."

This reverts commit 20b41b08bc.
This commit is contained in:
David Berdik 2022-03-07 15:05:17 -05:00
parent f556f44dbf
commit 0f066fa654
3 changed files with 19 additions and 22 deletions

View File

@ -2,7 +2,6 @@ package net.theprogrammersworld.herobrine.NPC.Entity;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.theprogrammersworld.herobrine.Herobrine; import net.theprogrammersworld.herobrine.Herobrine;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -54,7 +53,7 @@ public class HumanNPC {
} }
public void setPitch(float pitch) { public void setPitch(float pitch) {
((Entity) getEntity()).setXRot(pitch); ((HumanEntity) getEntity()).setXRot(pitch);
} }
public void moveTo(Location loc) { public void moveTo(Location loc) {
@ -87,7 +86,7 @@ public class HumanNPC {
} }
public void setYaw(float yaw) { public void setYaw(float yaw) {
((Entity) getEntity()).setYRot(yaw); ((ServerPlayer) getEntity()).setYRot(yaw);
} }
public void lookAtPoint(Location point) { public void lookAtPoint(Location point) {
@ -111,15 +110,15 @@ public class HumanNPC {
} }
if (newYaw > 0.0D || newYaw < 180.0D) { if (newYaw > 0.0D || newYaw < 180.0D) {
((Entity) entity).setXRot((float) newPitch); entity.setXRot((float) newPitch);
((Entity) entity).setYRot((float) (newYaw - 90.0)); entity.setYRot((float) (newYaw - 90.0));
entity.getBukkitEntity().setFlySpeed((float) (newYaw - 90.0) / 360); entity.getBukkitEntity().setFlySpeed((float) (newYaw - 90.0) / 360);
} }
} }
public void setYawA(float yaw) { public void setYawA(float yaw) {
((Entity) getEntity()).setYRot(yaw); ((ServerPlayer) getEntity()).setYRot(yaw);
} }
public org.bukkit.entity.Entity getBukkitEntity() { public org.bukkit.entity.Entity getBukkitEntity() {

View File

@ -12,7 +12,6 @@ import org.bukkit.Color;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.theprogrammersworld.herobrine.Herobrine; import net.theprogrammersworld.herobrine.Herobrine;
@ -36,10 +35,10 @@ public class CustomSkeleton extends net.minecraft.world.entity.monster.Skeleton
public void spawnDemon(Location loc) { public void spawnDemon(Location loc) {
((LivingEntity) this).getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Herobrine.getPluginCore().getConfigDB().npc.getDouble("npc.Demon.Speed")); 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")); 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")); this.setHealth(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Demon.HP"));
((Entity) this).setCustomName(new TextComponent("Demon")); this.setCustomName(new TextComponent("Demon"));
Skeleton entityCast = (Skeleton) this.getBukkitEntity(); 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"))); .getInt("npc.Demon.Drops." + item + ".Count")));
} }
} }
((LivingEntity) this).setHealth(0.0f); setHealth(0.0f);
} }
@Override @Override

View File

@ -10,7 +10,6 @@ import org.bukkit.inventory.ItemStack;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.theprogrammersworld.herobrine.Herobrine; 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) { private void spawnArtifactGuardian(Location loc) {
((LivingEntity) this).getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Herobrine.getPluginCore().getConfigDB().npc.getDouble("npc.Guardian.Speed")); 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")); 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.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(); 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) { private void spawnHerobrineWarrior(Location loc) {
((LivingEntity) this).getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Herobrine.getPluginCore().getConfigDB().npc.getDouble("npc.Warrior.Speed")); 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")); 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.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(); 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"))); .getInt("npc." + mobS + ".Drops." + item + ".Count")));
} }
} }
((LivingEntity) this).setHealth(0.0f); setHealth(0.0f);
} }
public MobType getHerobrineMobType() { public MobType getHerobrineMobType() {