Water crucibles now collect rain water. Close #49
This commit is contained in:
parent
9177aea415
commit
ffe32fe3ac
|
|
@ -333,28 +333,39 @@ public abstract class AbstractCrucibleBlockEntity extends EBlockEntity {
|
||||||
crucible.needsLightUpdate = false;
|
crucible.needsLightUpdate = false;
|
||||||
}
|
}
|
||||||
// Update twice per tick
|
// Update twice per tick
|
||||||
if (!level.isClientSide && (level.getGameTime() % 10L) == 0L) {
|
if (!level.isClientSide) {
|
||||||
short delta = (short) Math.min(crucible.solids, crucible.getMeltingRate());
|
if ((level.getGameTime() % 10L) == 0L) {
|
||||||
|
short delta = (short) Math.min(crucible.solids, crucible.getMeltingRate());
|
||||||
|
|
||||||
// Skip if no heat
|
// Skip if no heat
|
||||||
if (delta <= 0) return;
|
if (delta <= 0) return;
|
||||||
|
|
||||||
if (crucible.tank.getSpace() >= delta) {
|
if (crucible.tank.getSpace() >= delta) {
|
||||||
// Remove solids
|
// Remove solids
|
||||||
crucible.solids -= delta;
|
crucible.solids -= delta;
|
||||||
|
|
||||||
// Add lava
|
// Add lava
|
||||||
if (crucible.tank.isEmpty()) {
|
if (crucible.tank.isEmpty()) {
|
||||||
if (crucible.fluid != null) {
|
if (crucible.fluid != null) {
|
||||||
crucible.tank.setFluid(new FluidStack(crucible.fluid, delta));
|
crucible.tank.setFluid(new FluidStack(crucible.fluid, delta));
|
||||||
crucible.needsLightUpdate = true;
|
crucible.needsLightUpdate = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
crucible.tank.getFluid().grow(delta);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
crucible.tank.getFluid().grow(delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sync to client
|
// Sync to client
|
||||||
crucible.markUpdated();
|
crucible.markUpdated();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (crucible instanceof WaterCrucibleBlockEntity && level.isRainingAt(pos.above())) {
|
||||||
|
if (crucible.tank.isEmpty()) {
|
||||||
|
crucible.tank.setFluid(new FluidStack(Fluids.WATER, 1));
|
||||||
|
crucible.markUpdated();
|
||||||
|
} else if (crucible.tank.getFluid().getFluid() == Fluids.WATER) {
|
||||||
|
crucible.tank.getFluid().grow(1);
|
||||||
|
crucible.markUpdated();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user