Fix harvester culling

- Make harvester's render box a unit cube
- Expose manually animated speed through getter
This commit is contained in:
PepperBell 2021-06-23 23:05:31 -07:00
parent 8d90137b1a
commit 178af2061f
2 changed files with 15 additions and 3 deletions

View file

@ -36,7 +36,7 @@ public class HarvesterRenderer extends SafeTileEntityRenderer<HarvesterTileEntit
BlockState blockState = te.getBlockState(); BlockState blockState = te.getBlockState();
SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.HARVESTER_BLADE, blockState); SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.HARVESTER_BLADE, blockState);
transform(te.getWorld(), blockState.get(HarvesterBlock.HORIZONTAL_FACING), superBuffer, transform(te.getWorld(), blockState.get(HarvesterBlock.HORIZONTAL_FACING), superBuffer,
te.manuallyAnimatedSpeed); te.getAnimatedSpeed());
superBuffer.light(light) superBuffer.light(light)
.renderInto(ms, buffer.getBuffer(RenderType.getCutoutMipped())); .renderInto(ms, buffer.getBuffer(RenderType.getCutoutMipped()));
} }

View file

@ -3,15 +3,27 @@ package com.simibubi.create.content.contraptions.components.actors;
import com.simibubi.create.foundation.tileEntity.SyncedTileEntity; import com.simibubi.create.foundation.tileEntity.SyncedTileEntity;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.AxisAlignedBB;
public class HarvesterTileEntity extends SyncedTileEntity { public class HarvesterTileEntity extends SyncedTileEntity {
private static final AxisAlignedBB RENDER_BOX = new AxisAlignedBB(0, 0, 0, 1, 1, 1);
// For simulations such as Ponder
private float manuallyAnimatedSpeed;
public HarvesterTileEntity(TileEntityType<? extends HarvesterTileEntity> type) { public HarvesterTileEntity(TileEntityType<? extends HarvesterTileEntity> type) {
super(type); super(type);
} }
// For simulations such as Ponder @Override
float manuallyAnimatedSpeed; public AxisAlignedBB getRenderBoundingBox() {
return RENDER_BOX.offset(pos);
}
public float getAnimatedSpeed() {
return manuallyAnimatedSpeed;
}
public void setAnimatedSpeed(float speed) { public void setAnimatedSpeed(float speed) {
manuallyAnimatedSpeed = speed; manuallyAnimatedSpeed = speed;