Java Code Examples for net.minecraft.world.World.func_147453_f()

The following are Jave code examples for showing how to use func_147453_f() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Technical   File: Machine.java   Source Code and License Vote up 5 votes
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
	if (!isBurning) {
		TileEntityMachine tileEntity = (TileEntityMachine) world.getTileEntity(x, y, z);
		if (tileEntity != null) {
			for (int i = 0; i < tileEntity.getSizeInventory(); ++i) {
				ItemStack itemStack = tileEntity.getStackInSlot(i);

				if (itemStack != null) {
					float f0 = random.nextFloat() * 0.8F + 0.1F;
					float f1 = random.nextFloat() * 0.8F + 0.1F;
					float f2 = random.nextFloat() * 0.8F + 0.1F;

					while (itemStack.stackSize > 0) {
						int j = random.nextInt(21) + 10;

						if (j > itemStack.stackSize)
							j = itemStack.stackSize;

						itemStack.stackSize -= j;

						EntityItem entityItem = new EntityItem(world, (double) ((float) x + f1), (double) ((float) y + f0), (double) ((float) z + f2), new ItemStack(itemStack.getItem(), j));

						if (itemStack.hasTagCompound())
							entityItem.getEntityItem().setTagCompound(((NBTTagCompound) itemStack.getTagCompound().copy()));

						float f3 = 0.025F;
						entityItem.motionX = (double) ((float) random.nextGaussian() * f3);
						entityItem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.1F);
						entityItem.motionZ = (double) ((float) random.nextGaussian() * f3);
						world.spawnEntityInWorld(entityItem);
					}
				}
			}
			world.func_147453_f(x, y, z, block);
		}
	}
	super.breakBlock(world, x, y, z, block, meta);
}
 
Example 2
Project: Technical   File: Auto.java   Source Code and License Vote up 5 votes
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
	TileEntityAuto tileEntity = (TileEntityAuto) world.getTileEntity(x, y, z);
	if(tileEntity != null) {
		for(int i = 0; i < tileEntity.getSizeInventory(); ++i) {
			ItemStack itemStack = tileEntity.getStackInSlot(i);

			if(itemStack != null) {
				float f0 = random.nextFloat() * 0.8F + 0.1F;
				float f1 = random.nextFloat() * 0.8F + 0.1F;
				float f2 = random.nextFloat() * 0.8F + 0.1F;

				while(itemStack.stackSize > 0) {
					int j = random.nextInt(21) + 10;

					if(j > itemStack.stackSize)
						j = itemStack.stackSize;

					itemStack.stackSize -= j;

					EntityItem entityItem = new EntityItem(world, (double) ((float) x + f1), (double) ((float) y + f0), (double) ((float) z + f2), new ItemStack(itemStack.getItem(), j));

					if(itemStack.hasTagCompound())
						entityItem.getEntityItem().setTagCompound(((NBTTagCompound) itemStack.getTagCompound().copy()));

					float f3 = 0.025F;
					entityItem.motionX = (double) ((float) random.nextGaussian() * f3);
					entityItem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.1F);
					entityItem.motionZ = (double) ((float) random.nextGaussian() * f3);
					world.spawnEntityInWorld(entityItem);
				}
			}
		}
		world.func_147453_f(x, y, z, block);
	}
	super.breakBlock(world, x, y, z, block, meta);
}
 
Example 3
Project: ElementalElaboration   File: IBlockWithInventory.java   Source Code and License Vote up 4 votes
default void breakBlockWithInventory(World world, int x, int y, int z, Block oldblock, int oldMetadata)
{
    if(!keepInventory)
    {
        TileKTWithInventory tileentity = (TileKTWithInventory) world.getTileEntity(x, y, z);

        if(tileentity != null)
        {
            for(int i = 0; i < tileentity.getSizeInventory(); i++)
            {
                ItemStack itemstack = tileentity.getStackInSlot(i);

                if(itemstack != null)
                {
                    float f = this.rand.nextFloat() * 0.8F + 0.1F;
                    float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
                    float f2 = this.rand.nextFloat() * 0.8F + 0.1F;

                    while(itemstack.stackSize > 0)
                    {
                        int j = this.rand.nextInt(21) + 10;

                        if(j > itemstack.stackSize)
                            j = itemstack.stackSize;

                        itemstack.stackSize -= j;

                        EntityItem item = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));

                        if(itemstack.hasTagCompound())
                            item.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());

                        world.spawnEntityInWorld(item);
                    }
                }
            }
            //Maybe this fucntion is about to replace block without meta data
            world.func_147453_f(x, y, z, oldblock);
        }
    }
    else
    {
        //some code to keep inventory
    }
}