use of powercrystals.core.position.BlockPosition in project MineFactoryReloaded by powercrystals.
the class BlockRailCargoDropoff method onEntityCollidedWithBlock.
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if (world.isRemote || !(entity instanceof EntityMinecartContainer)) {
return;
}
IInventoryManager minecart = InventoryManager.create((EntityMinecartContainer) entity, ForgeDirection.UNKNOWN);
for (Entry<Integer, ItemStack> contents : minecart.getContents().entrySet()) {
if (contents.getValue() == null) {
continue;
}
ItemStack stackToAdd = contents.getValue().copy();
ItemStack remaining = UtilInventory.dropStack(world, new BlockPosition(x, y, z), contents.getValue(), ForgeDirection.VALID_DIRECTIONS, ForgeDirection.UNKNOWN);
if (remaining != null) {
stackToAdd.stackSize -= remaining.stackSize;
}
minecart.removeItem(stackToAdd.stackSize, stackToAdd);
}
}
use of powercrystals.core.position.BlockPosition in project MineFactoryReloaded by powercrystals.
the class BlockRedNetCable method breakBlock.
@Override
public void breakBlock(World world, int x, int y, int z, int id, int meta) {
TileEntity te = world.getBlockTileEntity(x, y, z);
if (te instanceof TileEntityRedNetCable && ((TileEntityRedNetCable) te).getNetwork() != null) {
((TileEntityRedNetCable) te).getNetwork().setInvalid();
}
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
BlockPosition bp = new BlockPosition(x, y, z);
bp.orientation = d;
bp.moveForwards(1);
world.notifyBlockOfNeighborChange(bp.x, bp.y, bp.z, MineFactoryReloadedCore.rednetCableBlock.blockID);
world.notifyBlocksOfNeighborChange(bp.x, bp.y, bp.z, MineFactoryReloadedCore.rednetCableBlock.blockID);
}
super.breakBlock(world, x, y, z, id, meta);
}
Aggregations