From a6a3bfa6f313adba5afe6eb4a0da049a8d641cfc Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Fri, 5 Jun 2015 01:53:14 +0100 Subject: Stuff! --- .../darkknight/jewelrycraft/curses/CurseBlind.java | 77 ++++---- .../jewelrycraft/curses/CurseInfamy.java | 158 +++++++-------- .../jewelrycraft/curses/CurseMidasTouch.java | 215 +++++++++++---------- .../jewelrycraft/curses/CurseRabbitsPaw.java | 146 +++++++------- 4 files changed, 305 insertions(+), 291 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/curses') diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseBlind.java b/src/main/java/darkknight/jewelrycraft/curses/CurseBlind.java index 8716ba9..932e23b 100644 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseBlind.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseBlind.java @@ -1,35 +1,42 @@ -package darkknight.jewelrycraft.curses; - -import darkknight.jewelrycraft.api.Curse; -import darkknight.jewelrycraft.config.ConfigHandler; -import darkknight.jewelrycraft.util.Variables; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; - -public class CurseBlind extends Curse -{ - public CurseBlind(String name, int txtID, String pack) - { - super(name, txtID, pack); - } - - @Override - public void action(World world, EntityPlayer player) - { - if (!player.isPotionActive(Potion.blindness) || player.getActivePotionEffect(Potion.blindness).getDuration() < 30) player.addPotionEffect(new PotionEffect(Potion.blindness.id, 60)); - } - - public String getDescription() - { - return StatCollector.translateToLocal("curse." + Variables.MODID + ".blind.description"); - } - - @Override - public boolean canCurseBeActivated(World world) - { - return world.getWorldInfo().isHardcoreModeEnabled() ? false : ConfigHandler.CURSE_BLIND; - } -} +package darkknight.jewelrycraft.curses; + +import java.util.Random; +import darkknight.jewelrycraft.api.Curse; +import darkknight.jewelrycraft.config.ConfigHandler; +import darkknight.jewelrycraft.util.Variables; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public class CurseBlind extends Curse +{ + public CurseBlind(String name, int txtID, String pack) + { + super(name, txtID, pack); + } + + @Override + public void action(World world, EntityPlayer player) + { + if (!player.isPotionActive(Potion.blindness) || player.getActivePotionEffect(Potion.blindness).getDuration() < 30) player.addPotionEffect(new PotionEffect(Potion.blindness.id, 60)); + } + + public String getDescription() + { + return StatCollector.translateToLocal("curse." + Variables.MODID + ".blind.description"); + } + + @Override + public boolean canCurseBeActivated(World world) + { + return world.getWorldInfo().isHardcoreModeEnabled() ? false : ConfigHandler.CURSE_BLIND; + } + + @Override + public int weight(World world, EntityPlayer player, Random random) + { + return 7; + } +} diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java b/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java index 90d01ac..c30ca8a 100644 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java @@ -1,79 +1,79 @@ -package darkknight.jewelrycraft.curses; - -import org.lwjgl.opengl.GL11; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.monster.EntityMob; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.client.event.RenderPlayerEvent; -import darkknight.jewelrycraft.api.Curse; -import darkknight.jewelrycraft.config.ConfigHandler; -import darkknight.jewelrycraft.damage.DamageSourceList; -import darkknight.jewelrycraft.entities.EntityHalfHeart; -import darkknight.jewelrycraft.entities.EntityHeart; -import darkknight.jewelrycraft.entities.renders.RenderHelper; -import darkknight.jewelrycraft.item.render.MaskRender; -import darkknight.jewelrycraft.util.JewelrycraftUtil; -import darkknight.jewelrycraft.util.PlayerUtils; -import darkknight.jewelrycraft.util.Variables; - -public class CurseInfamy extends Curse -{ - public CurseInfamy(String name, int txtID, String pack) - { - super(name, txtID, pack); - } - - @Override - public void attackedByPlayerAction(World world, EntityPlayer player, Entity target) - { - if (rand.nextInt(5) == 0 && !world.isRemote && !(target instanceof EntityMob) && target instanceof EntityLiving && !(target instanceof EntityHeart) && !(target instanceof EntityHalfHeart) && target.canAttackWithItem()){ - NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID); - playerInfo.setFloat("BlackHeart", playerInfo.getFloat("BlackHeart") + 1.0F); - if (player.getMaxHealth() >= 3F){ - player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() - 1.0F); - player.setHealth(player.getHealth() - 1.0F); - } - JewelrycraftUtil.addCursePoints(player, 10); - } - } - - @Override - public void playerRender(EntityPlayer player, RenderPlayerEvent.Specials.Post event) - { - MaskRender mask = new MaskRender(); - float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * event.partialRenderTick; - float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * event.partialRenderTick; - float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * event.partialRenderTick; - GL11.glPushMatrix(); - GL11.glColor4f(1, 1, 1, 1); - GL11.glRotatef(yawOffset, 0, -1, 0); - GL11.glRotatef(yaw - 90, 0, 1, 0); - GL11.glRotatef(pitch, 0, 0, -1); - GL11.glRotatef(90F, 0, 1F, 0F); - RenderHelper.translateToHeadLevel(player); - GL11.glScalef(1.6f, 1.6f, 1.6f); - GL11.glTranslatef(-0.25F, -0.25F, -0.25F); - mask.doRender(event.entityPlayer, 0F, 0F, 0F, 0F, 0F); - GL11.glPopMatrix(); - } - - public String getDescription() - { - return StatCollector.translateToLocal("curse." + Variables.MODID + ".infamy.description"); - } - - @Override - public boolean canCurseBeActivated(World world) - { - return ConfigHandler.CURSE_INFAMY; - } -} +package darkknight.jewelrycraft.curses; + +import org.lwjgl.opengl.GL11; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.client.event.RenderPlayerEvent; +import darkknight.jewelrycraft.api.Curse; +import darkknight.jewelrycraft.config.ConfigHandler; +import darkknight.jewelrycraft.damage.DamageSourceList; +import darkknight.jewelrycraft.entities.EntityHalfHeart; +import darkknight.jewelrycraft.entities.EntityHeart; +import darkknight.jewelrycraft.entities.renders.RenderHelper; +import darkknight.jewelrycraft.item.render.MaskRender; +import darkknight.jewelrycraft.util.JewelrycraftUtil; +import darkknight.jewelrycraft.util.PlayerUtils; +import darkknight.jewelrycraft.util.Variables; + +public class CurseInfamy extends Curse +{ + public CurseInfamy(String name, int txtID, String pack) + { + super(name, txtID, pack); + } + + @Override + public void attackedByPlayerAction(World world, EntityPlayer player, Entity target) + { + if (rand.nextInt(5) == 0 && !world.isRemote && !(target instanceof EntityMob) && target instanceof EntityLiving && !(target instanceof EntityHeart) && !(target instanceof EntityHalfHeart) && target.canAttackWithItem()){ + NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID); + playerInfo.setFloat("BlackHeart", playerInfo.getFloat("BlackHeart") + 1.0F); + if (player.getMaxHealth() >= 3F){ + player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() - 1.0F); + player.setHealth(player.getHealth() - 1.0F); + } + JewelrycraftUtil.addCursePoints(player, 10); + } + } + + @Override + public void playerRender(EntityPlayer player, RenderPlayerEvent.Specials.Post event) + { + MaskRender mask = new MaskRender(); + float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * event.partialRenderTick; + float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * event.partialRenderTick; + float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * event.partialRenderTick; + GL11.glPushMatrix(); + GL11.glColor4f(1, 1, 1, 1); + GL11.glRotatef(yawOffset, 0, -1, 0); + GL11.glRotatef(yaw - 90, 0, 1, 0); + GL11.glRotatef(pitch, 0, 0, -1); + GL11.glRotatef(90F, 0, 1F, 0F); + RenderHelper.translateToHeadLevel(player); + GL11.glScalef(1.6f, 1.6f, 1.6f); + GL11.glTranslatef(-0.25F, -0.25F, -0.25F); + mask.doRender(event.entityPlayer, 0F, 0F, 0F, 0F, 0F); + GL11.glPopMatrix(); + } + + public String getDescription() + { + return StatCollector.translateToLocal("curse." + Variables.MODID + ".infamy.description"); + } + + @Override + public boolean canCurseBeActivated(World world) + { + return ConfigHandler.CURSE_INFAMY; + } +} diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseMidasTouch.java b/src/main/java/darkknight/jewelrycraft/curses/CurseMidasTouch.java index 688acb6..198a0e0 100644 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseMidasTouch.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseMidasTouch.java @@ -1,104 +1,111 @@ -package darkknight.jewelrycraft.curses; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockCompressed; -import net.minecraft.block.BlockPressurePlate; -import net.minecraft.block.BlockPressurePlateWeighted; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemArmor; -import net.minecraft.item.ItemAxe; -import net.minecraft.item.ItemHoe; -import net.minecraft.item.ItemPickaxe; -import net.minecraft.item.ItemSpade; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemSword; -import net.minecraft.util.MathHelper; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import darkknight.jewelrycraft.api.Curse; -import darkknight.jewelrycraft.block.BlockList; -import darkknight.jewelrycraft.config.ConfigHandler; -import darkknight.jewelrycraft.entities.EntityHalfHeart; -import darkknight.jewelrycraft.entities.EntityHeart; -import darkknight.jewelrycraft.item.ItemList; -import darkknight.jewelrycraft.tileentity.TileEntityMidasTouch; -import darkknight.jewelrycraft.util.JewelryNBT; -import darkknight.jewelrycraft.util.Variables; - -public class CurseMidasTouch extends Curse -{ - public CurseMidasTouch(String name, int txtID, String pack) - { - super(name, txtID, pack); - } - - @Override - public void attackedByPlayerAction(World world, EntityPlayer player, Entity target) - { - if (!world.isRemote && target instanceof EntityLivingBase && !(target instanceof EntityHeart) && !(target instanceof EntityHalfHeart) && player.inventory.getCurrentItem() == null){ - world.setBlock(MathHelper.floor_double(target.posX), MathHelper.floor_double(target.posY), MathHelper.floor_double(target.posZ), BlockList.midasTouchBlock, 0, 2); - TileEntityMidasTouch midasTouchVictim = new TileEntityMidasTouch(); - midasTouchVictim.setEntity(target); - world.setTileEntity(MathHelper.floor_double(target.posX), MathHelper.floor_double(target.posY), MathHelper.floor_double(target.posZ), midasTouchVictim); - target.setDead(); - } - } - - @Override - public void action(World world, EntityPlayer player) - { - ItemStack curItem = player.inventory.getCurrentItem(); - if(curItem != null && curItem.getItem() != ItemList.goldObj && !isGoldenObject(curItem.getItem())){ - int index = player.inventory.currentItem; - ItemStack item = curItem; - ItemStack result = new ItemStack(ItemList.goldObj, item.stackSize, item.getItemDamage()); - JewelryNBT.addItem(result, item); - if(changeItem(curItem) != null) result = changeItem(curItem); - player.inventory.setInventorySlotContents(index, result); - } - } - - public ItemStack changeItem(ItemStack currItem) - { - if(currItem.getItem() instanceof ItemSword) return new ItemStack(Items.golden_sword, currItem.stackSize, currItem.getItemDamage()); - else if(currItem.getItem() instanceof ItemSpade) return new ItemStack(Items.golden_shovel, currItem.stackSize, currItem.getItemDamage()); - else if(currItem.getItem() instanceof ItemPickaxe) return new ItemStack(Items.golden_pickaxe, currItem.stackSize, currItem.getItemDamage()); - else if(currItem.getItem() instanceof ItemAxe) return new ItemStack(Items.golden_axe, currItem.stackSize, currItem.getItemDamage()); - else if(currItem.getItem() instanceof ItemHoe) return new ItemStack(Items.golden_hoe, currItem.stackSize, currItem.getItemDamage()); - else if(currItem.getItem() instanceof ItemArmor && ((ItemArmor)currItem.getItem()).armorType == 0) return new ItemStack(Items.golden_helmet, currItem.stackSize, currItem.getItemDamage()); - else if(currItem.getItem() instanceof ItemArmor && ((ItemArmor)currItem.getItem()).armorType == 1) return new ItemStack(Items.golden_chestplate, currItem.stackSize, currItem.getItemDamage()); - else if(currItem.getItem() instanceof ItemArmor && ((ItemArmor)currItem.getItem()).armorType == 2) return new ItemStack(Items.golden_leggings, currItem.stackSize, currItem.getItemDamage()); - else if(currItem.getItem() instanceof ItemArmor && ((ItemArmor)currItem.getItem()).armorType == 3) return new ItemStack(Items.golden_boots, currItem.stackSize, currItem.getItemDamage()); - else if(currItem.getItem().getUnlocalizedName().toLowerCase().contains("horsearmor")) return new ItemStack(Items.golden_horse_armor, currItem.stackSize, 0); - else if(currItem.getItem().getUnlocalizedName().toLowerCase().contains("nugget") || currItem.getItem().getItemStackDisplayName(currItem).toLowerCase().contains(" nugget") || currItem.getItem().getItemStackDisplayName(currItem).toLowerCase().contains("nugget ")) return new ItemStack(Items.gold_nugget, currItem.stackSize, 0); - else if(currItem.getItem().getUnlocalizedName().toLowerCase().contains("ingot") || currItem.getItem().getItemStackDisplayName(currItem).toLowerCase().contains(" ingot") || currItem.getItem().getItemStackDisplayName(currItem).toLowerCase().contains("ingot ")) return new ItemStack(Items.gold_ingot, currItem.stackSize, 0); - else if(Block.getBlockFromItem(currItem.getItem()) instanceof BlockPressurePlate || Block.getBlockFromItem(currItem.getItem()) instanceof BlockPressurePlateWeighted) return new ItemStack(Blocks.light_weighted_pressure_plate, currItem.stackSize, 0); - else if(Block.getBlockFromItem(currItem.getItem()) instanceof BlockCompressed) return new ItemStack(Blocks.gold_block, currItem.stackSize, 0); - return null; - } - - public boolean isGoldenObject(Item item) - { - return item.equals(Items.gold_ingot) || item.equals(Items.gold_nugget) || item.equals(Items.golden_helmet) || item.equals(Items.golden_chestplate) || - item.equals(Items.golden_leggings) || item.equals(Items.golden_boots) || item.equals(Items.golden_sword) || item.equals(Items.golden_shovel) || - item.equals(Items.golden_pickaxe) || item.equals(Items.golden_axe) || item.equals(Items.golden_hoe) || item.equals(Items.golden_horse_armor) || - Block.getBlockFromItem(item).equals(Blocks.gold_block) || Block.getBlockFromItem(item).equals(Blocks.light_weighted_pressure_plate); - } - - public String getDescription() - { - return StatCollector.translateToLocal("curse." + Variables.MODID + ".midastouch.description"); - } - - @Override - public boolean canCurseBeActivated(World world) - { - return world.getWorldInfo().isHardcoreModeEnabled() ? false : ConfigHandler.CURSE_MIDAS_TOUCH; - } -} +package darkknight.jewelrycraft.curses; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockCompressed; +import net.minecraft.block.BlockPressurePlate; +import net.minecraft.block.BlockPressurePlateWeighted; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemAxe; +import net.minecraft.item.ItemHoe; +import net.minecraft.item.ItemPickaxe; +import net.minecraft.item.ItemSpade; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.util.MathHelper; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import darkknight.jewelrycraft.api.Curse; +import darkknight.jewelrycraft.block.BlockList; +import darkknight.jewelrycraft.config.ConfigHandler; +import darkknight.jewelrycraft.entities.EntityHalfHeart; +import darkknight.jewelrycraft.entities.EntityHeart; +import darkknight.jewelrycraft.item.ItemList; +import darkknight.jewelrycraft.tileentity.TileEntityMidasTouch; +import darkknight.jewelrycraft.util.JewelryNBT; +import darkknight.jewelrycraft.util.Variables; + +public class CurseMidasTouch extends Curse +{ + public CurseMidasTouch(String name, int txtID, String pack) + { + super(name, txtID, pack); + } + + @Override + public void attackedByPlayerAction(World world, EntityPlayer player, Entity target) + { + if (!world.isRemote && target instanceof EntityLivingBase && !(target instanceof EntityHeart) && !(target instanceof EntityHalfHeart) && player.inventory.getCurrentItem() == null){ + world.setBlock(MathHelper.floor_double(target.posX), MathHelper.floor_double(target.posY), MathHelper.floor_double(target.posZ), BlockList.midasTouchBlock, 0, 2); + TileEntityMidasTouch midasTouchVictim = new TileEntityMidasTouch(); + midasTouchVictim.setEntity(target); + world.setTileEntity(MathHelper.floor_double(target.posX), MathHelper.floor_double(target.posY), MathHelper.floor_double(target.posZ), midasTouchVictim); + target.setDead(); + } + } + + @Override + public void action(World world, EntityPlayer player) + { + ItemStack curItem = player.inventory.getCurrentItem(); + if(curItem != null && curItem.getItem() != ItemList.goldObj && !isGoldenObject(curItem.getItem())){ + int index = player.inventory.currentItem; + ItemStack item = curItem; + ItemStack result = new ItemStack(ItemList.goldObj, item.stackSize, item.getItemDamage()); + JewelryNBT.addItem(result, item); + if(changeItem(curItem) != null) result = changeItem(curItem); + player.inventory.setInventorySlotContents(index, result); + } + } + + public ItemStack changeItem(ItemStack currItem) + { + if(currItem.getItem() instanceof ItemSword) return new ItemStack(Items.golden_sword, currItem.stackSize, currItem.getItemDamage()); + else if(currItem.getItem() instanceof ItemSpade) return new ItemStack(Items.golden_shovel, currItem.stackSize, currItem.getItemDamage()); + else if(currItem.getItem() instanceof ItemPickaxe) return new ItemStack(Items.golden_pickaxe, currItem.stackSize, currItem.getItemDamage()); + else if(currItem.getItem() instanceof ItemAxe) return new ItemStack(Items.golden_axe, currItem.stackSize, currItem.getItemDamage()); + else if(currItem.getItem() instanceof ItemHoe) return new ItemStack(Items.golden_hoe, currItem.stackSize, currItem.getItemDamage()); + else if(currItem.getItem() instanceof ItemArmor && ((ItemArmor)currItem.getItem()).armorType == 0) return new ItemStack(Items.golden_helmet, currItem.stackSize, currItem.getItemDamage()); + else if(currItem.getItem() instanceof ItemArmor && ((ItemArmor)currItem.getItem()).armorType == 1) return new ItemStack(Items.golden_chestplate, currItem.stackSize, currItem.getItemDamage()); + else if(currItem.getItem() instanceof ItemArmor && ((ItemArmor)currItem.getItem()).armorType == 2) return new ItemStack(Items.golden_leggings, currItem.stackSize, currItem.getItemDamage()); + else if(currItem.getItem() instanceof ItemArmor && ((ItemArmor)currItem.getItem()).armorType == 3) return new ItemStack(Items.golden_boots, currItem.stackSize, currItem.getItemDamage()); + else if(currItem.getItem().getUnlocalizedName().toLowerCase().contains("horsearmor")) return new ItemStack(Items.golden_horse_armor, currItem.stackSize, 0); + else if(currItem.getItem().getUnlocalizedName().toLowerCase().contains("nugget") || currItem.getItem().getItemStackDisplayName(currItem).toLowerCase().contains(" nugget") || currItem.getItem().getItemStackDisplayName(currItem).toLowerCase().contains("nugget ")) return new ItemStack(Items.gold_nugget, currItem.stackSize, 0); + else if(currItem.getItem().getUnlocalizedName().toLowerCase().contains("ingot") || currItem.getItem().getItemStackDisplayName(currItem).toLowerCase().contains(" ingot") || currItem.getItem().getItemStackDisplayName(currItem).toLowerCase().contains("ingot ")) return new ItemStack(Items.gold_ingot, currItem.stackSize, 0); + else if(Block.getBlockFromItem(currItem.getItem()) instanceof BlockPressurePlate || Block.getBlockFromItem(currItem.getItem()) instanceof BlockPressurePlateWeighted) return new ItemStack(Blocks.light_weighted_pressure_plate, currItem.stackSize, 0); + else if(Block.getBlockFromItem(currItem.getItem()) instanceof BlockCompressed) return new ItemStack(Blocks.gold_block, currItem.stackSize, 0); + return null; + } + + public boolean isGoldenObject(Item item) + { + return item.equals(Items.gold_ingot) || item.equals(Items.gold_nugget) || item.equals(Items.golden_helmet) || item.equals(Items.golden_chestplate) || + item.equals(Items.golden_leggings) || item.equals(Items.golden_boots) || item.equals(Items.golden_sword) || item.equals(Items.golden_shovel) || + item.equals(Items.golden_pickaxe) || item.equals(Items.golden_axe) || item.equals(Items.golden_hoe) || item.equals(Items.golden_horse_armor) || + Block.getBlockFromItem(item).equals(Blocks.gold_block) || Block.getBlockFromItem(item).equals(Blocks.light_weighted_pressure_plate); + } + + public String getDescription() + { + return StatCollector.translateToLocal("curse." + Variables.MODID + ".midastouch.description"); + } + + @Override + public boolean canCurseBeActivated(World world) + { + return world.getWorldInfo().isHardcoreModeEnabled() ? false : ConfigHandler.CURSE_MIDAS_TOUCH; + } + + @Override + public int weight(World world, EntityPlayer player, Random random) + { + return 2; + } +} diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java b/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java index 1c26558..b675954 100644 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java @@ -1,73 +1,73 @@ -/** - * - */ -package darkknight.jewelrycraft.curses; - -import java.util.ArrayList; -import darkknight.jewelrycraft.api.Curse; -import darkknight.jewelrycraft.config.ConfigHandler; -import darkknight.jewelrycraft.entities.EntityHalfHeart; -import darkknight.jewelrycraft.entities.EntityHeart; -import darkknight.jewelrycraft.util.JewelrycraftUtil; -import darkknight.jewelrycraft.util.Variables; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.item.EntityXPOrb; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MathHelper; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; - -public class CurseRabbitsPaw extends Curse -{ - public CurseRabbitsPaw(String name, int txtID, String pack) - { - super(name, txtID, pack); - } - - @Override - public void entityDropItems(EntityPlayer player, Entity target, ArrayList drops) - { - for(EntityItem item: drops){ - ItemStack drop = item.getEntityItem().copy(); - drop.stackSize = this.rand.nextInt(4); - if (drop.stackSize > 0) target.entityDropItem(drop, 0.5F); - } - } - - public void entityDeathAction(World world, EntityLivingBase target, EntityPlayer player) - { - String[] types = {"Red", "Blue", "White", "Black"}; - String type = types[rand.nextInt(4)]; - if (rand.nextInt(3) == 0 && target.getCreatureAttribute() != JewelrycraftUtil.HEART){ - if (type == "White"){ - EntityHeart h = new EntityHalfHeart(world); - h.setType(type); - h.setLocationAndAngles(target.posX, target.posY, target.posZ, MathHelper.wrapAngleTo180_float(rand.nextFloat() * 360.0F), 0.0F); - world.spawnEntityInWorld(h); - }else{ - for(int i = 1; i <= 1 + rand.nextInt(1 + (int)(target.getMaxHealth() / 20)); i++){ - EntityHeart[] hearts = {new EntityHeart(world), new EntityHalfHeart(world)}; - EntityHeart h = hearts[rand.nextInt(2)]; - h.setType(type); - h.setLocationAndAngles(target.posX, target.posY, target.posZ, MathHelper.wrapAngleTo180_float(rand.nextFloat() * 360.0F), 0.0F); - world.spawnEntityInWorld(h); - } - } - } - if (rand.nextInt(3) == 0) world.spawnEntityInWorld(new EntityXPOrb(world, target.posX, target.posY, target.posZ, 1 + rand.nextInt(40))); - } - - public String getDescription() - { - return StatCollector.translateToLocal("curse." + Variables.MODID + ".rabbitspaw.description"); - } - - @Override - public boolean canCurseBeActivated(World world) - { - return ConfigHandler.CURSE_RABBIT_PAW; - } -} +/** + * + */ +package darkknight.jewelrycraft.curses; + +import java.util.ArrayList; +import darkknight.jewelrycraft.api.Curse; +import darkknight.jewelrycraft.config.ConfigHandler; +import darkknight.jewelrycraft.entities.EntityHalfHeart; +import darkknight.jewelrycraft.entities.EntityHeart; +import darkknight.jewelrycraft.util.JewelrycraftUtil; +import darkknight.jewelrycraft.util.Variables; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public class CurseRabbitsPaw extends Curse +{ + public CurseRabbitsPaw(String name, int txtID, String pack) + { + super(name, txtID, pack); + } + + @Override + public void entityDropItems(EntityPlayer player, Entity target, ArrayList drops) + { + for(EntityItem item: drops){ + ItemStack drop = item.getEntityItem().copy(); + drop.stackSize = this.rand.nextInt(4); + if (drop.stackSize > 0) target.entityDropItem(drop, 0.5F); + } + } + + public void entityDeathAction(World world, EntityLivingBase target, EntityPlayer player) + { + String[] types = {"Red", "Blue", "White", "Black"}; + String type = types[rand.nextInt(4)]; + if (rand.nextInt(3) == 0 && target.getCreatureAttribute() != JewelrycraftUtil.HEART){ + if (type == "White"){ + EntityHeart h = new EntityHalfHeart(world); + h.setType(type); + h.setLocationAndAngles(target.posX, target.posY, target.posZ, MathHelper.wrapAngleTo180_float(rand.nextFloat() * 360.0F), 0.0F); + world.spawnEntityInWorld(h); + }else{ + for(int i = 1; i <= 1 + rand.nextInt(1 + (int)(target.getMaxHealth() / 20)); i++){ + EntityHeart[] hearts = {new EntityHeart(world), new EntityHalfHeart(world)}; + EntityHeart h = hearts[rand.nextInt(2)]; + h.setType(type); + h.setLocationAndAngles(target.posX, target.posY, target.posZ, MathHelper.wrapAngleTo180_float(rand.nextFloat() * 360.0F), 0.0F); + world.spawnEntityInWorld(h); + } + } + } + if (rand.nextInt(3) == 0) world.spawnEntityInWorld(new EntityXPOrb(world, target.posX, target.posY, target.posZ, 1 + rand.nextInt(40))); + } + + public String getDescription() + { + return StatCollector.translateToLocal("curse." + Variables.MODID + ".rabbitspaw.description"); + } + + @Override + public boolean canCurseBeActivated(World world) + { + return ConfigHandler.CURSE_RABBIT_PAW; + } +} -- cgit v1.2.3