adding block placer
This commit is contained in:
parent
d0528087b4
commit
9bfcc10ed2
2 changed files with 32 additions and 1 deletions
|
@ -38,7 +38,7 @@ public class BlockTileBreaker extends TileInventory
|
|||
{
|
||||
getWorldObj().destroyBlock(x() + dir.offsetX, y() + dir.offsetY, z(), false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package resonantinduction.mechanical.blockeditor;
|
||||
|
||||
import calclavia.lib.content.module.prefab.TileInventory;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
/**
|
||||
* @since 18/03/14
|
||||
* @author tgame14
|
||||
*/
|
||||
public class BlockTilePlacer extends TileInventory
|
||||
{
|
||||
public BlockTilePlacer (String name, Material material)
|
||||
{
|
||||
super(name, material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeakRedstonePower (IBlockAccess access, int side)
|
||||
{
|
||||
int facing = access.getBlockMetadata(x(), y(), z());
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(facing);
|
||||
if (access.isAirBlock(x() + dir.offsetX, y() + dir.offsetY, z() + dir.offsetZ))
|
||||
{
|
||||
getWorldObj().setBlock(x() + dir.offsetX, y() + dir.offsetY, z() + dir.offsetZ, getInventory().getContainedItems()[0].getItem().itemID);
|
||||
}
|
||||
|
||||
return super.getWeakRedstonePower(access, side);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue