Fix stuff

This commit is contained in:
Shadowfacts 2016-06-15 09:57:50 -04:00
parent f93eac4a87
commit 5eb211828a
4 changed files with 54 additions and 33 deletions

View File

@ -1,4 +1,4 @@
mod_version = 1.0.0
mod_version = 1.0.1
group = net.shadowfacts
archivesBaseName = Funnels

View File

@ -15,7 +15,7 @@ public class FunnelsConfig {
static Configuration config;
@Config.Prop
public static int size = 4000;
public static int size = 1000;
@Config.Prop
public static boolean pickupWorldFluids = true;

View File

@ -34,6 +34,20 @@ public class TileEntityFunnel extends BaseTileEntity implements ITickable {
@Override
public void update() {
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) {
EnumFacing facing = worldObj.getBlockState(pos).getValue(BlockFunnel.FACING);
BlockPos handlerPos = pos.offset(facing);
@ -44,19 +58,25 @@ public class TileEntityFunnel extends BaseTileEntity implements ITickable {
save();
}
}
}
world:
{
tick++;
if (tick % 40 == 0) {
if (FunnelsConfig.pickupWorldFluids) {
// pickup from world
if (FunnelsConfig.pickupWorldFluids && tank.getFluidAmount() <= tank.getCapacity() - Fluid.BUCKET_VOLUME) {
tick = 0;
if (FluidUtils.isFluidBlock(worldObj, pos.up())) {
FluidStack toDrain = FluidUtils.drainFluidBlock(worldObj, pos.up(), false);
if (toDrain.amount <= tank.getCapacity() - tank.getFluidAmount()) {
tank.fill(FluidUtils.drainFluidBlock(worldObj, pos.up(), true), true);
save();
break world;
}
}
}
} else {
// place in world
if (FunnelsConfig.placeFluidsInWorld && tank.getFluidAmount() >= Fluid.BUCKET_VOLUME) {
FluidStack fluid = tank.getFluid();
if (fluid.getFluid().canBePlacedInWorld()) {
@ -72,6 +92,7 @@ public class TileEntityFunnel extends BaseTileEntity implements ITickable {
}
}
}
}
@Override
public void readFromNBT(NBTTagCompound tag) {

View File

@ -4,7 +4,7 @@
"name": "Funnels",
"version": "$version",
"mcversion": "$mcversion",
"description": "Fluid funnels",
"description": "Fantastic Fluid funnels",
"credits": "",
"url": "https://github.com/shadowfacts/Funnels",
"updateUrl": "",