mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 16:06:48 +01:00
Fix fluid tank render boxes
- Update render box on client TE initialization and update packet - Resolves #1669
This commit is contained in:
parent
c1d88bbad4
commit
e55ae22d7d
4 changed files with 18 additions and 14 deletions
|
@ -199,7 +199,7 @@ public class FluidTankConnectivityHandler {
|
||||||
|
|
||||||
if (simulate)
|
if (simulate)
|
||||||
return amount;
|
return amount;
|
||||||
|
|
||||||
boolean opaque = false;
|
boolean opaque = false;
|
||||||
|
|
||||||
for (int yOffset = 0; yOffset < height; yOffset++) {
|
for (int yOffset = 0; yOffset < height; yOffset++) {
|
||||||
|
@ -234,7 +234,7 @@ public class FluidTankConnectivityHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
te.setWindows(!opaque);
|
te.setWindows(!opaque);
|
||||||
|
|
||||||
return amount;
|
return amount;
|
||||||
|
@ -281,7 +281,7 @@ public class FluidTankConnectivityHandler {
|
||||||
if (!toDistribute.isEmpty() && tankAt != te) {
|
if (!toDistribute.isEmpty() && tankAt != te) {
|
||||||
FluidStack copy = toDistribute.copy();
|
FluidStack copy = toDistribute.copy();
|
||||||
FluidTank tankInventory = tankAt.tankInventory;
|
FluidTank tankInventory = tankAt.tankInventory;
|
||||||
if (tankInventory.isEmpty() && tankInventory instanceof CreativeSmartFluidTank)
|
if (tankInventory.isEmpty() && tankInventory instanceof CreativeSmartFluidTank)
|
||||||
((CreativeSmartFluidTank) tankInventory).setContainedFluid(toDistribute);
|
((CreativeSmartFluidTank) tankInventory).setContainedFluid(toDistribute);
|
||||||
else {
|
else {
|
||||||
int split = Math.min(maxCapacity, toDistribute.getAmount());
|
int split = Math.min(maxCapacity, toDistribute.getAmount());
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class FluidTankRenderer extends SafeTileEntityRenderer<FluidTankTileEntit
|
||||||
if (!te.window)
|
if (!te.window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
InterpolatedChasingValue fluidLevel = te.fluidLevel;
|
InterpolatedChasingValue fluidLevel = te.getFluidLevel();
|
||||||
if (fluidLevel == null)
|
if (fluidLevel == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,8 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI
|
||||||
protected boolean queuedSync;
|
protected boolean queuedSync;
|
||||||
|
|
||||||
// For rendering purposes only
|
// For rendering purposes only
|
||||||
InterpolatedChasingValue fluidLevel;
|
private InterpolatedChasingValue fluidLevel;
|
||||||
|
private AxisAlignedBB renderBoundingBox;
|
||||||
|
|
||||||
public FluidTankTileEntity(TileEntityType<?> tileEntityTypeIn) {
|
public FluidTankTileEntity(TileEntityType<?> tileEntityTypeIn) {
|
||||||
super(tileEntityTypeIn);
|
super(tileEntityTypeIn);
|
||||||
|
@ -114,6 +115,8 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
super.initialize();
|
super.initialize();
|
||||||
sendData();
|
sendData();
|
||||||
|
if (world.isRemote)
|
||||||
|
updateRenderBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onPositionChanged() {
|
private void onPositionChanged() {
|
||||||
|
@ -286,18 +289,20 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI
|
||||||
return isController() ? pos : controller;
|
return isController() ? pos : controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
private AxisAlignedBB cachedBoundingBox;
|
public void updateRenderBoundingBox() {
|
||||||
|
if (isController())
|
||||||
|
renderBoundingBox = super.getRenderBoundingBox().expand(width - 1, height - 1, width - 1);
|
||||||
|
else
|
||||||
|
renderBoundingBox = super.getRenderBoundingBox();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public AxisAlignedBB getRenderBoundingBox() {
|
public AxisAlignedBB getRenderBoundingBox() {
|
||||||
if (cachedBoundingBox == null) {
|
if (renderBoundingBox == null) {
|
||||||
if (isController())
|
renderBoundingBox = super.getRenderBoundingBox();
|
||||||
cachedBoundingBox = super.getRenderBoundingBox().expand(width - 1, height - 1, width - 1);
|
|
||||||
else
|
|
||||||
cachedBoundingBox = super.getRenderBoundingBox();
|
|
||||||
}
|
}
|
||||||
return cachedBoundingBox;
|
return renderBoundingBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -367,6 +372,7 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI
|
||||||
world.notifyBlockUpdate(getPos(), getBlockState(), getBlockState(), 16);
|
world.notifyBlockUpdate(getPos(), getBlockState(), getBlockState(), 16);
|
||||||
if (isController())
|
if (isController())
|
||||||
tankInventory.setCapacity(getCapacityMultiplier() * getTotalTankSize());
|
tankInventory.setCapacity(getCapacityMultiplier() * getTotalTankSize());
|
||||||
|
updateRenderBoundingBox();
|
||||||
}
|
}
|
||||||
if (isController()) {
|
if (isController()) {
|
||||||
float fillState = getFillState();
|
float fillState = getFillState();
|
||||||
|
|
|
@ -8,13 +8,11 @@ import java.util.function.Consumer;
|
||||||
|
|
||||||
import com.simibubi.create.content.schematics.ItemRequirement;
|
import com.simibubi.create.content.schematics.ItemRequirement;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.utility.IPartialSafeNBT;
|
import com.simibubi.create.foundation.utility.IPartialSafeNBT;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.ITickableTileEntity;
|
import net.minecraft.tileentity.ITickableTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||||
|
|
Loading…
Reference in a new issue