Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- import java.util.Random;
- import net.minecraft.client.Minecraft;
- public class FurnaceWhite extends BlockContainer
- {
- protected FurnaceWhite(int i, int j, boolean flag)
- {
- super(i, j, Material.rock);
- repairRand = new Random();
- isActive = flag;
- blockIndexInTexture = j;
- }
- public int getBlockTextureFromSideAndMetadata(int i, int j)
- {
- if(i == 1)
- {
- return blockIndexInTexture;
- }
- if(i == 0)
- {
- return blockIndexInTexture;
- }
- int k = mod_WhiteFurnace.WhitestoneFront;
- if(j == 2 && i == 2)
- {
- return k;
- }
- if(j == 3 && i == 5)
- {
- return k;
- }
- if(j == 0 && i == 3)
- {
- return k;
- }
- if(j == 1 && i == 4)
- {
- return k;
- } else
- {
- return mod_WhiteFurnace.WhitestoneSide;
- }
- }
- public int getBlockTextureFromSide(int i)
- {
- if(i == 1)
- {
- return blockIndexInTexture;
- }
- if(i == 0)
- {
- return blockIndexInTexture;
- }
- if(i == 3)
- {
- return mod_WhiteFurnace.WhitestoneFront;
- } else
- {
- return mod_WhiteFurnace.WhitestoneSide;
- }
- }
- public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving)
- {
- int l = MathHelper.floor_double((double)((entityliving.rotationYaw * 4F) / 360F) + 2.5D) & 3;
- world.setBlockMetadataWithNotify(i, j, k, l);
- }
- protected FurnaceWhite(int i, boolean flag)
- {
- super(i, Material.rock);
- repairRand = new Random();
- isActive = flag;
- }
- public int idDropped(int i, Random random)
- {
- return mod_WhiteFurnace.whitefurnace.blockID;
- }
- public void onBlockAdded(World world, int i, int j, int k)
- {
- super.onBlockAdded(world, i, j, k);
- }
- public void randomDisplayTick(World world, int i, int j, int k, Random random) // for some reason this doesn't work
- {
- if(!isActive)
- {
- return;
- }
- int l = world.getBlockMetadata(i, j, k);
- float f = (float)i + 0.5F;
- float f1 = (float)j + 0.0F + (random.nextFloat() * 6F) / 16F;
- float f2 = (float)k + 0.5F;
- float f3 = 0.52F;
- float f4 = random.nextFloat() * 0.6F - 0.3F;
- if(l == 4)
- {
- world.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
- world.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
- } else
- if(l == 5)
- {
- world.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
- world.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
- } else
- if(l == 2)
- {
- world.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
- world.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
- } else
- if(l == 3)
- {
- world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
- world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
- }
- }
- public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
- {
- if(world.multiplayerWorld)
- {
- return true;
- } else
- {
- TileEntityWhiteFurnace tileentitywhitefurnace = (TileEntityWhiteFurnace)world.getBlockTileEntity(i, j, k);
- ModLoader.OpenGUI(ModLoader.getMinecraftInstance().thePlayer, new Guiwhite(ModLoader.getMinecraftInstance().thePlayer.inventory, tileentitywhitefurnace));
- return true;
- }
- }
- public static void updateRepairBlockState(boolean flag, World world, int i, int j, int k)
- {
- int l = world.getBlockMetadata(i, j, k);
- TileEntity tileentity = world.getBlockTileEntity(i, j, k);
- keepRepairInventory = true;
- keepRepairInventory = false;
- world.setBlockMetadataWithNotify(i, j, k, l);
- tileentity.validate();
- world.setBlockTileEntity(i, j, k, tileentity);
- }
- public TileEntity getBlockEntity()
- {
- return new TileEntityWhiteFurnace();
- }
- public void onBlockRemoval(World world, int i, int j, int k)
- {
- if(!keepRepairInventory)
- {
- TileEntityWhiteFurnace tileentitywhitefurnace = (TileEntityWhiteFurnace)world.getBlockTileEntity(i, j, k);
- label0:
- for(int l = 0; l < tileentitywhitefurnace.getSizeInventory(); l++)
- {
- ItemStack itemstack = tileentitywhitefurnace.getStackInSlot(l);
- if(itemstack == null)
- {
- continue;
- }
- float f = repairRand.nextFloat() * 0.8F + 0.1F;
- float f1 = repairRand.nextFloat() * 0.8F + 0.1F;
- float f2 = repairRand.nextFloat() * 0.8F + 0.1F;
- do
- {
- if(itemstack.stackSize <= 0)
- {
- continue label0;
- }
- int i1 = repairRand.nextInt(21) + 10;
- if(i1 > itemstack.stackSize)
- {
- i1 = itemstack.stackSize;
- }
- itemstack.stackSize -= i1;
- EntityItem entityitem = new EntityItem(world, (float)i + f, (float)j + f1, (float)k + f2, new ItemStack(itemstack.itemID, i1, itemstack.getItemDamage()));
- float f3 = 0.05F;
- entityitem.motionX = (float)repairRand.nextGaussian() * f3;
- entityitem.motionY = (float)repairRand.nextGaussian() * f3 + 0.2F;
- entityitem.motionZ = (float)repairRand.nextGaussian() * f3;
- world.entityJoinedWorld(entityitem);
- } while(true);
- }
- }
- super.onBlockRemoval(world, i, j, k);
- }
- private Random repairRand;
- private final boolean isActive;
- public EntityPlayer entityplayer;
- private static boolean keepRepairInventory = false;
- }
Add Comment
Please, Sign In to add comment