use of net.minecraft.util.math.BlockPos in project RFToolsDimensions by McJty.
the class MaterialAbsorberTileEntity method writeToNBT.
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
super.writeToNBT(tagCompound);
int[] x = new int[toscan.size()];
int[] y = new int[toscan.size()];
int[] z = new int[toscan.size()];
int i = 0;
for (BlockPos c : toscan) {
x[i] = c.getX();
y[i] = c.getY();
z[i] = c.getZ();
i++;
}
tagCompound.setIntArray("toscanx", x);
tagCompound.setIntArray("toscany", y);
tagCompound.setIntArray("toscanz", z);
return tagCompound;
}
use of net.minecraft.util.math.BlockPos in project RFToolsDimensions by McJty.
the class DimensionBuilderBlock method addProbeInfo.
@Override
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) {
super.addProbeInfo(mode, probeInfo, player, world, blockState, data);
BlockPos pos = data.getPos();
TileEntity te = world.getTileEntity(pos);
if (te instanceof DimensionBuilderTileEntity) {
DimensionBuilderTileEntity tileEntity = (DimensionBuilderTileEntity) te;
NBTTagCompound tagCompound = tileEntity.hasTab();
if (tagCompound != null) {
int ticksLeft = tagCompound.getInteger("ticksLeft");
int tickCost = tagCompound.getInteger("tickCost");
int pct = (tickCost - ticksLeft) * 100 / tickCost;
TheOneProbeSupport.addDimensionElement(probeInfo.horizontal(), pct).text(pct + "%");
}
}
}
use of net.minecraft.util.math.BlockPos in project RFToolsDimensions by McJty.
the class LiquidAbsorberTileEntity method readFromNBT.
@Override
public void readFromNBT(NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
int[] x = tagCompound.getIntArray("toscanx");
int[] y = tagCompound.getIntArray("toscany");
int[] z = tagCompound.getIntArray("toscanz");
toscan.clear();
for (int i = 0; i < x.length; i++) {
toscan.add(new BlockPos(x[i], y[i], z[i]));
}
}
use of net.minecraft.util.math.BlockPos in project RFToolsDimensions by McJty.
the class MaterialAbsorberTileEntity method readFromNBT.
@Override
public void readFromNBT(NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
int[] x = tagCompound.getIntArray("toscanx");
int[] y = tagCompound.getIntArray("toscany");
int[] z = tagCompound.getIntArray("toscanz");
toscan.clear();
for (int i = 0; i < x.length; i++) {
toscan.add(new BlockPos(x[i], y[i], z[i]));
}
}
use of net.minecraft.util.math.BlockPos in project RFToolsDimensions by McJty.
the class MaterialAbsorberTileEntity method checkStateServer.
private void checkStateServer() {
if (absorbing > 0 || blockState == null) {
timer--;
if (timer <= 0) {
timer = ABSORB_SPEED;
IBlockState b = isValidSourceBlock(getPos().down());
if (b != null) {
if (blockState == null) {
absorbing = DimletConstructionConfiguration.maxBlockAbsorbtion;
if (b.getBlock() == Blocks.LIT_REDSTONE_ORE) {
b = Blocks.REDSTONE_ORE.getDefaultState();
}
if (Item.getItemFromBlock(b.getBlock()) != null) {
// Safety
blockState = b;
toscan.clear();
}
}
toscan.add(getPos().down());
}
if (!toscan.isEmpty()) {
int r = getWorld().rand.nextInt(toscan.size());
Iterator<BlockPos> iterator = toscan.iterator();
BlockPos c = null;
for (int i = 0; i <= r; i++) {
c = iterator.next();
}
toscan.remove(c);
checkBlock(c, EnumFacing.DOWN);
checkBlock(c, EnumFacing.UP);
checkBlock(c, EnumFacing.EAST);
checkBlock(c, EnumFacing.WEST);
checkBlock(c, EnumFacing.SOUTH);
checkBlock(c, EnumFacing.NORTH);
if (blockMatches(c)) {
SoundTools.playSound(getWorld(), blockState.getBlock().getSoundType().breakSound, getPos().getX(), getPos().getY(), getPos().getZ(), 1.0f, 1.0f);
getWorld().setBlockToAir(c);
absorbing--;
IBlockState state = getWorld().getBlockState(c);
getWorld().notifyBlockUpdate(c, state, state, 3);
}
}
}
markDirtyClient();
}
}
Aggregations