mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Made the ESD always only drop its first slot. Fixes https://github.com/Ellpeck/ActuallyAdditions/issues/11
This commit is contained in:
parent
ed842e6fe4
commit
935ca93c0f
1 changed files with 25 additions and 1 deletions
|
@ -15,16 +15,19 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import ellpeck.actuallyadditions.ActuallyAdditions;
|
||||
import ellpeck.actuallyadditions.inventory.GuiHandler;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityInputter;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityInventoryBase;
|
||||
import ellpeck.actuallyadditions.util.INameableItem;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import ellpeck.actuallyadditions.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -75,7 +78,28 @@ public class BlockInputter extends BlockContainerBase implements INameableItem{
|
|||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
if(!world.isRemote){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TileEntityInventoryBase){
|
||||
TileEntityInventoryBase tileEntity = (TileEntityInventoryBase)tile;
|
||||
Random rand = new Random();
|
||||
|
||||
ItemStack itemStack = tileEntity.getStackInSlot(0);
|
||||
if(itemStack != null && itemStack.stackSize > 0){
|
||||
float dX = rand.nextFloat()*0.8F+0.1F;
|
||||
float dY = rand.nextFloat()*0.8F+0.1F;
|
||||
float dZ = rand.nextFloat()*0.8F+0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x+dX, y+dY, z+dZ, itemStack.copy());
|
||||
if(itemStack.hasTagCompound()) entityItem.getEntityItem().setTagCompound((NBTTagCompound)itemStack.getTagCompound().copy());
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian()*factor;
|
||||
entityItem.motionY = rand.nextGaussian()*factor+0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian()*factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
itemStack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue