diff --git a/src/main/java/info/ata4/minecraft/dragon/DragonMountsConfig.java b/src/main/java/info/ata4/minecraft/dragon/DragonMountsConfig.java index 3a00411d..cbf48bae 100644 --- a/src/main/java/info/ata4/minecraft/dragon/DragonMountsConfig.java +++ b/src/main/java/info/ata4/minecraft/dragon/DragonMountsConfig.java @@ -23,9 +23,9 @@ public class DragonMountsConfig { private boolean debug = false; public DragonMountsConfig(Configuration config) { - eggsInChests = config.getBoolean("eggsInChests", "server", eggsInChests, "Spawns dragon eggs in generated chests when enabled"); - dragonEntityID = config.getInt("dragonEntityID", "server", dragonEntityID, -1, 255, "Overrides the entity ID for dragons to fix problems with manual IDs from other mods.\nSet to -1 for automatic assignment (recommended).\nWarning: wrong values may cause crashes and loss of data!"); - debug = config.getBoolean("debug", "client", debug, "Debug mode. Unless you're a developer or are told to activate it, you don't want to set this to true."); + eggsInChests = config.get("server", "eggsInChests", eggsInChests, "Spawns dragon eggs in generated chests when enabled").getBoolean(eggsInChests); + dragonEntityID = config.get("server", "dragonEntityID", dragonEntityID, "Overrides the entity ID for dragons to fix problems with manual IDs from other mods.\nSet to -1 for automatic assignment (recommended).\nWarning: wrong values may cause crashes and loss of data!").getInt(dragonEntityID); + debug = config.get("client", "debug", debug, "Debug mode. Unless you're a developer or are told to activate it, you don't want to set this to true.").getBoolean(debug); if (config.hasChanged()) { config.save(); diff --git a/src/main/java/info/ata4/minecraft/dragon/client/gui/GuiDragonDebug.java b/src/main/java/info/ata4/minecraft/dragon/client/gui/GuiDragonDebug.java index 1006da40..9e09d28f 100644 --- a/src/main/java/info/ata4/minecraft/dragon/client/gui/GuiDragonDebug.java +++ b/src/main/java/info/ata4/minecraft/dragon/client/gui/GuiDragonDebug.java @@ -32,7 +32,6 @@ import net.minecraft.entity.DataWatcher; import net.minecraft.entity.DataWatcher.WatchableObject; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.EntityAITasks; import net.minecraft.entity.ai.EntityAITasks.EntityAITaskEntry; import net.minecraft.entity.ai.attributes.IAttributeInstance; @@ -234,17 +233,11 @@ private void renderEntityInfo() { text.printf("Size: %s (w:%s h:%s)\n", scale, width, height); // tamed flag/owner name - //String tamedString = dragon.getOwnerName(); - String tamedString; - if (dragon.isTamed()) { - EntityLivingBase player = dragon.getOwner(); - if (player != null) { - tamedString = "yes (" + player.getCommandSenderName() + ")"; - } else { - tamedString = "yes (" + StringUtils.abbreviate(dragon.func_152113_b(), 22) + ")"; - } - } else { + String tamedString = dragon.getOwnerName(); + if (tamedString.isEmpty()) { tamedString = "no"; + } else { + tamedString = "yes (" + tamedString + ")"; } text.println("Tamed: " + tamedString); diff --git a/src/main/java/info/ata4/minecraft/dragon/server/entity/EntityTameableDragon.java b/src/main/java/info/ata4/minecraft/dragon/server/entity/EntityTameableDragon.java index 19e2d934..b1b92987 100644 --- a/src/main/java/info/ata4/minecraft/dragon/server/entity/EntityTameableDragon.java +++ b/src/main/java/info/ata4/minecraft/dragon/server/entity/EntityTameableDragon.java @@ -451,8 +451,7 @@ public boolean interact(EntityPlayer player) { return true; } - //if (!isOwner(player)) { - if (!func_152114_e(player)) { + if (!isOwner(player)) { if (isServer()) { // that's not your dragon! player.addChatMessage(new ChatComponentTranslation("dragon.owned")); @@ -503,8 +502,7 @@ public void tamedFor(EntityPlayer player, boolean successful) { setTamed(true); setPathToEntity(null); setAttackTarget(null); - //setOwner(player.getCommandSenderName()); - func_152115_b(player.getUniqueID().toString()); + setOwner(player.getCommandSenderName()); playTameEffect(true); worldObj.setEntityState(this, (byte) 7); } else { @@ -537,11 +535,11 @@ public boolean isBreedingItem(ItemStack item) { @Override public float getEyeHeight() { float eyeHeight = super.getEyeHeight(); - + if (isSitting()) { eyeHeight *= 0.8f; } - + return eyeHeight; } @@ -770,6 +768,14 @@ public DragonBreed getBreed() { public void setBreed(DragonBreed breed) { getBreedHelper().setBreed(breed); } + + public boolean isOwner(EntityPlayer player) { + return player.getCommandSenderName().equalsIgnoreCase(getOwnerName()); + } + + public boolean isRiddenByOwner() { + return riddenByEntity == getOwner(); + } public EntityPlayer getRidingPlayer() { if (riddenByEntity instanceof EntityPlayer) { @@ -843,7 +849,7 @@ public boolean isInvulnerableTo(DamageSource src) { return getBreed().isImmuneToDamage(src); } - + /** * Returns the entity's health relative to the maximum health. *