From 256653501365eb4f95d3dddbcdfdc23a2a9594d5 Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Tue, 15 Apr 2014 23:05:32 +0300 Subject: Moved source files --- .../jewelrycraft/item/ItemClayMolds.java | 72 --- .../darkknight/jewelrycraft/item/ItemCrystal.java | 58 -- .../darkknight/jewelrycraft/item/ItemGuide.java | 26 - .../darkknight/jewelrycraft/item/ItemList.java | 55 -- .../darkknight/jewelrycraft/item/ItemMolds.java | 72 --- .../jewelrycraft/item/ItemMoltenMetalBucket.java | 309 ----------- .../darkknight/jewelrycraft/item/ItemNecklace.java | 272 ---------- .../darkknight/jewelrycraft/item/ItemRing.java | 599 --------------------- .../jewelrycraft/item/ItemThiefGloves.java | 113 ---- 9 files changed, 1576 deletions(-) delete mode 100644 eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemClayMolds.java delete mode 100644 eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemCrystal.java delete mode 100644 eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemGuide.java delete mode 100644 eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemList.java delete mode 100644 eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemMolds.java delete mode 100644 eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java delete mode 100644 eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemNecklace.java delete mode 100644 eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemRing.java delete mode 100644 eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemThiefGloves.java (limited to 'eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item') diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemClayMolds.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemClayMolds.java deleted file mode 100644 index 323a298..0000000 --- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemClayMolds.java +++ /dev/null @@ -1,72 +0,0 @@ -package darkknight.jewelrycraft.item; - -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class ItemClayMolds extends Item -{ - /** List of molds color names */ - public static final String[] moldsItemNames = new String[] { "clayIngot", "clayRing", "clayNecklace" }; - @SideOnly(Side.CLIENT) - private IIcon[] moldsIcons; - - public ItemClayMolds() - { - super(); - this.setHasSubtypes(true); - this.setMaxDamage(0); - this.setMaxStackSize(1); - } - - @SideOnly(Side.CLIENT) - /** - * Gets an icon index based on an item's damage value - */ - public IIcon getIconFromDamage(int par1) - { - int j = MathHelper.clamp_int(par1, 0, moldsItemNames.length - 1); - return this.moldsIcons[j]; - } - - /** - * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have different names based on - * their damage or NBT. - */ - public String getUnlocalizedNameInefficiently(ItemStack par1ItemStack) - { - int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, moldsItemNames.length - 1); - return super.getUnlocalizedName() + "." + moldsItemNames[i]; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @SideOnly(Side.CLIENT) - /** - * returns a list of items with the same ID, but different meta (eg: molds returns 16 items) - */ - public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - for (int j = 0; j < moldsItemNames.length; ++j) - { - par3List.add(new ItemStack(par1, 1, j)); - } - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) - { - this.moldsIcons = new IIcon[moldsItemNames.length]; - - for (int i = 0; i < moldsItemNames.length; ++i) - { - this.moldsIcons[i] = par1IconRegister.registerIcon("jewelrycraft:" + moldsItemNames[i] + this.getIconString()); - } - } -} diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemCrystal.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemCrystal.java deleted file mode 100644 index 2009309..0000000 --- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemCrystal.java +++ /dev/null @@ -1,58 +0,0 @@ -package darkknight.jewelrycraft.item; - -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class ItemCrystal extends Item -{ - public IIcon overlay; - public static final int[] dyeColors = new int[] {1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320}; - - public ItemCrystal() - { - super(); - this.setHasSubtypes(true); - this.setMaxDamage(0); - } - - public void registerIcons(IIconRegister iconRegister) - { - itemIcon = iconRegister.registerIcon("jewelrycraft:crystal"); - overlay = iconRegister.registerIcon("jewelrycraft:crystalOverlay"); - } - - @Override - public boolean requiresMultipleRenderPasses() - { - return true; - } - - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int pass) - { - if(pass == 1 && this.getDamage(stack) != 16) return dyeColors[this.getDamage(stack)]; - return 16777215; - } - - public IIcon getIcon(ItemStack stack, int pass) - { - return pass == 0 ? itemIcon : overlay; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - for (int j = 0; j < 16; ++j) - { - par3List.add(new ItemStack(par1, 1, j)); - } - } - -} diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemGuide.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemGuide.java deleted file mode 100644 index b4d300d..0000000 --- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemGuide.java +++ /dev/null @@ -1,26 +0,0 @@ -package darkknight.jewelrycraft.item; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import darkknight.jewelrycraft.JewelrycraftMod; - -public class ItemGuide extends Item -{ - public ItemGuide() - { - super(); - } - - @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) - { - if (world.isRemote) - { - player.openGui(JewelrycraftMod.instance, 1, player.worldObj, 0, 0, 0); - } - - return stack; - } -} \ No newline at end of file diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemList.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemList.java deleted file mode 100644 index 3a91c7b..0000000 --- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemList.java +++ /dev/null @@ -1,55 +0,0 @@ -package darkknight.jewelrycraft.item; - -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.registry.GameRegistry; -import darkknight.jewelrycraft.JewelrycraftMod; -import darkknight.jewelrycraft.block.BlockList; - -public class ItemList -{ - public static Item thiefGloves; - public static Item shadowIngot; - public static Item molds; - public static Item clayMolds; - public static Item crystal; - public static ItemRing ring; - public static ItemNecklace necklace; - public static Item guide; - public static ItemMoltenMetalBucket bucket; - - private static boolean isInitialized = false; - - public static void preInit(FMLPreInitializationEvent e) - { - if (!isInitialized) - { - thiefGloves = new ItemThiefGloves().setUnlocalizedName("Jewelrycraft.thiefGloves").setTextureName("jewelrycraft:thiefGloves").setCreativeTab(JewelrycraftMod.jewelrycraft); - shadowIngot = new Item().setUnlocalizedName("Jewelrycraft.ingotShadow").setTextureName("jewelrycraft:ingotShadow").setCreativeTab(JewelrycraftMod.jewelrycraft); - molds = new ItemMolds().setUnlocalizedName("Jewelrycraft.mold").setTextureName("Mold").setCreativeTab(JewelrycraftMod.jewelrycraft); - clayMolds = new ItemClayMolds().setUnlocalizedName("Jewelrycraft.mold").setTextureName("Mold").setCreativeTab(JewelrycraftMod.jewelrycraft); - ring = (ItemRing) new ItemRing().setUnlocalizedName("Jewelrycraft.ring").setTextureName("jewelrycraft:ring"); - crystal = new ItemCrystal().setUnlocalizedName("Jewelrycraft.crystal").setTextureName("jewelrycraft:crystal").setCreativeTab(JewelrycraftMod.jewelrycraft); - necklace = (ItemNecklace) new ItemNecklace().setUnlocalizedName("Jewelrycraft.necklace").setTextureName("jewelrycraft:necklace"); - guide = new ItemGuide().setUnlocalizedName("Jewelrycraft.guide").setTextureName("jewelrycraft:guide").setCreativeTab(JewelrycraftMod.jewelrycraft); - bucket = (ItemMoltenMetalBucket) new ItemMoltenMetalBucket().setUnlocalizedName("Jewelrycraft.bucket"); - - GameRegistry.registerItem(thiefGloves, "thiefGloves"); - GameRegistry.registerItem(shadowIngot, "shadowIngot"); - GameRegistry.registerItem(molds, "molds"); - GameRegistry.registerItem(clayMolds, "clayMolds"); - GameRegistry.registerItem(ring, "ring"); - GameRegistry.registerItem(necklace, "necklace"); - GameRegistry.registerItem(crystal, "crystal"); - GameRegistry.registerItem(guide, "guide"); - GameRegistry.registerItem(bucket, "moltenMetalBucket"); - - isInitialized = true; - } - } -} diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemMolds.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemMolds.java deleted file mode 100644 index 0ebb5d1..0000000 --- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemMolds.java +++ /dev/null @@ -1,72 +0,0 @@ -package darkknight.jewelrycraft.item; - -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class ItemMolds extends Item -{ - /** List of molds color names */ - public static final String[] moldsItemNames = new String[] { "ingot", "ring", "necklace" }; - @SideOnly(Side.CLIENT) - private IIcon[] moldsIcons; - - public ItemMolds() - { - super(); - this.setHasSubtypes(true); - this.setMaxDamage(0); - this.setMaxStackSize(1); - } - - @SideOnly(Side.CLIENT) - /** - * Gets an icon index based on an item's damage value - */ - public IIcon getIconFromDamage(int par1) - { - int j = MathHelper.clamp_int(par1, 0, moldsItemNames.length - 1); - return this.moldsIcons[j]; - } - - /** - * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have different names based on - * their damage or NBT. - */ - public String getUnlocalizedName(ItemStack par1ItemStack) - { - int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, moldsItemNames.length - 1); - return super.getUnlocalizedName() + "." + moldsItemNames[i]; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @SideOnly(Side.CLIENT) - /** - * returns a list of items with the same ID, but different meta (eg: molds returns 16 items) - */ - public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - for (int j = 0; j < moldsItemNames.length; ++j) - { - par3List.add(new ItemStack(par1, 1, j)); - } - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) - { - this.moldsIcons = new IIcon[moldsItemNames.length]; - - for (int i = 0; i < moldsItemNames.length; ++i) - { - this.moldsIcons[i] = par1IconRegister.registerIcon("jewelrycraft:" + moldsItemNames[i] + this.getIconString()); - } - } -} diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java deleted file mode 100644 index 18a17ad..0000000 --- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java +++ /dev/null @@ -1,309 +0,0 @@ -package darkknight.jewelrycraft.item; - -import java.awt.image.BufferedImage; -import java.io.BufferedOutputStream; -import java.io.BufferedWriter; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.nio.file.Files; -import java.nio.file.StandardOpenOption; - -import javax.imageio.ImageIO; - -import net.minecraft.block.material.Material; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.client.resources.IResourceManager; -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.ItemStack; -import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.IIcon; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.player.FillBucketEvent; -import cpw.mods.fml.common.eventhandler.Event; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import darkknight.jewelrycraft.JewelrycraftMod; -import darkknight.jewelrycraft.block.BlockList; -import darkknight.jewelrycraft.util.JewelryNBT; -import darkknight.jewelrycraft.util.JewelrycraftUtil; - -public class ItemMoltenMetalBucket extends Item -{ - public IIcon liquid; - public ItemMoltenMetalBucket() - { - this.maxStackSize = 1; - } - - /** - * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer - */ - public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer) - { - boolean flag = BlockList.moltenMetal == Blocks.air; - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, flag); - - if (movingobjectposition == null) - { - return stack; - } - else - { - FillBucketEvent event = new FillBucketEvent(par3EntityPlayer, stack, par2World, movingobjectposition); - if (MinecraftForge.EVENT_BUS.post(event)) - { - return stack; - } - - if (event.getResult() == Event.Result.ALLOW) - { - if (par3EntityPlayer.capabilities.isCreativeMode) - { - return stack; - } - - if (--stack.stackSize <= 0) - { - return event.result; - } - - if (!par3EntityPlayer.inventory.addItemStackToInventory(event.result)) - { - par3EntityPlayer.dropPlayerItemWithRandomChoice(event.result, false); - } - - return stack; - } - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - - if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) - { - return stack; - } - - if (flag) - { - if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, stack)) - { - return stack; - } - - Material material = par2World.getBlock(i, j, k).getMaterial(); - int l = par2World.getBlockMetadata(i, j, k); - par2World.setBlockToAir(i, j, k); - return this.func_150910_a(stack, par3EntityPlayer, ItemList.bucket); - } - else - { - if (BlockList.moltenMetal == Blocks.air) - { - return new ItemStack(Items.bucket); - } - - if (movingobjectposition.sideHit == 0) - { - --j; - } - - if (movingobjectposition.sideHit == 1) - { - ++j; - } - - if (movingobjectposition.sideHit == 2) - { - --k; - } - - if (movingobjectposition.sideHit == 3) - { - ++k; - } - - if (movingobjectposition.sideHit == 4) - { - --i; - } - - if (movingobjectposition.sideHit == 5) - { - ++i; - } - - if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, stack)) - { - return stack; - } - - try { - if (this.tryPlaceContainedLiquid(par2World, i, j, k, stack) && !par3EntityPlayer.capabilities.isCreativeMode) - { - return new ItemStack(Items.bucket); - } - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - return stack; - } - } - - private ItemStack func_150910_a(ItemStack p_150910_1_, EntityPlayer p_150910_2_, Item p_150910_3_) - { - if (p_150910_2_.capabilities.isCreativeMode) - { - return p_150910_1_; - } - else if (--p_150910_1_.stackSize <= 0) - { - return new ItemStack(p_150910_3_); - } - else - { - if (!p_150910_2_.inventory.addItemStackToInventory(new ItemStack(p_150910_3_))) - { - p_150910_2_.dropPlayerItemWithRandomChoice(new ItemStack(p_150910_3_, 1, 0), false); - } - - return p_150910_1_; - } - } - - /** - * Attempts to place the liquid contained inside the bucket. - * @throws IOException - */ - public boolean tryPlaceContainedLiquid(World par1World, int par2, int par3, int par4, ItemStack stack) throws IOException - { - if (BlockList.moltenMetal == Blocks.air) - { - return false; - } - else - { - Material material = par1World.getBlock(par2, par3, par4).getMaterial(); - boolean flag = !material.isSolid(); - - if (!par1World.isAirBlock(par2, par3, par4) && !flag) return false; - else - { - if (!par1World.isRemote && flag && !material.isLiquid()) par1World.func_147480_a(par2, par3, par4, true); - JewelrycraftUtil.liquids.put(String.valueOf(par2) + " " + String.valueOf(par3) + " " + String.valueOf(par4), JewelryNBT.ingot(stack).getItem()); - JewelrycraftMod.saveData = new NBTTagCompound(); - JewelrycraftMod.saveData.setString("coords", String.valueOf(par2) + " " + String.valueOf(par3) + " " + String.valueOf(par4)); - JewelrycraftMod.saveData.setInteger("item", Item.getIdFromItem(JewelryNBT.ingot(stack).getItem())); - CompressedStreamTools.writeCompressed(JewelrycraftMod.saveData, new FileOutputStream(JewelrycraftMod.liquidsConf)); - System.out.println(JewelrycraftMod.saveData.getString("coords")); - par1World.setBlock(par2, par3, par4, BlockList.moltenMetal, 0, 3); - return true; - } - } - } - - public void registerIcons(IIconRegister iconRegister) - { - itemIcon = iconRegister.registerIcon("bucket_empty"); - liquid = iconRegister.registerIcon("jewelrycraft:bucketOverlay"); - } - - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int pass) - { - try - { - return color(stack, pass); - } - catch (IOException e) - { - e.printStackTrace(); - } - return 16777215; - } - - @Override - public boolean requiresMultipleRenderPasses() - { - return true; - } - - public IIcon getIcon(ItemStack stack, int pass) - { - if(pass == 0) return itemIcon; - if(pass == 1) return liquid; - return itemIcon; - } - - public static int color(ItemStack stack, int pass) throws IOException - { - String domain = "", texture; - IResourceManager rm = Minecraft.getMinecraft().getResourceManager(); - BufferedImage icon; - int x=0, y=0, ok = 0, red, green, blue; - if (pass == 1 && JewelryNBT.ingot(stack) != null && JewelryNBT.ingot(stack).getIconIndex() != null && JewelryNBT.ingotColor(stack) == 16777215) - { - String ingotIconName = JewelryNBT.ingot(stack).getIconIndex().getIconName(); - - if (ingotIconName.substring(0, ingotIconName.indexOf(":") + 1) != "") domain = ingotIconName.substring(0, ingotIconName.indexOf(":") + 1).replace(":", " ").trim(); - else domain = "minecraft"; - - texture = ingotIconName.substring(ingotIconName.lastIndexOf(":") + 1) + ".png"; - ResourceLocation ingot = null; - - if (JewelryNBT.ingot(stack).getUnlocalizedName().contains("item")) ingot = new ResourceLocation(domain, "textures/items/" + texture); - else ingot = new ResourceLocation(domain, "textures/blocks/" + texture); - - icon = ImageIO.read(rm.getResource(ingot).getInputStream()); - while(ok == 0) - { - red = (icon.getRGB(x, y) >> 16) & 0xFF; - green = (icon.getRGB(x, y) >> 8) & 0xFF; - blue = icon.getRGB(x, y) & 0xFF; - if((red <= 80 && green <= 80 && blue <= 80) || (red >= 180 && green >= 180 && blue >= 180)) - { - if(x=icon.getTileWidth()-1 && y 0 && world.getBlock(i + x, j, k + z) != Blocks.bedrock) world.func_147480_a(i + x, j, k + z, true); - else if((side == 2 || side == 3) && j + x > 0 && world.getBlock(i + z, j + x, k) != Blocks.bedrock) world.func_147480_a(i + z, j + x, k, true); - else if((side == 4 || side == 5) && j + x > 0 && world.getBlock(i, j + x, k + z) != Blocks.bedrock) world.func_147480_a(i, j + x, k + z, true); - } - return true; - } - - public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) - { - amplifier = 0D; - if (!world.isRemote) - { - EntityPlayer entityplayer = (EntityPlayer) entity; - int posX = (int)Math.floor(entityplayer.posX), posY = (int)Math.floor(entityplayer.posY), posZ = (int)Math.floor(entityplayer.posZ); - - if (JewelryNBT.isJewelX(stack, new ItemStack(Items.diamond))) amplifier = 1D; - else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.emerald))) amplifier = 2D; - else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.nether_star))) amplifier = 5D; - - if(JewelryNBT.isModifierX(stack, new ItemStack(Items.dye, 1, 15)) && world.getBlock(posX, posY - 1, posZ) == Blocks.farmland) - for(int i = (int) - amplifier; i <= amplifier; i++) - for(int j = (int) - amplifier; j <= amplifier; j++) - world.setBlockMetadataWithNotify(posX + i, posY - 1, posZ + j, 1, 7); - - List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(entityplayer.posX - amplifier, entityplayer.posY - amplifier, entityplayer.posZ - amplifier, entityplayer.posX + amplifier, entityplayer.posY + 2*amplifier, entityplayer.posZ + amplifier)); - if(JewelryNBT.isModeX(stack, "Activated")) - { - for(int i = 0; i < entities.size(); i++) - { - if (JewelryNBT.isModifierX(stack, new ItemStack(Items.blaze_powder))) ((EntityLivingBase) entities.get(i)).addPotionEffect(new PotionEffect(Potion.fireResistance.id, 4, 0, true)); - else if (JewelryNBT.isModifierX(stack, new ItemStack(Items.sugar))) ((EntityLivingBase) entities.get(i)).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 4, 0, true)); - else if (JewelryNBT.isModifierX(stack, new ItemStack(Items.iron_pickaxe)) && !JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl))) ((EntityLivingBase) entities.get(i)).addPotionEffect(new PotionEffect(Potion.digSpeed.id, 4, 0, true)); - else if (JewelryNBT.isModifierX(stack, new ItemStack(Items.feather))) - { - ((EntityLivingBase) entities.get(i)).addPotionEffect(new PotionEffect(Potion.jump.id, 4, 0, true)); - entityplayer.fallDistance = 0; - } - else if (JewelryNBT.isModifierX(stack, new ItemStack(Items.potionitem, 1, 8270))) ((EntityLivingBase) entities.get(i)).addPotionEffect(new PotionEffect(Potion.invisibility.id, 4, 0, true)); - } - } - } - } - - public ItemStack getModifiedItemStack(ItemStack ingot, ItemStack modifier, ItemStack jewel) - { - ItemStack itemstack = new ItemStack(this); - JewelryNBT.addMetal(itemstack, ingot); - JewelryNBT.addModifier(itemstack, modifier); - JewelryNBT.addJewel(itemstack, jewel); - if(JewelryNBT.isModifierEffectType(itemstack) && !(JewelryNBT.isJewelX(itemstack, new ItemStack(Items.ender_pearl)) && JewelryNBT.isModifierX(itemstack, new ItemStack(Items.iron_pickaxe)))) JewelryNBT.addMode(itemstack, "Activated"); - if(JewelryNBT.isJewelX(itemstack, new ItemStack(Items.nether_star)) && JewelryNBT.isModifierX(itemstack, new ItemStack(Items.book))) - JewelryNBT.addMode(itemstack, "Disenchant"); - return itemstack; - } -} diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemRing.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemRing.java deleted file mode 100644 index fff9120..0000000 --- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemRing.java +++ /dev/null @@ -1,599 +0,0 @@ -package darkknight.jewelrycraft.item; - -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import javax.imageio.ImageIO; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockChest; -import net.minecraft.block.BlockSkull; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.monster.EntityIronGolem; -import net.minecraft.entity.monster.EntitySnowman; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.inventory.InventoryEnderChest; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.tileentity.TileEntitySkull; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import darkknight.jewelrycraft.JewelrycraftMod; -import darkknight.jewelrycraft.block.BlockList; -import darkknight.jewelrycraft.util.JewelryNBT; - -public class ItemRing extends Item -{ - public IIcon jewel; - private int amplifier, cooldown = 0; - int index = 0; - - public ItemRing() - { - super(); - this.setMaxStackSize(1); - } - - public void registerIcons(IIconRegister iconRegister) - { - itemIcon = iconRegister.registerIcon("jewelrycraft:ring"); - jewel = iconRegister.registerIcon("jewelrycraft:jewelRing"); - } - - @Override - public boolean requiresMultipleRenderPasses() - { - return true; - } - - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int pass) - { - try - { - return color(stack, pass); - } - catch (IOException e) - { - e.printStackTrace(); - } - return 16777215; - } - - public IIcon getIcon(ItemStack stack, int pass) - { - if(pass == 0) return itemIcon; - if(pass == 1 && JewelryNBT.jewel(stack) != null) return jewel; - return itemIcon; - } - - public static int color(ItemStack stack, int pass) throws IOException - { - String domain = "", texture; - IResourceManager rm = Minecraft.getMinecraft().getResourceManager(); - BufferedImage icon; - int x=0, y=0, ok = 0, red, green, blue; - if (pass == 0 && JewelryNBT.ingot(stack) != null && JewelryNBT.ingot(stack).getIconIndex() != null && JewelryNBT.ingotColor(stack) == 16777215) - { - String ingotIconName = JewelryNBT.ingot(stack).getIconIndex().getIconName(); - - if (ingotIconName.substring(0, ingotIconName.indexOf(":") + 1) != "") domain = ingotIconName.substring(0, ingotIconName.indexOf(":") + 1).replace(":", " ").trim(); - else domain = "minecraft"; - - texture = ingotIconName.substring(ingotIconName.lastIndexOf(":") + 1) + ".png"; - ResourceLocation ingot = null; - - if (JewelryNBT.ingot(stack).getUnlocalizedName().contains("item")) ingot = new ResourceLocation(domain, "textures/items/" + texture); - else ingot = new ResourceLocation(domain, "textures/blocks/" + texture); - - icon = ImageIO.read(rm.getResource(ingot).getInputStream()); - while(ok == 0) - { - red = (icon.getRGB(x, y) >> 16) & 0xFF; - green = (icon.getRGB(x, y) >> 8) & 0xFF; - blue = icon.getRGB(x, y) & 0xFF; - if((red <= 80 && green <= 80 && blue <= 80) || (red >= 180 && green >= 180 && blue >= 180)) - { - if(x=icon.getTileWidth()-1 && y> 16) & 0xFF; - green = (icon.getRGB(x, y) >> 8) & 0xFF; - blue = icon.getRGB(x, y) & 0xFF; - if((red <= 95 && green <= 95 && blue <= 95) || (red >= 180 && green >= 180 && blue >= 180)) - { - if(x=icon.getTileWidth()-1 && y 0 && world.getBlock(i, j, k) != Blocks.bedrock) - world.func_147480_a(i, j, k, true); - } - return true; - } - - public boolean canDisenchant(EntityPlayer player) - { - if(player.capabilities.isCreativeMode) return true; - else if(player.experienceLevel >= 2) return true; - return false; - } - - public void dynamicLight(World world, EntityPlayer player) - { - world.setBlock((int)player.prevPosX, (int)player.prevPosY, (int)player.prevPosZ, Block.getBlockById(0)); - world.setBlock((int)player.posX, (int)player.posY, (int)player.posZ, BlockList.glow); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) - { - amplifier = 0; - if(cooldown > 0) cooldown--; - if (!world.isRemote){ - EntityPlayer entityplayer = (EntityPlayer) entity; - int posX = (int)Math.floor(entityplayer.posX), posY = (int)Math.floor(entityplayer.posY), posZ = (int)Math.floor(entityplayer.posZ); - - if (JewelryNBT.isJewelX(stack, new ItemStack(Items.diamond))) amplifier = 1; - else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.emerald))) amplifier = 2; - else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.nether_star))) amplifier = 7; - - if(JewelryNBT.isModifierX(stack, new ItemStack(Items.dye, 1, 15)) && world.getBlock(posX, posY - 1, posZ) == Blocks.farmland) - world.setBlockMetadataWithNotify(posX, posY - 1, posZ, 1, 7); - - if(JewelryNBT.isModeX(stack, "Activated")) - { - if (JewelryNBT.isModifierX(stack, new ItemStack(Items.blaze_powder)) && entityplayer != null) - entityplayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 4, amplifier, true)); - else if (JewelryNBT.isModifierX(stack, new ItemStack(Items.sugar)) && entityplayer != null) - { - entityplayer.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 4, amplifier, true)); - entityplayer.addExhaustion(0.05f*amplifier); - } - else if (JewelryNBT.isModifierX(stack, new ItemStack(Items.iron_pickaxe)) && entityplayer != null && !JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl))) - entityplayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 4, amplifier, true)); - else if (JewelryNBT.isModifierX(stack, new ItemStack(Items.feather)) && entityplayer != null) - { - entityplayer.addPotionEffect(new PotionEffect(Potion.jump.id, 4, amplifier, true)); - if(entityplayer.inventory.armorInventory[0] != null) - { - int damage = entityplayer.inventory.armorInventory[0].getMaxDamage() - entityplayer.inventory.armorInventory[0].getItemDamage(); - if(damage - entityplayer.fallDistance > 0){ - entityplayer.inventory.armorInventory[0].damageItem((int)entityplayer.fallDistance, entityplayer); - entityplayer.fallDistance = 0; - } - else - { - --entityplayer.inventory.armorInventory[0].stackSize; - entityplayer.fallDistance -= damage; - } - } - } - else if (JewelryNBT.isModifierX(stack, new ItemStack(Items.potionitem, 1, 8270)) && entityplayer != null) entityplayer.addPotionEffect(new PotionEffect(Potion.invisibility.id, 4, amplifier, true)); - } - if(entityplayer.inventory.getCurrentItem() != null && JewelryNBT.isJewelX(stack, new ItemStack(Items.nether_star)) && JewelryNBT.isModifierX(stack, new ItemStack(Items.book)) && entityplayer.inventory.getCurrentItem().getItem() == stack.getItem()) - { - ItemStack item = null; - if(entityplayer.inventory.currentItem + 1 <= 8 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1) != null && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1).isItemEnchanted()) item = entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1); - if(entityplayer.inventory.currentItem - 1 >= 0 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1) != null && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1).isItemEnchanted()) item = entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1); - if(item != null && JewelryNBT.isModeX(stack, "Disenchant")) - { - ItemStack enchBook = new ItemStack(Items.enchanted_book); - Map enchItem = EnchantmentHelper.getEnchantments(item); - Map book = EnchantmentHelper.getEnchantments(enchBook); - Iterator iterator = enchItem.keySet().iterator(); - int e; - - if (iterator.hasNext() && canDisenchant(entityplayer)) - { - e = ((Integer)iterator.next()).intValue(); - book.put(Integer.valueOf(e), Integer.valueOf(((Integer)enchItem.get(Integer.valueOf(e))).intValue())); - EnchantmentHelper.setEnchantments(book, enchBook); - if(entityplayer.inventory.addItemStackToInventory(enchBook)) - { - if(!entityplayer.capabilities.isCreativeMode) - { - entityplayer.addExperienceLevel(-2); - entityplayer.heal(-1f); - } - enchItem.remove(Integer.valueOf(e)); - if(item.isItemStackDamageable() && (item.getMaxDamage() - item.getItemDamage())/3 > 0) item.damageItem((item.getMaxDamage() - item.getItemDamage())/3, entityplayer); - EnchantmentHelper.setEnchantments(enchItem, item); - } - } - } - if(entityplayer.inventory.currentItem + 1 <= 8 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1) != null && entityplayer.inventory.currentItem - 1 >= 0 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1) != null && JewelryNBT.isModeX(stack, "Transfer")) - { - if(cooldown > 0) entityplayer.addChatMessage(new ChatComponentText("Ring is currently cooling down!")); - ItemStack enchantedItem = null, enchantableItem = null; - if(entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1).isItemEnchanted() && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1) != null) - { - enchantedItem = entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1); - enchantableItem = entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1); - - } - if(enchantedItem != null && enchantableItem != null) - { - Map enchItem = EnchantmentHelper.getEnchantments(enchantedItem); - Map resultItem = EnchantmentHelper.getEnchantments(enchantableItem); - Iterator iterator = enchItem.keySet().iterator(); - int e; - - if (iterator.hasNext() && cooldown == 0) - { - e = ((Integer)iterator.next()).intValue(); - if(!EnchantmentHelper.getEnchantments(enchantableItem).containsKey(Integer.valueOf(e))) - { - resultItem.put(Integer.valueOf(e), Integer.valueOf(((Integer)enchItem.get(Integer.valueOf(e))).intValue())); - EnchantmentHelper.setEnchantments(resultItem, enchantableItem); - enchItem.remove(Integer.valueOf(e)); - EnchantmentHelper.setEnchantments(enchItem, enchantedItem); - cooldown = 50000; - } - } - } - } - if(entityplayer.inventory.currentItem + 1 <= 8 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1) != null) item = entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1); - else if(entityplayer.inventory.currentItem - 1 >= 0 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1) != null) item = entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1); - if(item != null && !item.isItemEnchanted() && item.isItemEnchantable() && entityplayer.experienceLevel > 0 && JewelryNBT.isModeX(stack, "Enchant")) - { - Map enchItem = EnchantmentHelper.getEnchantments(item); - int level = entityplayer.experienceLevel; - if(entityplayer.experienceLevel > 6) level = 6; - if(!entityplayer.capabilities.isCreativeMode) entityplayer.addExperienceLevel(-level); - enchItem.put(Enchantment.enchantmentsBookList[new Random().nextInt(Enchantment.enchantmentsBookList.length)].effectId, level); - EnchantmentHelper.setEnchantments(enchItem, item); - } - } - } - } - - public ItemStack getModifiedItemStack(ItemStack ingot, ItemStack modifier, ItemStack jewel) - { - ItemStack itemstack = new ItemStack(this); - JewelryNBT.addMetal(itemstack, ingot); - JewelryNBT.addModifier(itemstack, modifier); - JewelryNBT.addJewel(itemstack, jewel); - if(JewelryNBT.isModifierEffectType(itemstack) && !(JewelryNBT.isJewelX(itemstack, new ItemStack(Items.ender_pearl)) && JewelryNBT.isModifierX(itemstack, new ItemStack(Items.iron_pickaxe)))) JewelryNBT.addMode(itemstack, "Activated"); - if(JewelryNBT.isJewelX(itemstack, new ItemStack(Items.nether_star)) && JewelryNBT.isModifierX(itemstack, new ItemStack(Items.book))) - JewelryNBT.addMode(itemstack, "Disenchant"); - return itemstack; - } - - public void createGolems(World world, int i, int j, int k) - { - if (world.getBlock(i, j - 1, k) == Blocks.snow && world.getBlock(i, j - 2, k) == Blocks.snow) - { - if (!world.isRemote) - { - world.setBlock(i, j, k, Block.getBlockById(0), 0, 2); - world.setBlock(i, j - 1, k, Block.getBlockById(0), 0, 2); - world.setBlock(i, j - 2, k, Block.getBlockById(0), 0, 2); - EntitySnowman entitysnowman = new EntitySnowman(world); - entitysnowman.setLocationAndAngles((double)i + 0.5D, (double)j - 1.95D, (double)k + 0.5D, 0.0F, 0.0F); - world.spawnEntityInWorld(entitysnowman); - world.notifyBlockChange(i, j, k, Block.getBlockById(0)); - world.notifyBlockChange(i, j - 1, k, Block.getBlockById(0)); - world.notifyBlockChange(i, j - 2, k, Block.getBlockById(0)); - } - - for (int l = 0; l < 120; ++l) - { - world.spawnParticle("snowshovel", (double)i + world.rand.nextDouble(), (double)(j - 2) + world.rand.nextDouble() * 2.5D, (double)k + world.rand.nextDouble(), 0.0D, 0.0D, 0.0D); - } - } - else if (world.getBlock(i, j - 1, k) == Blocks.iron_block && world.getBlock(i, j - 2, k) == Blocks.iron_block) - { - boolean flag = world.getBlock(i - 1, j - 1, k) == Blocks.iron_block && world.getBlock(i + 1, j - 1, k) == Blocks.iron_block; - boolean flag1 = world.getBlock(i, j - 1, k - 1) == Blocks.iron_block && world.getBlock(i, j - 1, k + 1) == Blocks.iron_block; - - if (flag || flag1) - { - world.setBlock(i, j, k, Block.getBlockById(0), 0, 2); - world.setBlock(i, j - 1, k, Block.getBlockById(0), 0, 2); - world.setBlock(i, j - 2, k, Block.getBlockById(0), 0, 2); - - if (flag) - { - world.setBlock(i - 1, j - 1, k, Block.getBlockById(0), 0, 2); - world.setBlock(i + 1, j - 1, k, Block.getBlockById(0), 0, 2); - } - else - { - world.setBlock(i, j - 1, k - 1, Block.getBlockById(0), 0, 2); - world.setBlock(i, j - 1, k + 1, Block.getBlockById(0), 0, 2); - } - - EntityIronGolem entityirongolem = new EntityIronGolem(world); - entityirongolem.setPlayerCreated(true); - entityirongolem.setLocationAndAngles((double)i + 0.5D, (double)j - 1.95D, (double)k + 0.5D, 0.0F, 0.0F); - world.spawnEntityInWorld(entityirongolem); - - for (int i1 = 0; i1 < 120; ++i1) - { - world.spawnParticle("snowballpoof", (double)i + world.rand.nextDouble(), (double)(j - 2) + world.rand.nextDouble() * 3.9D, (double)k + world.rand.nextDouble(), 0.0D, 0.0D, 0.0D); - } - - world.notifyBlockChange(i, j, k, Block.getBlockById(0)); - world.notifyBlockChange(i, j - 1, k, Block.getBlockById(0)); - world.notifyBlockChange(i, j - 2, k, Block.getBlockById(0)); - - if (flag) - { - world.notifyBlockChange(i - 1, j - 1, k, Block.getBlockById(0)); - world.notifyBlockChange(i + 1, j - 1, k, Block.getBlockById(0)); - } - else - { - world.notifyBlockChange(i, j - 1, k - 1, Block.getBlockById(0)); - world.notifyBlockChange(i, j - 1, k + 1, Block.getBlockById(0)); - } - } - } - } -} diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemThiefGloves.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemThiefGloves.java deleted file mode 100644 index f61085a..0000000 --- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/item/ItemThiefGloves.java +++ /dev/null @@ -1,113 +0,0 @@ -package darkknight.jewelrycraft.item; - -import java.util.Iterator; -import java.util.List; -import java.util.Random; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.passive.EntityVillager; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.village.MerchantRecipe; -import net.minecraft.village.MerchantRecipeList; - -import org.lwjgl.input.Keyboard; - -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.relauncher.ReflectionHelper; -import cpw.mods.fml.relauncher.Side; - -public class ItemThiefGloves extends Item -{ - public Random rand; - - public ItemThiefGloves() - { - super(); - this.setCreativeTab(CreativeTabs.tabTools); - this.setMaxStackSize(1); - this.setMaxDamage(10); - } - - @Override - public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase) - { - if (par3EntityLivingBase instanceof EntityVillager) - { - EntityVillager villager = (EntityVillager) par3EntityLivingBase; - int wealth = (Integer) ReflectionHelper.getPrivateValue(EntityVillager.class, villager, "wealth", "field_70956_bz"); - MerchantRecipeList buyingList = (MerchantRecipeList) ReflectionHelper.getPrivateValue(EntityVillager.class, villager, "buyingList", "field_70963_i"); - if (buyingList != null) - { - Iterator iterator = buyingList.iterator(); - while (iterator.hasNext()) - { - MerchantRecipe recipe = (MerchantRecipe) iterator.next(); - int toolUses = (Integer) ReflectionHelper.getPrivateValue(MerchantRecipe.class, recipe, "toolUses", "field_77400_d"); - int quantity; - if (recipe.getItemToSell().isStackable()) - quantity = recipe.getItemToSell().stackSize * (7 - toolUses); - else - quantity = 1; - ItemStack s = new ItemStack(recipe.getItemToSell().getItem(), quantity, recipe.getItemToSell().getItemDamage()); - s.setTagCompound(recipe.getItemToSell().getTagCompound()); - if (par2EntityPlayer.inventory.addItemStackToInventory(s)) - ; - else - villager.entityDropItem(s, 0); - par2EntityPlayer.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + ": Hmmm... I seem to have lost my " + s.getDisplayName() + "!")); - stack.damageItem(1, par2EntityPlayer); - } - buyingList.clear(); - ReflectionHelper.setPrivateValue(EntityVillager.class, villager, 300, "timeUntilReset", "field_70961_j"); - ReflectionHelper.setPrivateValue(EntityVillager.class, villager, true, "needsInitilization", "field_70959_by"); - } - - villager.dropItem(Items.emerald, wealth); - ReflectionHelper.setPrivateValue(EntityVillager.class, villager, 0, "wealth", "field_70956_bz"); - return true; - } - else - { - return super.itemInteractionForEntity(stack, par2EntityPlayer, par3EntityLivingBase); - } - } - - @Override - @SuppressWarnings("unchecked") - public void addInformation(ItemStack stack, EntityPlayer player, @SuppressWarnings("rawtypes") List list, boolean par4) - { - if (!shouldAddAdditionalInfo()) - list.add(EnumChatFormatting.GRAY + additionalInfoInstructions()); - else - { - list.add(EnumChatFormatting.GRAY + "Right click with the gloves,"); - list.add(EnumChatFormatting.GRAY + "while sneaking, on a villager"); - list.add(EnumChatFormatting.GRAY + "to steal his stuff."); - } - } - - public static boolean shouldAddAdditionalInfo() - { - if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) - { - if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) - { - return true; - } - } - return false; - } - - public static String additionalInfoInstructions() - { - String message = "\247oPress \247b\2477\247o for more information."; - return message; - } - -} -- cgit v1.2.3