diff --git a/.gitignore b/.gitignore
index fdc4c03e..2599faa0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,7 @@ out
*.iws
*.iml
.idea
+classes/
# gradle
build
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 45b40db4..dfbf2fdc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,9 +1,21 @@
# Metamorph Change Log
+## Metamorph 1.1.10
+
+This is a small patch update with a couple of bug fixes (mainly by asanetargoss).
+
+**Compatible** with McLib `1.0.4`. It doesn't mean that future versions of McLib would be incompatible, but older versions are most likely incompatible.
+
+* Fixed acquired morphs getting overwritten by canMerge
+* Fixed crash when `null` sound proceeds in `SoundHandler` (fixed by asanetargoss)
+* Fixed wrong air HUD when demorphed from air breathing mob (fixed by asanetargoss)
+
## Metamorph 1.1.9
This is a small patch update with lots of awesome bug fixes pull requests from asanetargoss and Johni0702!
+**Compatible** with McLib `1.0.3`. It doesn't mean that future versions of McLib would be incompatible, but older versions are most likely incompatible.
+
* Fixed increasing health when morphing with modifier, and other cases. Fixed by **asanetargoss**
* Fixed small morphs suffocating in ceiling. Fixed by **asanetargoss**
* Fixed player having multiple chicken morphs. Fixed by **asanetargoss**
diff --git a/gradle.properties b/gradle.properties
index 6c2ec46a..6ad711a0 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,6 +1,6 @@
# Metamorph gradle properties
-mclib=1.0.2
-version=1.1.10
+mclib=1.0.4
+version=1.2
mc_version=1.10.2
forge_version=12.18.3.2511
diff --git a/src/main/java/mchorse/metamorph/api/Morph.java b/src/main/java/mchorse/metamorph/api/Morph.java
index ded317c6..0ce0ea4d 100644
--- a/src/main/java/mchorse/metamorph/api/Morph.java
+++ b/src/main/java/mchorse/metamorph/api/Morph.java
@@ -22,6 +22,11 @@ public Morph(AbstractMorph morph)
this.morph = morph;
}
+ public boolean isEmpty()
+ {
+ return this.morph == null;
+ }
+
public boolean set(AbstractMorph morph, boolean isRemote)
{
if (this.morph == null || !this.morph.canMerge(morph, isRemote))
diff --git a/src/main/java/mchorse/metamorph/api/morphs/AbstractMorph.java b/src/main/java/mchorse/metamorph/api/morphs/AbstractMorph.java
index f46b707a..4260367d 100644
--- a/src/main/java/mchorse/metamorph/api/morphs/AbstractMorph.java
+++ b/src/main/java/mchorse/metamorph/api/morphs/AbstractMorph.java
@@ -30,13 +30,6 @@
*/
public abstract class AbstractMorph
{
- /* Abilities */
-
- /**
- * Morph settings
- */
- public MorphSettings settings = MorphSettings.DEFAULT;
-
/* Meta information */
/**
@@ -49,10 +42,12 @@ public abstract class AbstractMorph
*/
public boolean favorite = false;
+ /* Abilities */
+
/**
- * Health when the player morphed into this morph
+ * Morph settings
*/
- protected float lastHealth;
+ public MorphSettings settings = MorphSettings.DEFAULT;
/* Rendering */
@@ -63,6 +58,15 @@ public abstract class AbstractMorph
@SideOnly(Side.CLIENT)
public Render extends Entity> renderer;
+ /* Clone code */
+
+ public static void copyBase(AbstractMorph from, AbstractMorph to)
+ {
+ to.name = from.name;
+ to.favorite = from.favorite;
+ to.settings = from.settings;
+ }
+
/* Render methods */
/**
@@ -94,11 +98,6 @@ public boolean renderHand(EntityPlayer player, EnumHand hand)
*/
public void update(EntityLivingBase target, IMorphing cap)
{
- if (!Metamorph.proxy.config.disable_health)
- {
- this.setMaxHealth(target, this.settings.health);
- }
-
if (this.settings.speed != 0.1F)
{
target.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(this.settings.speed);
@@ -120,9 +119,6 @@ public void update(EntityLivingBase target, IMorphing cap)
*/
public void morph(EntityLivingBase target)
{
- this.lastHealth = (float)target.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).getBaseValue();
- this.setHealth(target, this.settings.health);
-
for (IAbility ability : this.settings.abilities)
{
ability.onMorph(target);
@@ -137,9 +133,6 @@ public void morph(EntityLivingBase target)
*/
public void demorph(EntityLivingBase target)
{
- /* 20 is default player's health */
- this.setHealth(target, this.lastHealth <= 0.0F ? 20.0F : this.lastHealth);
-
for (IAbility ability : this.settings.abilities)
{
ability.onDemorph(target);
@@ -190,68 +183,6 @@ public static void updateSizeDefault(EntityLivingBase target, float width, float
}
}
- /* Adjusting health */
-
- /**
- * Set player's health proportional to the current health with given max
- * health.
- *
- * @author asanetargoss
- */
- protected void setHealth(EntityLivingBase target, float health)
- {
- if (Metamorph.proxy.config.disable_health)
- {
- return;
- }
-
- float maxHealth = target.getMaxHealth();
- float currentHealth = target.getHealth();
- float ratio = currentHealth / maxHealth;
-
- // A sanity check to prevent "healing" health when morphing to and from
- // a mob
- // with essentially zero health
- if (target instanceof EntityPlayer)
- {
- IMorphing capability = Morphing.get((EntityPlayer) target);
- if (capability != null)
- {
- // Check if a health ratio makes sense for the old health value
- if (maxHealth > IMorphing.REASONABLE_HEALTH_VALUE)
- {
- // If it makes sense, store that ratio in the capability
- capability.setLastHealthRatio(ratio);
- }
- else if (health > IMorphing.REASONABLE_HEALTH_VALUE)
- {
- // If it doesn't make sense, BUT the new max health makes
- // sense, retrieve the
- // ratio from the capability and use that instead
- ratio = capability.getLastHealthRatio();
- }
- }
- }
-
- this.setMaxHealth(target, health);
- // We need to retrieve the max health of the target after modifiers are
- // applied
- // to get a sensible value
- float proportionalHealth = target.getMaxHealth() * ratio;
- target.setHealth(proportionalHealth <= 0.0F ? Float.MIN_VALUE : proportionalHealth);
- }
-
- /**
- * Set player's max health
- */
- protected void setMaxHealth(EntityLivingBase target, float health)
- {
- if (target.getMaxHealth() != health)
- {
- target.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(health);
- }
- }
-
/* Safe shortcuts for activating action and attack */
/**
@@ -281,9 +212,7 @@ public void attack(Entity target, EntityLivingBase source)
*
*
* IMPORTANT: when you subclass other morphs, don't forget to override
- * their method with your own, because otherwise its going to create
- * another {@link CustomMorph} instance, for example, instead of
- * MyCustomMorph instance.
+ * their method with your own.
*
*/
public abstract AbstractMorph clone(boolean isRemote);
@@ -404,7 +333,6 @@ public void reset()
public void toNBT(NBTTagCompound tag)
{
tag.setString("Name", this.name);
- tag.setFloat("LastHealth", this.lastHealth);
if (this.favorite) tag.setBoolean("Favorite", this.favorite);
}
@@ -417,7 +345,6 @@ public void fromNBT(NBTTagCompound tag)
this.reset();
this.name = tag.getString("Name");
- this.lastHealth = tag.getFloat("LastHealth");
if (tag.hasKey("Favorite")) this.favorite = tag.getBoolean("Favorite");
}
diff --git a/src/main/java/mchorse/metamorph/api/morphs/EntityMorph.java b/src/main/java/mchorse/metamorph/api/morphs/EntityMorph.java
index 38f511e0..64c8fab3 100644
--- a/src/main/java/mchorse/metamorph/api/morphs/EntityMorph.java
+++ b/src/main/java/mchorse/metamorph/api/morphs/EntityMorph.java
@@ -750,8 +750,7 @@ public AbstractMorph clone(boolean isRemote)
{
EntityMorph morph = new EntityMorph();
- morph.name = this.name;
- morph.settings = this.settings;
+ AbstractMorph.copyBase(this, morph);
morph.entityData = this.entityData.copy();
return morph;
diff --git a/src/main/java/mchorse/metamorph/bodypart/BodyPart.java b/src/main/java/mchorse/metamorph/bodypart/BodyPart.java
index 2b7a2530..acbcc16d 100644
--- a/src/main/java/mchorse/metamorph/bodypart/BodyPart.java
+++ b/src/main/java/mchorse/metamorph/bodypart/BodyPart.java
@@ -28,7 +28,6 @@ public void render(EntityLivingBase entity, float partialTicks)
}
@Override
- @SideOnly(Side.CLIENT)
public void update(EntityLivingBase entity, IMorphing cap)
{
if (this.part != null) this.part.update(entity, cap);
diff --git a/src/main/java/mchorse/metamorph/bodypart/BodyPartManager.java b/src/main/java/mchorse/metamorph/bodypart/BodyPartManager.java
index cd9e3f52..1c0eb2e1 100644
--- a/src/main/java/mchorse/metamorph/bodypart/BodyPartManager.java
+++ b/src/main/java/mchorse/metamorph/bodypart/BodyPartManager.java
@@ -63,7 +63,6 @@ public void initBodyParts()
/**
* Update body limbs
*/
- @SideOnly(Side.CLIENT)
public void updateBodyLimbs(EntityLivingBase target, IMorphing cap)
{
for (BodyPart part : this.parts)
diff --git a/src/main/java/mchorse/metamorph/bodypart/GuiBodyPartEditor.java b/src/main/java/mchorse/metamorph/bodypart/GuiBodyPartEditor.java
index 3c086de7..f7825322 100644
--- a/src/main/java/mchorse/metamorph/bodypart/GuiBodyPartEditor.java
+++ b/src/main/java/mchorse/metamorph/bodypart/GuiBodyPartEditor.java
@@ -35,33 +35,33 @@
@SideOnly(Side.CLIENT)
public class GuiBodyPartEditor extends GuiMorphPanel implements IInventoryPicker
{
- private GuiBodyPartListElement bodyParts;
- private GuiButtonElement pickMorph;
- private GuiButtonElement useTarget;
- private GuiCreativeMorphs morphPicker;
-
- private GuiButtonElement addPart;
- private GuiButtonElement removePart;
-
- private GuiTrackpadElement tx;
- private GuiTrackpadElement ty;
- private GuiTrackpadElement tz;
- private GuiTrackpadElement sx;
- private GuiTrackpadElement sy;
- private GuiTrackpadElement sz;
- private GuiTrackpadElement rx;
- private GuiTrackpadElement ry;
- private GuiTrackpadElement rz;
-
- private GuiStringListElement limbs;
- private GuiElements elements = new GuiElements();
-
- private BodyPartManager parts;
- private BodyPart part;
-
- private GuiInventory inventory;
- private GuiSlot[] slots = new GuiSlot[6];
- private GuiSlot active;
+ protected GuiBodyPartListElement bodyParts;
+ protected GuiButtonElement pickMorph;
+ protected GuiButtonElement useTarget;
+ protected GuiCreativeMorphs morphPicker;
+
+ protected GuiButtonElement addPart;
+ protected GuiButtonElement removePart;
+
+ protected GuiTrackpadElement tx;
+ protected GuiTrackpadElement ty;
+ protected GuiTrackpadElement tz;
+ protected GuiTrackpadElement sx;
+ protected GuiTrackpadElement sy;
+ protected GuiTrackpadElement sz;
+ protected GuiTrackpadElement rx;
+ protected GuiTrackpadElement ry;
+ protected GuiTrackpadElement rz;
+
+ protected GuiStringListElement limbs;
+ protected GuiElements elements = new GuiElements();
+
+ protected BodyPartManager parts;
+ protected BodyPart part;
+
+ protected GuiInventory inventory;
+ protected GuiSlot[] slots = new GuiSlot[6];
+ protected GuiSlot active;
public GuiBodyPartEditor(Minecraft mc, GuiAbstractMorph editor)
{
diff --git a/src/main/java/mchorse/metamorph/bodypart/IBodyPart.java b/src/main/java/mchorse/metamorph/bodypart/IBodyPart.java
index 6e95f5a7..b4bf8def 100644
--- a/src/main/java/mchorse/metamorph/bodypart/IBodyPart.java
+++ b/src/main/java/mchorse/metamorph/bodypart/IBodyPart.java
@@ -17,7 +17,6 @@ public interface IBodyPart
@SideOnly(Side.CLIENT)
public void render(EntityLivingBase entity, float partialTicks);
- @SideOnly(Side.CLIENT)
public void update(EntityLivingBase entity, IMorphing cap);
public boolean canMerge(IBodyPart part, boolean isRemote);
diff --git a/src/main/java/mchorse/metamorph/bodypart/MorphBodyPart.java b/src/main/java/mchorse/metamorph/bodypart/MorphBodyPart.java
index b75cc260..7c770973 100644
--- a/src/main/java/mchorse/metamorph/bodypart/MorphBodyPart.java
+++ b/src/main/java/mchorse/metamorph/bodypart/MorphBodyPart.java
@@ -28,7 +28,6 @@ public class MorphBodyPart implements IBodyPart
public float[] rotate = new float[] {180F, 0F, 0F};
public boolean useTarget = false;
- @SideOnly(Side.CLIENT)
private EntityLivingBase entity;
@Override
@@ -97,7 +96,6 @@ public void render(EntityLivingBase entity, float partialTicks)
}
@Override
- @SideOnly(Side.CLIENT)
public void update(EntityLivingBase entity, IMorphing cap)
{
entity = this.useTarget ? entity : this.entity;
diff --git a/src/main/java/mchorse/metamorph/capabilities/morphing/IMorphing.java b/src/main/java/mchorse/metamorph/capabilities/morphing/IMorphing.java
index 0666208f..a378a95d 100644
--- a/src/main/java/mchorse/metamorph/capabilities/morphing/IMorphing.java
+++ b/src/main/java/mchorse/metamorph/capabilities/morphing/IMorphing.java
@@ -142,6 +142,16 @@ public interface IMorphing
*/
public void setSquidAir(int squidAir);
+ /**
+ * Get last health
+ */
+ public float getLastHealth();
+
+ /**
+ * Set last health
+ */
+ public void setLastHealth(float lastHealth);
+
/**
* Update the player
*/
diff --git a/src/main/java/mchorse/metamorph/capabilities/morphing/Morphing.java b/src/main/java/mchorse/metamorph/capabilities/morphing/Morphing.java
index 0827157d..378e38ec 100644
--- a/src/main/java/mchorse/metamorph/capabilities/morphing/Morphing.java
+++ b/src/main/java/mchorse/metamorph/capabilities/morphing/Morphing.java
@@ -4,10 +4,13 @@
import java.util.List;
import mchorse.metamorph.Metamorph;
+import mchorse.metamorph.api.Morph;
import mchorse.metamorph.api.MorphManager;
import mchorse.metamorph.api.morphs.AbstractMorph;
import mchorse.metamorph.client.gui.elements.GuiSurvivalMorphs;
import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.nbt.NBTTagCompound;
@@ -33,7 +36,7 @@ public class Morphing implements IMorphing
/**
* Current used morph
*/
- private AbstractMorph morph;
+ private Morph morph = new Morph();
/**
* Used for animation
@@ -68,6 +71,11 @@ public class Morphing implements IMorphing
*/
private int squidAir = 300;
+ /**
+ * Last health that player had before morphing, should fix issue that people complain about
+ */
+ private float lastHealth;
+
/**
* GUI menu which is responsible for choosing morphs
*/
@@ -122,19 +130,19 @@ public AbstractMorph getPreviousMorph()
@SideOnly(Side.CLIENT)
public boolean renderPlayer(EntityPlayer player, double x, double y, double z, float yaw, float partialTick)
{
- if (this.morph == null && !this.isAnimating())
+ if (this.morph.isEmpty() && !this.isAnimating())
{
return false;
}
- if (this.morph == null && this.animation <= 10 || this.previousMorph == null && this.animation > 10)
+ if (this.morph.isEmpty() && this.animation <= 10 || this.previousMorph == null && this.animation > 10)
{
return false;
}
if (!this.isAnimating())
{
- this.morph.render(player, x, y, z, yaw, partialTick);
+ this.morph.get().render(player, x, y, z, yaw, partialTick);
return true;
}
@@ -160,7 +168,7 @@ public boolean renderPlayer(EntityPlayer player, double x, double y, double z, f
GlStateManager.scale(1 - anim, 1 - anim, 1 - anim);
}
- this.morph.render(player, 0, 0, 0, yaw, partialTick);
+ this.morph.get().render(player, 0, 0, 0, yaw, partialTick);
}
else if (this.previousMorph != null)
{
@@ -254,7 +262,7 @@ public void setAcquiredMorphs(List morphs)
@Override
public AbstractMorph getCurrentMorph()
{
- return this.morph;
+ return this.morph.get();
}
@Override
@@ -271,16 +279,26 @@ public boolean setCurrentMorph(AbstractMorph morph, EntityPlayer player, boolean
if (force || creative || this.acquiredMorph(morph))
{
- if (player != null && this.morph != null)
+ if (player != null)
{
- this.morph.demorph(player);
+ if (this.morph.isEmpty())
+ {
+ this.lastHealth = (float) player.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).getBaseValue();
+ }
+ else
+ {
+ this.morph.get().demorph(player);
+ }
}
this.setMorph(morph, player == null ? false : player.worldObj.isRemote);
- if (player != null)
+ if (player != null && !this.morph.isEmpty())
{
- this.morph.morph(player);
+ AbstractMorph current = this.morph.get();
+
+ this.setHealth(player, current.settings.health);
+ current.morph(player);
}
return true;
@@ -292,9 +310,15 @@ public boolean setCurrentMorph(AbstractMorph morph, EntityPlayer player, boolean
@Override
public void demorph(EntityPlayer player)
{
- if (player != null && this.morph != null)
+ if (player != null && !this.morph.isEmpty())
{
- this.morph.demorph(player);
+ this.morph.get().demorph(player);
+ }
+
+ if (player != null)
+ {
+ /* 20 is default player's health */
+ this.setHealth(player, this.lastHealth <= 0.0F ? 20.0F : this.lastHealth);
}
this.setMorph(null, player == null ? false : player.worldObj.isRemote);
@@ -305,22 +329,23 @@ public void demorph(EntityPlayer player)
*/
protected void setMorph(AbstractMorph morph, boolean isRemote)
{
- if (this.morph == null || (this.morph != null && !this.morph.canMerge(morph, isRemote)))
+ AbstractMorph previous = this.morph.get();
+
+ if (this.morph.set(morph, isRemote))
{
if (!Metamorph.proxy.config.disable_morph_animation)
{
this.animation = 20;
}
- this.previousMorph = this.morph;
- this.morph = morph;
+ this.previousMorph = previous;
}
}
@Override
public boolean isMorphed()
{
- return this.morph != null;
+ return !this.morph.isEmpty();
}
@Override
@@ -363,11 +388,10 @@ public boolean remove(int index)
public void copy(IMorphing morphing, EntityPlayer player)
{
this.acquiredMorphs.addAll(morphing.getAcquiredMorphs());
+
if (morphing.getCurrentMorph() != null)
{
- NBTTagCompound morphNBT = new NBTTagCompound();
- morphing.getCurrentMorph().toNBT(morphNBT);
- this.setCurrentMorph(MorphManager.INSTANCE.morphFromNBT(morphNBT), player, true);
+ this.setCurrentMorph(morphing.getCurrentMorph().clone(player.worldObj.isRemote), player, true);
}
else
{
@@ -411,6 +435,18 @@ public void setSquidAir(int squidAir)
this.squidAir = squidAir;
}
+ @Override
+ public float getLastHealth()
+ {
+ return this.lastHealth;
+ }
+
+ @Override
+ public void setLastHealth(float lastHealth)
+ {
+ this.lastHealth = lastHealth;
+ }
+
@Override
public void update(EntityPlayer player)
{
@@ -427,21 +463,89 @@ public void update(EntityPlayer player)
player.playSound(SoundEvents.ENTITY_ITEM_PICKUP, 1.0F, 1.0F);
}
- if (this.morph != null)
+ if (!this.morph.isEmpty())
+ {
+ AbstractMorph morph = this.morph.get();
+
+ if (!Metamorph.proxy.config.disable_health)
+ {
+ this.setMaxHealth(player, morph.settings.health);
+ }
+
+ morph.update(player, this);
+ }
+ }
+
+ /* Adjusting health */
+
+ /**
+ * Set player's health proportional to the current health with given max
+ * health.
+ *
+ * @author asanetargoss
+ */
+ protected void setHealth(EntityLivingBase target, float health)
+ {
+ if (Metamorph.proxy.config.disable_health)
+ {
+ return;
+ }
+
+ float maxHealth = target.getMaxHealth();
+ float currentHealth = target.getHealth();
+ float ratio = currentHealth / maxHealth;
+
+ // A sanity check to prevent "healing" health when morphing to and from
+ // a mob with essentially zero health
+ if (target instanceof EntityPlayer)
+ {
+ IMorphing capability = Morphing.get((EntityPlayer) target);
+ if (capability != null)
+ {
+ // Check if a health ratio makes sense for the old health value
+ if (maxHealth > IMorphing.REASONABLE_HEALTH_VALUE)
+ {
+ // If it makes sense, store that ratio in the capability
+ capability.setLastHealthRatio(ratio);
+ }
+ else if (health > IMorphing.REASONABLE_HEALTH_VALUE)
+ {
+ // If it doesn't make sense, BUT the new max health makes
+ // sense, retrieve the ratio from the capability and use that instead
+ ratio = capability.getLastHealthRatio();
+ }
+ }
+ }
+
+ this.setMaxHealth(target, health);
+ // We need to retrieve the max health of the target after modifiers are
+ // applied to get a sensible value
+ float proportionalHealth = target.getMaxHealth() * ratio;
+ target.setHealth(proportionalHealth <= 0.0F ? Float.MIN_VALUE : proportionalHealth);
+ }
+
+ /**
+ * Set player's max health
+ */
+ protected void setMaxHealth(EntityLivingBase target, float health)
+ {
+ if (target.getMaxHealth() != health)
{
- this.morph.update(player, this);
+ target.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(health);
}
}
@Override
@SideOnly(Side.CLIENT)
- public GuiSurvivalMorphs getOverlay() {
+ public GuiSurvivalMorphs getOverlay()
+ {
if (this.overlay == null)
{
this.overlay = new GuiSurvivalMorphs();
this.overlay.setupMorphs(this);
this.hasOverlay = true;
}
+
return this.overlay;
}
}
\ No newline at end of file
diff --git a/src/main/java/mchorse/metamorph/capabilities/morphing/MorphingStorage.java b/src/main/java/mchorse/metamorph/capabilities/morphing/MorphingStorage.java
index 26ecd739..09c64bb2 100644
--- a/src/main/java/mchorse/metamorph/capabilities/morphing/MorphingStorage.java
+++ b/src/main/java/mchorse/metamorph/capabilities/morphing/MorphingStorage.java
@@ -31,9 +31,11 @@ public NBTBase writeNBT(Capability capability, IMorphing instance, En
{
NBTTagCompound tag = new NBTTagCompound();
NBTTagList acquired = new NBTTagList();
- tag.setTag("lastHealthRatio", new NBTTagFloat(instance.getLastHealthRatio()));
- tag.setTag("HasSquidAir", new NBTTagByte(instance.getHasSquidAir() ? (byte)1 : (byte)0));
- tag.setTag("SquidAir", new NBTTagInt(instance.getSquidAir()));
+
+ tag.setFloat("lastHealthRatio", instance.getLastHealthRatio());
+ tag.setBoolean("HasSquidAir", instance.getHasSquidAir());
+ tag.setInteger("SquidAir", instance.getSquidAir());
+ tag.setFloat("lastHealth", instance.getLastHealth());
if (instance.getCurrentMorph() != null)
{
@@ -63,11 +65,12 @@ public void readNBT(Capability capability, IMorphing instance, EnumFa
{
NBTTagCompound tag = (NBTTagCompound) nbt;
NBTTagList acquired = tag.getTagList("Morphs", 10);
- NBTTagList favorites = tag.getTagList("Favorites", 3);
NBTTagCompound morphTag = tag.getCompoundTag("Morph");
+
instance.setLastHealthRatio(tag.getFloat("LastHealthRatio"));
- instance.setHasSquidAir(tag.getByte("HasSquidAir") == 1);
+ instance.setHasSquidAir(tag.getBoolean("HasSquidAir"));
instance.setSquidAir(tag.getInteger("SquidAir"));
+ instance.setLastHealth(tag.getFloat("lastHealth"));
if (!tag.hasNoTags())
{
@@ -91,19 +94,6 @@ public void readNBT(Capability capability, IMorphing instance, EnumFa
instance.setAcquiredMorphs(acquiredMorphs);
}
-
- if (!favorites.hasNoTags())
- {
- for (int i = 0; i < favorites.tagCount(); i++)
- {
- int index = favorites.getIntAt(i);
-
- if (index >= 0 && index < acquiredMorphs.size())
- {
- acquiredMorphs.get(index).favorite = true;
- }
- }
- }
}
}
}
diff --git a/src/main/java/mchorse/vanilla_pack/abilities/SunAllergy.java b/src/main/java/mchorse/vanilla_pack/abilities/SunAllergy.java
index 0d63d499..adc40497 100644
--- a/src/main/java/mchorse/vanilla_pack/abilities/SunAllergy.java
+++ b/src/main/java/mchorse/vanilla_pack/abilities/SunAllergy.java
@@ -53,7 +53,7 @@ public void update(EntityLivingBase target)
if (itemstack.getItemDamage() >= itemstack.getMaxDamage())
{
target.renderBrokenItemStack(itemstack);
- target.setItemStackToSlot(EntityEquipmentSlot.HEAD, (ItemStack) null);
+ target.setItemStackToSlot(EntityEquipmentSlot.HEAD, null);
}
}
diff --git a/src/main/java/mchorse/vanilla_pack/morphs/BlockMorph.java b/src/main/java/mchorse/vanilla_pack/morphs/BlockMorph.java
index a7f957e3..27b92d3a 100644
--- a/src/main/java/mchorse/vanilla_pack/morphs/BlockMorph.java
+++ b/src/main/java/mchorse/vanilla_pack/morphs/BlockMorph.java
@@ -123,13 +123,7 @@ public AbstractMorph clone(boolean isRemote)
{
BlockMorph morph = new BlockMorph();
- morph.name = this.name;
- morph.settings = this.settings;
-
- if (isRemote)
- {
- morph.renderer = this.renderer;
- }
+ AbstractMorph.copyBase(this, morph);
/* Data relevant only to this morph */
morph.block = this.block;
diff --git a/src/main/java/mchorse/vanilla_pack/morphs/PlayerMorph.java b/src/main/java/mchorse/vanilla_pack/morphs/PlayerMorph.java
index d419b104..56cfc9a0 100644
--- a/src/main/java/mchorse/vanilla_pack/morphs/PlayerMorph.java
+++ b/src/main/java/mchorse/vanilla_pack/morphs/PlayerMorph.java
@@ -163,8 +163,8 @@ public AbstractMorph clone(boolean isRemote)
{
PlayerMorph morph = new PlayerMorph();
- morph.name = this.name;
- morph.settings = this.settings;
+ AbstractMorph.copyBase(this, morph);
+
morph.entityData = this.entityData.copy();
morph.profile = this.profile;
diff --git a/src/main/java/mchorse/vanilla_pack/morphs/UndeadMorph.java b/src/main/java/mchorse/vanilla_pack/morphs/UndeadMorph.java
index 72050712..cb0ba8b3 100644
--- a/src/main/java/mchorse/vanilla_pack/morphs/UndeadMorph.java
+++ b/src/main/java/mchorse/vanilla_pack/morphs/UndeadMorph.java
@@ -51,8 +51,7 @@ public AbstractMorph clone(boolean isRemote)
{
UndeadMorph morph = new UndeadMorph();
- morph.name = this.name;
- morph.settings = this.settings;
+ AbstractMorph.copyBase(this, morph);
morph.entityData = this.entityData.copy();
return morph;
diff --git a/version.json b/version.json
index 0ee7ddb8..b7559b51 100644
--- a/version.json
+++ b/version.json
@@ -1,29 +1,32 @@
{
"homepage":"https://minecraft.curseforge.com/projects/metamorph",
"1.10.2":{
+ "1.1.10": "This is a small patch update with a couple of bug fixes (mainly by asanetargoss).",
"1.1.9": "This is a small patch update with lots of awesome bug fixes pull requests from asanetargoss and Johni0702!",
"1.1.8": "This is a small patch update which is mostly oriented toward Blockbuster's compatibility, but also has some internal changes and few bug fixes.",
"1.1.7": "This is a small patch update which is mostly oriented toward Blockbuster's compatibility.",
"1.1.5": "This is a small, quick and dirty patch that provides several bugfixes (mainly for Blockbuster's update)."
},
"1.11.2":{
+ "1.1.10": "This is a small patch update with a couple of bug fixes (mainly by asanetargoss).",
"1.1.9": "This is a small patch update with lots of awesome bug fixes pull requests from asanetargoss and Johni0702!",
"1.1.8": "This is a small patch update which is mostly oriented toward Blockbuster's compatibility, but also h as some internal changes and few bug fixes.",
"1.1.7": "This is a small patch update which is mostly oriented toward Blockbuster's compatibility.",
"1.1.5": "This is a small, quick and dirty patch that provides several bugfixes (mainly for Blockbuster's update)."
},
"1.12.2":{
+ "1.1.10": "This is a small patch update with a couple of bug fixes (mainly by asanetargoss).",
"1.1.9": "This is a small patch update with lots of awesome bug fixes pull requests from asanetargoss and Johni0702!",
"1.1.8": "This is a small patch update which is mostly oriented toward Blockbuster's compatibility, but also has some internal changes and few bug fixes.",
"1.1.7": "This is a small patch update which is mostly oriented toward Blockbuster's compatibility.",
"1.1.5": "This is a small, quick and dirty patch that provides several bugfixes (mainly for Blockbuster's update)."
},
"promos":{
- "1.10.2-latest":"1.1.9",
- "1.10.2-recommended":"1.1.9",
- "1.11.2-latest":"1.1.9",
- "1.11.2-recommended":"1.1.9",
- "1.12.2-latest":"1.1.9",
- "1.12.2-recommended":"1.1.9"
+ "1.10.2-latest":"1.1.10",
+ "1.10.2-recommended":"1.1.10",
+ "1.11.2-latest":"1.1.10",
+ "1.11.2-recommended":"1.1.10",
+ "1.12.2-latest":"1.1.10",
+ "1.12.2-recommended":"1.1.10"
}
-}
\ No newline at end of file
+}