I basically want to make a new chest, without the animation, and with 9 slots. Pretty much an inoperable dispenser.
This is my Block code:
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
import java.util.Random;
// Referenced classes of package net.minecraft.src:
// BlockContainer, Material, Block, World,
// IBlockAccess, EntityPlayer, ItemStack,
// ModLoader, Item, EntityArrow, EntityEgg,
// EntitySnowball, EntityItem, EntityLiving, MathHelper,
// TileEntity
public class BlockXmasPresent extends BlockContainer
{
protected BlockXmasPresent(int i)
{
super(i, Material.rock);
random = new Random();
blockIndexInTexture = 45;
blockIndexInTexture2 = 0;
}
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(i == 5)
{
return blockIndexInTexture;
}
if(i == 4)
{
return blockIndexInTexture;
}
if(i == 3)
{
return blockIndexInTexture;
}
if(i == 2)
{
return blockIndexInTexture;
}
if(i == 1)
{
return blockIndexInTexture2;
}
if(i == 0)
{
return blockIndexInTexture;
}
return 0;
}
public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
{
TileEntityPresent tileentitypresent = (TileEntityPresent)world.getBlockTileEntity(i, j, k);
if(tileentitypresent != null)
{
ModLoader.OpenGUI(entityplayer, new GuiPresent(entityplayer.inventory, tileentitypresent));
}
return true;
}
public TileEntity getBlockEntity()
{
return new TileEntityPresent();
}
public void onBlockRemoval(World world, int i, int j, int k)
{
TileEntityPresent tileentitypresent = (TileEntityPresent)world.getBlockTileEntity(i, j, k);
if(tileentitypresent != null)
{
for(int l = 0; l < tileentitypresent.getSizeInventory(); l++)
{
ItemStack itemstack = tileentitypresent.getStackInSlot(l);
if(itemstack != null)
{
float f = 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 i1 = random.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)random.nextGaussian() * f3;
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
entityitem.motionZ = (float)random.nextGaussian() * f3;
world.entityJoinedWorld(entityitem);
}
}
}
}
super.onBlockRemoval(world, i, j, k);
}
private Random random;
public static int blockIndexInTexture2;
}
The TileEntity file is the exact same as the DIspenser's, just with the word dispenser replaced everywhere. Same with the GUI file, and the Container file.
Still, when I right click the block, it crashes with a "Saving chunks" error. Anyone know what's going on?
I basically want to make a new chest, without the animation, and with 9 slots. Pretty much an inoperable dispenser.
This is my Block code:
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
import java.util.Random;
// Referenced classes of package net.minecraft.src:
// BlockContainer, Material, Block, World,
// IBlockAccess, EntityPlayer, ItemStack,
// ModLoader, Item, EntityArrow, EntityEgg,
// EntitySnowball, EntityItem, EntityLiving, MathHelper,
// TileEntity
public class BlockXmasPresent extends BlockContainer
{
protected BlockXmasPresent(int i)
{
super(i, Material.rock);
random = new Random();
blockIndexInTexture = 45;
blockIndexInTexture2 = 0;
}
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(i == 5)
{
return blockIndexInTexture;
}
if(i == 4)
{
return blockIndexInTexture;
}
if(i == 3)
{
return blockIndexInTexture;
}
if(i == 2)
{
return blockIndexInTexture;
}
if(i == 1)
{
return blockIndexInTexture2;
}
if(i == 0)
{
return blockIndexInTexture;
}
return 0;
}
public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
{
TileEntityPresent tileentitypresent = (TileEntityPresent)world.getBlockTileEntity(i, j, k);
if(tileentitypresent != null)
{
ModLoader.OpenGUI(entityplayer, new GuiPresent(entityplayer.inventory, tileentitypresent));
}
return true;
}
public TileEntity getBlockEntity()
{
return new TileEntityPresent();
}
public void onBlockRemoval(World world, int i, int j, int k)
{
TileEntityPresent tileentitypresent = (TileEntityPresent)world.getBlockTileEntity(i, j, k);
if(tileentitypresent != null)
{
for(int l = 0; l < tileentitypresent.getSizeInventory(); l++)
{
ItemStack itemstack = tileentitypresent.getStackInSlot(l);
if(itemstack != null)
{
float f = 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 i1 = random.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)random.nextGaussian() * f3;
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
entityitem.motionZ = (float)random.nextGaussian() * f3;
world.entityJoinedWorld(entityitem);
}
}
}
}
super.onBlockRemoval(world, i, j, k);
}
private Random random;
public static int blockIndexInTexture2;
}
The TileEntity file is the exact same as the DIspenser's, just with the word dispenser replaced everywhere. Same with the GUI file, and the Container file.
Still, when I right click the block, it crashes with a "Saving chunks" error. Anyone know what's going on?
Can you give us an error report of some kind? Run in a command prompt or give us the modloader.txt
Cant really tell what your error is :/
Can you give us an error report of some kind? Run in a command prompt or give us the modloader.txt
Cant really tell what your error is :/
Can you tell me how to do that? It tells me it is a corrupt jar file whenever I try to use Terminal to launch a modded jar. Also, modloader.txt does not yield any error.
Edit: Console tells me the problem is in the Container file, line 46, the canInteractWith function.
Can you tell me how to do that? It tells me it is a corrupt jar file whenever I try to use Terminal to launch a modded jar. Also, modloader.txt does not yield any error.
Edit: Console tells me the problem is in the Container file, line 46, the canInteractWith function.
Boolean METHODS (not functions)
return true or false. If the value is null, and it returns null, everything else is going to use null when it was probably programmed for a true or false statement. Investigate this.
This is my Block code:
The TileEntity file is the exact same as the DIspenser's, just with the word dispenser replaced everywhere. Same with the GUI file, and the Container file.
Still, when I right click the block, it crashes with a "Saving chunks" error. Anyone know what's going on?
Can you give us an error report of some kind? Run in a command prompt or give us the modloader.txt
Cant really tell what your error is :/
Can you tell me how to do that? It tells me it is a corrupt jar file whenever I try to use Terminal to launch a modded jar. Also, modloader.txt does not yield any error.
Edit: Console tells me the problem is in the Container file, line 46, the canInteractWith function.
Boolean METHODS (not functions)
return true or false. If the value is null, and it returns null, everything else is going to use null when it was probably programmed for a true or false statement. Investigate this.
FAIL