diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-06-24 22:07:45 +0100 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-06-24 22:07:45 +0100 |
| commit | b65c980fffb286feb2853245411f5bafb73daf15 (patch) | |
| tree | f415d4991eb8be9d329435a88b03d2660ad4f432 | |
| parent | 883aa7a2bbc3a23fb18fbb881e9890c066666ed9 (diff) | |
Added an option to disable hearts from despawning
| -rw-r--r-- | changelog.txt | 28 | ||||
| -rw-r--r-- | src/main/java/darkknight/jewelrycraft/config/ConfigHandler.java | 5 | ||||
| -rw-r--r-- | src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java | 284 |
3 files changed, 155 insertions, 162 deletions
diff --git a/changelog.txt b/changelog.txt index 01072c1..1d97764 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,26 +1,16 @@ Added:
-- Added Crystal blocks that generate in the world
-- Added a few items to generate in Dungeon chests, Blacksmith chests and Stronghold chests
-- Added a total of 5 new structures that generate in the world
-- The Pentagram now has an actual effect (takes 1 health from an entity that is right by the player and heals the player; if the player is at full health, an extra empty heart is added)
-- The player renders in the Jewelry GUI (makes it easier for you to see how the jewelry render)
-- Added different loot to chests in different places (Dungeons, Pyramids, Strongholds etc)
-- Added a new 'weight' value to the Curse api
+- Hearts now have spawn eggs
+- There is now a config option to disable structures from spawning; you can chose to disable each structure individually or every single one (note, this will disable the Shadow ore as well)
Removed:
-- Removed the Crystal item
+- Had to remove the better Alpaca modelling system until Fisk decides to create a page where I can find all the downloads (post it on curse already :p)
Changed:
-- The Pentagram now renders beneath your feet when you look down and no longer does it in your inventory; it is also a lot smaller
-- Changed Entity registration so it only uses 'registerModEntity' to fix potential issues
-- Changed Crystal from craftable items to blocks that generate in the world
-- Changed Jewelry Tab to not override TiCon tabs (sorry TiCon, your system is good, but not for me)
-- Some curses can no longer acquired in hardcore (such as Rotten Heart, Midas Touch etc) which would make it impossible to work with and require a total restart of the game
-- Updated the curse API so now people can specify when a curse can be activated (I believe the world is all you need :p)
-- Curses now use a random weight system in order to get chooses (this allows for different curses to have a lower chance to appear than others)
-- Midas Touch now has a lower chance of appearing
+- Improved molten liquids
+- Improved the Cursed Eye following the player algorithm
+- Improved Hearts mechanics, now they should be a bit more reliable
+- Hearts now render on the right side of the hotbar rather than the left
+- Improved color detection system (should be less laggy now)
Fixed:
-- Fixed NEI from overlapping the guide GUI
-- Fixed an issue with the Liquids tab crashing
-- Fixed Jewelers having only rings as jewelry options
\ No newline at end of file +- Structures crashing servers
diff --git a/src/main/java/darkknight/jewelrycraft/config/ConfigHandler.java b/src/main/java/darkknight/jewelrycraft/config/ConfigHandler.java index 1a281bc..115f3b1 100644 --- a/src/main/java/darkknight/jewelrycraft/config/ConfigHandler.java +++ b/src/main/java/darkknight/jewelrycraft/config/ConfigHandler.java @@ -21,7 +21,6 @@ public class ConfigHandler public static boolean GENERATE_VILLAGE_NETHERSTAR;
public static boolean CAN_FURNACE_GENERATE_INGOTS;
- public static boolean CRYSTAL_GLOW;
public static int MAX_VILLAGE_JEWELERS;
public static int JEWELER_WEIGHT;
public static int INGOT_CHEST_MIN;
@@ -31,6 +30,9 @@ public class ConfigHandler public static int GEM_CHEST_MAX;
public static int FURNACE_MIN_INGOT_STACK;
public static int FURNACE_MAX_INGOT_STACK;
+
+ public static boolean CRYSTAL_GLOW;
+ public static boolean HEARTS_DESPAWN;
public static boolean CURSES_ENABLED = true;
public static boolean CURSE_ROTTEN_HEART = true;
@@ -82,6 +84,7 @@ public class ConfigHandler FURNACE_MAX_INGOT_STACK = config.getInt("Ingot Furnace Max", categories[1], 5, 0, Integer.MAX_VALUE, "Determines the maximum number of ingots that can generate in a furnace.");
CRYSTAL_GLOW = config.getBoolean("Crystal Glow", categories[2], false, "If true, then crystal will slowly glow (can cause lag)");
+ HEARTS_DESPAWN = config.getBoolean("Hearts Despawn", categories[2], true, "If false, then Hearts and Half-hearts will no longer despawn");
ENABLE_WORLD_GEN = config.getBoolean("World Generation", categories[3], true, "If false, nothing will generate (this includes ore)");
ORE_GEN = config.getBoolean("Ore Generation", categories[3], true, "If false, ores won't generate");
diff --git a/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java b/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java index 75c0015..6612c52 100644 --- a/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java +++ b/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java @@ -1,142 +1,142 @@ -/** - * - */ -package darkknight.jewelrycraft.entities; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EnumCreatureAttribute; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import darkknight.jewelrycraft.JewelrycraftMod; -import darkknight.jewelrycraft.config.ConfigHandler; -import darkknight.jewelrycraft.network.PacketRequestPlayerInfo; -import darkknight.jewelrycraft.util.JewelrycraftUtil; -import darkknight.jewelrycraft.util.PlayerUtils; -import darkknight.jewelrycraft.util.Variables; - -/** - * @author Sorin - */ -public class EntityHeart extends EntityLiving -{ - public EntityHeart(World world) - { - super(world); - this.setSize(0.4F, 0.4F); - } - - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(getQuantity()); - } - - @Override - public void updateEntityActionState() - { - ++this.entityAge; - } - - public void onLivingUpdate() - { - super.onLivingUpdate(); - if (this.entityAge > ConfigHandler.HEART_DESPAWN_TIME) this.setDead(); - } - - protected void collideWithEntity(Entity entity) - { - super.collideWithEntity(entity); - if (!this.worldObj.isRemote && entity instanceof EntityHeart && getType().equals(((EntityHeart)entity).getType())){ - setQuantity(getQuantity() + ((EntityHeart)entity).getQuantity()); - getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(getQuantity() + ((EntityHeart)entity).getQuantity()); - this.heal(getQuantity()); - entity.setDead(); - } - } - - @Override - public void onCollideWithPlayer(EntityPlayer player) - { - if (!this.worldObj.isRemote){ - NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID); - if (getType() == "Red" && player.getHealth() < player.getMaxHealth()){ - float healAmount = player.getMaxHealth() - player.getHealth(); - if (getQuantity() > healAmount){ - player.heal(healAmount); - this.setQuantity(getQuantity() - healAmount); - }else{ - player.heal(getQuantity()); - this.setDead(); - } - }else if (getType().equals("White") && playerInfo.getFloat("WhiteHeart") > 0.1F){ - playerInfo.setFloat(getType() + "Heart", 0F); - player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() + playerInfo.getFloat("WhiteHeart")); - this.setDead(); - }else if (getType() != "Red"){ - playerInfo.setFloat(getType() + "Heart", playerInfo.getFloat(getType() + "Heart") + getQuantity()); - JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo()); - this.setDead(); - } - } - } - - @SideOnly (Side.CLIENT) - public boolean canRenderOnFire() - { - return false; - } - - protected void entityInit() - { - super.entityInit(); - this.dataWatcher.addObject(16, "Red"); - this.dataWatcher.addObject(17, 2f); - } - - public void writeEntityToNBT(NBTTagCompound nbt) - { - super.writeEntityToNBT(nbt); - nbt.setString("Type", getType()); - nbt.setFloat("Quantity", getQuantity()); - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - public void readEntityFromNBT(NBTTagCompound nbt) - { - super.readEntityFromNBT(nbt); - setType(nbt.getString("Type")); - setQuantity(nbt.getFloat("Quantity")); - } - - public String getType() - { - return this.dataWatcher.getWatchableObjectString(16); - } - - public void setType(String type) - { - this.dataWatcher.updateObject(16, type); - } - - public Float getQuantity() - { - return this.dataWatcher.getWatchableObjectFloat(17); - } - - public void setQuantity(Float qty) - { - this.dataWatcher.updateObject(17, qty); - } - - public EnumCreatureAttribute getCreatureAttribute() - { - return JewelrycraftUtil.HEART; - } -} +/**
+ *
+ */
+package darkknight.jewelrycraft.entities;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EnumCreatureAttribute;
+import net.minecraft.entity.SharedMonsterAttributes;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.config.ConfigHandler;
+import darkknight.jewelrycraft.network.PacketRequestPlayerInfo;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+import darkknight.jewelrycraft.util.PlayerUtils;
+import darkknight.jewelrycraft.util.Variables;
+
+/**
+ * @author Sorin
+ */
+public class EntityHeart extends EntityLiving
+{
+ public EntityHeart(World world)
+ {
+ super(world);
+ this.setSize(0.4F, 0.4F);
+ }
+
+ protected void applyEntityAttributes()
+ {
+ super.applyEntityAttributes();
+ this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(getQuantity());
+ }
+
+ @Override
+ public void updateEntityActionState()
+ {
+ if(ConfigHandler.HEARTS_DESPAWN) ++this.entityAge;
+ }
+
+ public void onLivingUpdate()
+ {
+ super.onLivingUpdate();
+ if (ConfigHandler.HEARTS_DESPAWN && this.entityAge > ConfigHandler.HEART_DESPAWN_TIME) this.setDead();
+ }
+
+ protected void collideWithEntity(Entity entity)
+ {
+ super.collideWithEntity(entity);
+ if (!this.worldObj.isRemote && entity instanceof EntityHeart && getType().equals(((EntityHeart)entity).getType())){
+ setQuantity(getQuantity() + ((EntityHeart)entity).getQuantity());
+ getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(getQuantity() + ((EntityHeart)entity).getQuantity());
+ this.heal(getQuantity());
+ entity.setDead();
+ }
+ }
+
+ @Override
+ public void onCollideWithPlayer(EntityPlayer player)
+ {
+ if (!this.worldObj.isRemote){
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
+ if (getType() == "Red" && player.getHealth() < player.getMaxHealth()){
+ float healAmount = player.getMaxHealth() - player.getHealth();
+ if (getQuantity() > healAmount){
+ player.heal(healAmount);
+ this.setQuantity(getQuantity() - healAmount);
+ }else{
+ player.heal(getQuantity());
+ this.setDead();
+ }
+ }else if (getType().equals("White") && playerInfo.getFloat("WhiteHeart") > 0.1F){
+ playerInfo.setFloat(getType() + "Heart", 0F);
+ player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() + playerInfo.getFloat("WhiteHeart"));
+ this.setDead();
+ }else if (getType() != "Red"){
+ playerInfo.setFloat(getType() + "Heart", playerInfo.getFloat(getType() + "Heart") + getQuantity());
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
+ this.setDead();
+ }
+ }
+ }
+
+ @SideOnly (Side.CLIENT)
+ public boolean canRenderOnFire()
+ {
+ return false;
+ }
+
+ protected void entityInit()
+ {
+ super.entityInit();
+ this.dataWatcher.addObject(16, "Red");
+ this.dataWatcher.addObject(17, 2f);
+ }
+
+ public void writeEntityToNBT(NBTTagCompound nbt)
+ {
+ super.writeEntityToNBT(nbt);
+ nbt.setString("Type", getType());
+ nbt.setFloat("Quantity", getQuantity());
+ }
+
+ /**
+ * (abstract) Protected helper method to read subclass entity data from NBT.
+ */
+ public void readEntityFromNBT(NBTTagCompound nbt)
+ {
+ super.readEntityFromNBT(nbt);
+ setType(nbt.getString("Type"));
+ setQuantity(nbt.getFloat("Quantity"));
+ }
+
+ public String getType()
+ {
+ return this.dataWatcher.getWatchableObjectString(16);
+ }
+
+ public void setType(String type)
+ {
+ this.dataWatcher.updateObject(16, type);
+ }
+
+ public Float getQuantity()
+ {
+ return this.dataWatcher.getWatchableObjectFloat(17);
+ }
+
+ public void setQuantity(Float qty)
+ {
+ this.dataWatcher.updateObject(17, qty);
+ }
+
+ public EnumCreatureAttribute getCreatureAttribute()
+ {
+ return JewelrycraftUtil.HEART;
+ }
+}
|
