Merge pull request #2384 from dithpri/smart-chute-fix

Fix powered smart chutes outputting items
This commit is contained in:
reidbhuntley 2021-12-22 13:32:12 -05:00 committed by GitHub
commit 14d15089db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View file

@ -354,6 +354,8 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
if (level == null)
return false;
if (!this.canOutputItems())
return false;
if (!capBelow.isPresent())
capBelow = grabCapability(Direction.DOWN);
if (capBelow.isPresent()) {
@ -407,6 +409,9 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
if (level == null)
return false;
if (!this.canOutputItems())
return false;
if (AbstractChuteBlock.isOpenChute(getBlockState())) {
if (!capAbove.isPresent())
capAbove = grabCapability(Direction.UP);
@ -477,6 +482,10 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
return true;
}
protected boolean canOutputItems() {
return true;
}
private LazyOptional<IItemHandler> grabCapability(Direction side) {
BlockPos pos = this.worldPosition.relative(side);
if (level == null)

View file

@ -42,6 +42,12 @@ public class SmartChuteTileEntity extends ChuteTileEntity {
return blockState.hasProperty(SmartChuteBlock.POWERED) && !blockState.getValue(SmartChuteBlock.POWERED);
}
@Override
protected boolean canOutputItems() {
BlockState blockState = getBlockState();
return blockState.hasProperty(SmartChuteBlock.POWERED) && !blockState.getValue(SmartChuteBlock.POWERED);
}
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
behaviours.add(filtering =