public static bool areItemStacksEqual(ItemStack itemstack, ItemStack itemstack1) { if (itemstack == null && itemstack1 == null) { return true; } if (itemstack == null || itemstack1 == null) { return false; } else { return itemstack.isItemStackEqual(itemstack1); } }
public override void readPacketData(DataInputStream datainputstream) { windowId = datainputstream.readByte(); short word0 = datainputstream.readShort(); itemStack = new ItemStack[word0]; for (int i = 0; i < word0; i++) { short word1 = datainputstream.readShort(); if (word1 >= 0) { byte byte0 = datainputstream.readByte(); short word2 = datainputstream.readShort(); itemStack[i] = new ItemStack(word1, byte0, word2); } } }
public EntityItem(World world, double d, double d1, double d2, ItemStack itemstack) : base(world) { age = 0; health = 5; field_432_ae = (float) (Math.random()*3.1415926535897931D*2D); setSize(0.25F, 0.25F); yOffset = height/2.0F; setPosition(d, d1, d2); item = itemstack; rotationYaw = (float) (Math.random()*360D); motionX = (float) (Math.random()*0.20000000298023224D - 0.10000000149011612D); motionY = 0.20000000298023224D; motionZ = (float) (Math.random()*0.20000000298023224D - 0.10000000149011612D); entityWalks = false; }
public override void readPacketData(DataInputStream datainputstream) { window_Id = datainputstream.readByte(); inventorySlot = datainputstream.readShort(); mouseClick = datainputstream.readByte(); action = datainputstream.readShort(); short word0 = datainputstream.readShort(); if (word0 >= 0) { byte byte0 = datainputstream.readByte(); short word1 = datainputstream.readShort(); itemStack = new ItemStack(word0, byte0, word1); } else { itemStack = null; } }
public override void readPacketData(DataInputStream datainputstream) { xPosition = datainputstream.readInt(); yPosition = datainputstream.read(); zPosition = datainputstream.readInt(); direction = datainputstream.read(); short word0 = datainputstream.readShort(); if (word0 >= 0) { byte byte0 = datainputstream.readByte(); short word1 = datainputstream.readShort(); itemStack = new ItemStack(word0, byte0, word1); } else { itemStack = null; } }
private bool isItemStackEqual(ItemStack itemstack) { if (stackSize != itemstack.stackSize) { return false; } if (itemID != itemstack.itemID) { return false; } return itemDamage == itemstack.itemDamage; }
public bool isItemEqual(ItemStack itemstack) { return itemID == itemstack.itemID && itemDamage == itemstack.itemDamage; }
public virtual EntityItem entityDropItem(ItemStack itemstack, float f) { var entityitem = new EntityItem(worldObj, posX, posY + f, posZ, itemstack); entityitem.delayBeforeCanPickup = 10; worldObj.entityJoinedWorld(entityitem); return entityitem; }
public virtual void onItemStackChanged(ItemStack itemstack) { }
public override bool generate(World world, Random random, int i, int j, int k) { byte byte0 = 3; int l = random.nextInt(2) + 2; int i1 = random.nextInt(2) + 2; int j1 = 0; for (int k1 = i - l - 1; k1 <= i + l + 1; k1++) { for (int j2 = j - 1; j2 <= j + byte0 + 1; j2++) { for (int i3 = k - i1 - 1; i3 <= k + i1 + 1; i3++) { Material material = world.getBlockMaterial(k1, j2, i3); if (j2 == j - 1 && !material.isSolid()) { return(false); } if (j2 == j + byte0 + 1 && !material.isSolid()) { return(false); } if ((k1 == i - l - 1 || k1 == i + l + 1 || i3 == k - i1 - 1 || i3 == k + i1 + 1) && j2 == j && world.isAirBlock(k1, j2, i3) && world.isAirBlock(k1, j2 + 1, i3)) { j1++; } } } } if (j1 < 1 || j1 > 5) { return(false); } for (int l1 = i - l - 1; l1 <= i + l + 1; l1++) { for (int k2 = j + byte0; k2 >= j - 1; k2--) { for (int j3 = k - i1 - 1; j3 <= k + i1 + 1; j3++) { if (l1 == i - l - 1 || k2 == j - 1 || j3 == k - i1 - 1 || l1 == i + l + 1 || k2 == j + byte0 + 1 || j3 == k + i1 + 1) { if (k2 >= 0 && !world.getBlockMaterial(l1, k2 - 1, j3).isSolid()) { world.setBlockWithNotify(l1, k2, j3, 0); continue; } if (!world.getBlockMaterial(l1, k2, j3).isSolid()) { continue; } if (k2 == j - 1 && random.nextInt(4) != 0) { world.setBlockWithNotify(l1, k2, j3, Block.cobblestoneMossy.blockID); } else { world.setBlockWithNotify(l1, k2, j3, Block.cobblestone.blockID); } } else { world.setBlockWithNotify(l1, k2, j3, 0); } } } } for (int i2 = 0; i2 < 2; i2++) { for (int l2 = 0; l2 < 3; l2++) { int k3 = (i + random.nextInt(l * 2 + 1)) - l; int l3 = j; int i4 = (k + random.nextInt(i1 * 2 + 1)) - i1; if (!world.isAirBlock(k3, l3, i4)) { continue; } int j4 = 0; if (world.getBlockMaterial(k3 - 1, l3, i4).isSolid()) { j4++; } if (world.getBlockMaterial(k3 + 1, l3, i4).isSolid()) { j4++; } if (world.getBlockMaterial(k3, l3, i4 - 1).isSolid()) { j4++; } if (world.getBlockMaterial(k3, l3, i4 + 1).isSolid()) { j4++; } if (j4 != 1) { continue; } world.setBlockWithNotify(k3, l3, i4, Block.crate.blockID); var tileentitychest = (TileEntityChest)world.getBlockTileEntity(k3, l3, i4); int k4 = 0; do { if (k4 >= 8) { goto label0; } ItemStack itemstack = pickCheckLootItem(random); if (itemstack != null) { tileentitychest.setInventorySlotContents( random.nextInt(tileentitychest.getSizeInventory()), itemstack); } k4++; } while (true); } label0: ; } world.setBlockWithNotify(i, j, k, Block.mobSpawner.blockID); var tileentitymobspawner = (TileEntityMobSpawner)world.getBlockTileEntity(i, j, k); tileentitymobspawner.setMobID(pickMobSpawner(random)); return(true); }
public override ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { float f = 1.0F; float f1 = entityplayer.prevRotationPitch + (entityplayer.rotationPitch - entityplayer.prevRotationPitch)*f; float f2 = entityplayer.prevRotationYaw + (entityplayer.rotationYaw - entityplayer.prevRotationYaw)*f; double d = entityplayer.prevPosX + (entityplayer.posX - entityplayer.prevPosX)*f; double d1 = (entityplayer.prevPosY + (entityplayer.posY - entityplayer.prevPosY)*f + 1.6200000000000001D) - entityplayer.yOffset; double d2 = entityplayer.prevPosZ + (entityplayer.posZ - entityplayer.prevPosZ)*f; Vec3D vec3d = Vec3D.createVector(d, d1, d2); float f3 = MathHelper.cos(-f2*0.01745329F - 3.141593F); float f4 = MathHelper.sin(-f2*0.01745329F - 3.141593F); float f5 = -MathHelper.cos(-f1*0.01745329F); float f6 = MathHelper.sin(-f1*0.01745329F); float f7 = f4*f5; float f8 = f6; float f9 = f3*f5; double d3 = 5D; Vec3D vec3d1 = vec3d.addVector(f7*d3, f8*d3, f9*d3); MovingObjectPosition movingobjectposition = world.rayTraceBlocks_do(vec3d, vec3d1, isFull == 0); if (movingobjectposition == null) { return itemstack; } if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) { int i = movingobjectposition.blockX; int j = movingobjectposition.blockY; int k = movingobjectposition.blockZ; if (!world.canMineBlock(entityplayer, i, j, k)) { return itemstack; } if (isFull == 0) { if (world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0) { world.setBlockWithNotify(i, j, k, 0); return new ItemStack(bucketWater); } if (world.getBlockMaterial(i, j, k) == Material.lava && world.getBlockMetadata(i, j, k) == 0) { world.setBlockWithNotify(i, j, k, 0); return new ItemStack(bucketLava); } } else { if (isFull < 0) { return new ItemStack(bucketEmpty); } 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 (world.isAirBlock(i, j, k) || !world.getBlockMaterial(i, j, k).isSolid()) { if (world.worldProvider.isHellWorld && isFull == Block.waterStill.blockID) { world.playSoundEffect(d + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat())*0.8F); for (int l = 0; l < 8; l++) { world.spawnParticle("largesmoke", i + Math.random(), j + Math.random(), k + Math.random(), 0.0D, 0.0D, 0.0D); } } else { world.setBlockAndMetadataWithNotify(i, j, k, isFull, 0); } return new ItemStack(bucketEmpty); } } } else if (isFull == 0 && (movingobjectposition.entityHit is EntityCow)) { return new ItemStack(bucketMilk); } return itemstack; }
public void dropPlayerItem(ItemStack itemstack) { dropPlayerItemWithRandomChoice(itemstack, false); }
public void setInventorySlotContents(int i, ItemStack itemstack) { dispenserContents[i] = itemstack; if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { itemstack.stackSize = getInventoryStackLimit(); } onInventoryChanged(); }
public void addSmelting(int i, ItemStack itemstack) { smeltingList.put(Integer.valueOf(i), itemstack); }
public override void readFromNBT(NBTTagCompound nbttagcompound) { base.readFromNBT(nbttagcompound); NBTTagList nbttaglist = nbttagcompound.getTagList("Items"); dispenserContents = new ItemStack[getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); i++) { var nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i); int j = nbttagcompound1.getByte("Slot") & 0xff; if (j >= 0 && j < dispenserContents.Length) { dispenserContents[j] = new ItemStack(nbttagcompound1); } } }
public void addShapelessRecipe(ItemStack itemstack, object[] aobj) { var arraylist = new ArrayList(); object[] aobj1 = aobj; int i = aobj1.Length; for (int j = 0; j < i; j++) { object obj = aobj1[j]; if (obj is ItemStack) { arraylist.add(((ItemStack) obj).copy()); continue; } if (obj is Item) { arraylist.add(new ItemStack((Item) obj)); continue; } if (obj is Block) { arraylist.add(new ItemStack((Block) obj)); } else { throw new RuntimeException("Invalid shapeless recipy!"); } } recipes.add(new ShapelessRecipes(itemstack, arraylist)); }
public void addRecipe(ItemStack itemstack, object[] aobj) { string s = ""; int i = 0; int j = 0; int k = 0; if (aobj[i] is string[]) { var ask = (string[]) aobj[i++]; for (int l = 0; l < ask.Length; l++) { string s2 = ask[l]; k++; j = s2.Length; s = (new StringBuilder()).append(s).append(s2).toString(); } } else { while (aobj[i] is string) { var s1 = (string) aobj[i++]; k++; j = s1.Length; s = (new StringBuilder()).append(s).append(s1).toString(); } } var hashmap = new HashMap(); for (; i < aobj.Length; i += 2) { var character = (Character) aobj[i]; ItemStack itemstack1 = null; if (aobj[i + 1] is Item) { itemstack1 = new ItemStack((Item) aobj[i + 1]); } else if (aobj[i + 1] is Block) { itemstack1 = new ItemStack((Block) aobj[i + 1], 1, -1); } else if (aobj[i + 1] is ItemStack) { itemstack1 = (ItemStack) aobj[i + 1]; } hashmap.put(character, itemstack1); } var aitemstack = new ItemStack[j*k]; for (int i1 = 0; i1 < j*k; i1++) { char c = s[i1]; if (hashmap.containsKey(Character.valueOf(c))) { aitemstack[i1] = ((ItemStack) hashmap.get(Character.valueOf(c))).copy(); } else { aitemstack[i1] = null; } } recipes.add(new ShapedRecipes(j, k, aitemstack, itemstack)); }
public virtual ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { return itemstack; }
public virtual bool onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { return false; }
public static ItemStack func_20117_a(ItemStack itemstack) { return itemstack != null ? itemstack.copy() : null; }
public virtual void hitBlock(ItemStack itemstack, int i, int j, int k, int l) { }
public void dropPlayerItemWithRandomChoice(ItemStack itemstack, bool flag) { if (itemstack == null) { return; } var entityitem = new EntityItem(worldObj, posX, (posY - 0.30000001192092896D) + getEyeHeight(), posZ, itemstack); entityitem.delayBeforeCanPickup = 40; float f = 0.1F; if (flag) { float f2 = rand.nextFloat()*0.5F; float f4 = rand.nextFloat()*3.141593F*2.0F; entityitem.motionX = -MathHelper.sin(f4)*f2; entityitem.motionZ = MathHelper.cos(f4)*f2; entityitem.motionY = 0.20000000298023224D; } else { float f1 = 0.3F; entityitem.motionX = -MathHelper.sin((rotationYaw/180F)*3.141593F)* MathHelper.cos((rotationPitch/180F)*3.141593F)*f1; entityitem.motionZ = MathHelper.cos((rotationYaw/180F)*3.141593F)* MathHelper.cos((rotationPitch/180F)*3.141593F)*f1; entityitem.motionY = -MathHelper.sin((rotationPitch/180F)*3.141593F)*f1 + 0.1F; f1 = 0.02F; float f3 = rand.nextFloat()*3.141593F*2.0F; f1 *= rand.nextFloat(); entityitem.motionX += Math.cos(f3)*f1; entityitem.motionY += (rand.nextFloat() - rand.nextFloat())*0.1F; entityitem.motionZ += Math.sin(f3)*f1; } joinEntityItemWithWorld(entityitem); }
public void setInventorySlotContents(int i, ItemStack itemstack) { cargoItems[i] = itemstack; if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { itemstack.stackSize = getInventoryStackLimit(); } }
public override void readEntityFromNBT(NBTTagCompound nbttagcompound) { health = nbttagcompound.getShort("Health") & 0xff; age = nbttagcompound.getShort("Age"); NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Item"); item = new ItemStack(nbttagcompound1); }
public virtual void saddleEntity(ItemStack itemstack, EntityLiving entityliving) { }
public override void readEntityFromNBT(NBTTagCompound nbttagcompound) { minecartType = nbttagcompound.getInteger("Type"); if (minecartType == 2) { pushX = nbttagcompound.getDouble("PushX"); pushZ = nbttagcompound.getDouble("PushZ"); fuel = nbttagcompound.getShort("Fuel"); } else if (minecartType == 1) { NBTTagList nbttaglist = nbttagcompound.getTagList("Items"); cargoItems = new ItemStack[getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); i++) { var nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i); int j = nbttagcompound1.getByte("Slot") & 0xff; if (j >= 0 && j < cargoItems.Length) { cargoItems[j] = new ItemStack(nbttagcompound1); } } } }
public virtual float getStrVsBlock(ItemStack itemstack, Block block) { return 1.0F; }