Fix stuff
This commit is contained in:
parent
f93eac4a87
commit
5eb211828a
|
@ -1,4 +1,4 @@
|
||||||
mod_version = 1.0.0
|
mod_version = 1.0.1
|
||||||
group = net.shadowfacts
|
group = net.shadowfacts
|
||||||
archivesBaseName = Funnels
|
archivesBaseName = Funnels
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class FunnelsConfig {
|
||||||
static Configuration config;
|
static Configuration config;
|
||||||
|
|
||||||
@Config.Prop
|
@Config.Prop
|
||||||
public static int size = 4000;
|
public static int size = 1000;
|
||||||
|
|
||||||
@Config.Prop
|
@Config.Prop
|
||||||
public static boolean pickupWorldFluids = true;
|
public static boolean pickupWorldFluids = true;
|
||||||
|
|
|
@ -34,6 +34,20 @@ public class TileEntityFunnel extends BaseTileEntity implements ITickable {
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
|
handlers:
|
||||||
|
{
|
||||||
|
// up handler -> tank
|
||||||
|
if (tank.getFluidAmount() < tank.getCapacity()) {
|
||||||
|
BlockPos handlerPos = pos.up();
|
||||||
|
TileEntity te = worldObj.getTileEntity(handlerPos);
|
||||||
|
if (te != null && te.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.DOWN)) {
|
||||||
|
IFluidHandler handler = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.DOWN);
|
||||||
|
tank.fill(handler.drain(tank.getCapacity() - tank.getFluidAmount(), true), true);
|
||||||
|
save();
|
||||||
|
break handlers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// tank -> front handler
|
||||||
if (tank.getFluidAmount() > 0) {
|
if (tank.getFluidAmount() > 0) {
|
||||||
EnumFacing facing = worldObj.getBlockState(pos).getValue(BlockFunnel.FACING);
|
EnumFacing facing = worldObj.getBlockState(pos).getValue(BlockFunnel.FACING);
|
||||||
BlockPos handlerPos = pos.offset(facing);
|
BlockPos handlerPos = pos.offset(facing);
|
||||||
|
@ -44,19 +58,25 @@ public class TileEntityFunnel extends BaseTileEntity implements ITickable {
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
world:
|
||||||
|
{
|
||||||
tick++;
|
tick++;
|
||||||
if (tick % 40 == 0) {
|
if (tick % 40 == 0) {
|
||||||
if (FunnelsConfig.pickupWorldFluids) {
|
// pickup from world
|
||||||
|
if (FunnelsConfig.pickupWorldFluids && tank.getFluidAmount() <= tank.getCapacity() - Fluid.BUCKET_VOLUME) {
|
||||||
tick = 0;
|
tick = 0;
|
||||||
if (FluidUtils.isFluidBlock(worldObj, pos.up())) {
|
if (FluidUtils.isFluidBlock(worldObj, pos.up())) {
|
||||||
FluidStack toDrain = FluidUtils.drainFluidBlock(worldObj, pos.up(), false);
|
FluidStack toDrain = FluidUtils.drainFluidBlock(worldObj, pos.up(), false);
|
||||||
if (toDrain.amount <= tank.getCapacity() - tank.getFluidAmount()) {
|
if (toDrain.amount <= tank.getCapacity() - tank.getFluidAmount()) {
|
||||||
tank.fill(FluidUtils.drainFluidBlock(worldObj, pos.up(), true), true);
|
tank.fill(FluidUtils.drainFluidBlock(worldObj, pos.up(), true), true);
|
||||||
save();
|
save();
|
||||||
|
break world;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
// place in world
|
||||||
if (FunnelsConfig.placeFluidsInWorld && tank.getFluidAmount() >= Fluid.BUCKET_VOLUME) {
|
if (FunnelsConfig.placeFluidsInWorld && tank.getFluidAmount() >= Fluid.BUCKET_VOLUME) {
|
||||||
FluidStack fluid = tank.getFluid();
|
FluidStack fluid = tank.getFluid();
|
||||||
if (fluid.getFluid().canBePlacedInWorld()) {
|
if (fluid.getFluid().canBePlacedInWorld()) {
|
||||||
|
@ -72,6 +92,7 @@ public class TileEntityFunnel extends BaseTileEntity implements ITickable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tag) {
|
public void readFromNBT(NBTTagCompound tag) {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"name": "Funnels",
|
"name": "Funnels",
|
||||||
"version": "$version",
|
"version": "$version",
|
||||||
"mcversion": "$mcversion",
|
"mcversion": "$mcversion",
|
||||||
"description": "Fluid funnels",
|
"description": "Fantastic Fluid funnels",
|
||||||
"credits": "",
|
"credits": "",
|
||||||
"url": "https://github.com/shadowfacts/Funnels",
|
"url": "https://github.com/shadowfacts/Funnels",
|
||||||
"updateUrl": "",
|
"updateUrl": "",
|
||||||
|
|
Loading…
Reference in New Issue