parent
ed28182ba5
commit
cb91c531e4
|
@ -1,6 +1,8 @@
|
||||||
package net.shadowfacts.funnels;
|
package net.shadowfacts.funnels;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockLiquid;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@ -63,8 +65,6 @@ public class TileEntityFunnel extends BaseTileEntity implements ITickable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
world:
|
|
||||||
{
|
|
||||||
tick++;
|
tick++;
|
||||||
if (tick % 40 == 0) {
|
if (tick % 40 == 0) {
|
||||||
// pickup from world
|
// pickup from world
|
||||||
|
@ -75,7 +75,7 @@ public class TileEntityFunnel extends BaseTileEntity implements ITickable {
|
||||||
if (toDrain.amount <= tank.getCapacity() - tank.getFluidAmount()) {
|
if (toDrain.amount <= tank.getCapacity() - tank.getFluidAmount()) {
|
||||||
tank.fill(FluidUtils.drainFluidBlock(world, pos.up(), true), true);
|
tank.fill(FluidUtils.drainFluidBlock(world, pos.up(), true), true);
|
||||||
save();
|
save();
|
||||||
break world;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,8 @@ public class TileEntityFunnel extends BaseTileEntity implements ITickable {
|
||||||
FluidStack fluid = tank.getFluid();
|
FluidStack fluid = tank.getFluid();
|
||||||
if (fluid.getFluid().canBePlacedInWorld()) {
|
if (fluid.getFluid().canBePlacedInWorld()) {
|
||||||
Block fluidBlock = fluid.getFluid().getBlock();
|
Block fluidBlock = fluid.getFluid().getBlock();
|
||||||
|
if (fluidBlock instanceof BlockLiquid) fluidBlock = BlockLiquid.getFlowingBlock(fluidBlock.getMaterial(fluidBlock.getDefaultState()));
|
||||||
|
|
||||||
BlockPos newPos = pos.offset(world.getBlockState(pos).getValue(BlockFunnel.FACING));
|
BlockPos newPos = pos.offset(world.getBlockState(pos).getValue(BlockFunnel.FACING));
|
||||||
if (fluidBlock.canPlaceBlockAt(world, newPos)) {
|
if (fluidBlock.canPlaceBlockAt(world, newPos)) {
|
||||||
tank.drain(Fluid.BUCKET_VOLUME, true);
|
tank.drain(Fluid.BUCKET_VOLUME, true);
|
||||||
|
@ -95,7 +97,6 @@ public class TileEntityFunnel extends BaseTileEntity implements ITickable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tag) {
|
public void readFromNBT(NBTTagCompound tag) {
|
||||||
|
|
Loading…
Reference in New Issue