From 23beff40f385fd7a1c54369da36a2f353b7b8bff Mon Sep 17 00:00:00 2001 From: grimmauld Date: Fri, 9 Oct 2020 20:28:20 +0200 Subject: [PATCH] Chute and Air: hopefully fix non-dev env issues --- .../components/fan/EncasedFanTileEntity.java | 21 +++++++++++++++++++ .../components/fan/IAirCurrentSource.java | 6 +++--- .../block/chute/ChuteTileEntity.java | 17 +++++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanTileEntity.java index eab69aaa9..d52123a8c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanTileEntity.java @@ -13,6 +13,11 @@ import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +import javax.annotation.Nullable; + @MethodsReturnNonnullByDefault public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements IAirCurrentSource { @@ -93,6 +98,17 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements return airCurrent; } + @Nullable + @Override + public World getAirCurrentWorld() { + return world; + } + + @Override + public BlockPos getAirCurrentPos() { + return pos; + } + @Override public Direction getAirflowOriginSide() { return this.getBlockState() @@ -109,6 +125,11 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements return speed > 0 ? facing : facing.getOpposite(); } + @Override + public boolean isSourceRemoved() { + return removed; + } + @Override public void onSpeedChanged(float prevSpeed) { super.onSpeedChanged(prevSpeed); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/fan/IAirCurrentSource.java b/src/main/java/com/simibubi/create/content/contraptions/components/fan/IAirCurrentSource.java index 658d7c5f3..7e93a5ded 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/fan/IAirCurrentSource.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/fan/IAirCurrentSource.java @@ -16,9 +16,9 @@ public interface IAirCurrentSource { AirCurrent getAirCurrent(); @Nullable - World getWorld(); + World getAirCurrentWorld(); - BlockPos getPos(); + BlockPos getAirCurrentPos(); float getSpeed(); @@ -36,5 +36,5 @@ public interface IAirCurrentSource { return this.getSpeed() > 0 ? pushDistance : pullDistance; } - boolean isRemoved(); + boolean isSourceRemoved(); } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java index 49ddadb53..854a64ca2 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java @@ -40,6 +40,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.util.text.TextFormatting; +import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.CapabilityItemHandler; @@ -687,6 +688,17 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor return airCurrent; } + @Nullable + @Override + public World getAirCurrentWorld() { + return world; + } + + @Override + public BlockPos getAirCurrentPos() { + return pos; + } + @Override public float getSpeed() { if (getBlockState().get(ChuteBlock.SHAPE) == Shape.NORMAL && getBlockState().get(ChuteBlock.FACING) != Direction.DOWN) @@ -703,6 +715,11 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor return speed > 0 ? Direction.UP : Direction.DOWN; } + @Override + public boolean isSourceRemoved() { + return removed; + } + @Override public Direction getAirflowOriginSide() { return world != null && !(world.getTileEntity(pos.down()) instanceof IAirCurrentSource)