mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-20 03:59:56 +00:00
finished functionality packager
This commit is contained in:
1 parent
3d494de9bc
commit
6c5032f5d6
8 files changed
+237
-28
No files matched your search
@@ -1,18 +1,17 @@
|
||||
package makeo.gadomancy.common.blocks;
|
||||
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileArcanePackager;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileBlockProtector;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileManipulationFocus;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileManipulatorPillar;
|
||||
import makeo.gadomancy.common.blocks.tiles.*;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import makeo.gadomancy.common.utils.ItemUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -142,7 +141,28 @@ public class BlockStoneMachine extends Block {
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int metadata) {
|
||||
if (metadata == 1) {
|
||||
InventoryUtils.dropItems(world, x, y, z);
|
||||
} else if(metadata == 4) {
|
||||
if(!world.isRemote) {
|
||||
TileArcanePackager tile = (TileArcanePackager) world.getTileEntity(x, y, z);
|
||||
|
||||
for(int i = 0; i < tile.getSizeInventory(); i++) {
|
||||
ItemStack stack = tile.getStackInSlot(i);
|
||||
if(stack != null && stack.stackSize > 0) {
|
||||
float f = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + f, y + f1, z + f2, stack.copy());
|
||||
ItemUtils.applyRandomDropOffset(entityItem, world.rand);
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
tile.setInventorySlotContents(i, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
super.breakBlock(world, x, y, z, block, metadata);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user