Chute and Air: hopefully fix non-dev env issues

This commit is contained in:
grimmauld 2020-10-09 20:28:20 +02:00
parent 71ebdf044b
commit 23beff40f3
3 changed files with 41 additions and 3 deletions

View file

@ -13,6 +13,11 @@ import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nullable;
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements IAirCurrentSource { public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements IAirCurrentSource {
@ -93,6 +98,17 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements
return airCurrent; return airCurrent;
} }
@Nullable
@Override
public World getAirCurrentWorld() {
return world;
}
@Override
public BlockPos getAirCurrentPos() {
return pos;
}
@Override @Override
public Direction getAirflowOriginSide() { public Direction getAirflowOriginSide() {
return this.getBlockState() return this.getBlockState()
@ -109,6 +125,11 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements
return speed > 0 ? facing : facing.getOpposite(); return speed > 0 ? facing : facing.getOpposite();
} }
@Override
public boolean isSourceRemoved() {
return removed;
}
@Override @Override
public void onSpeedChanged(float prevSpeed) { public void onSpeedChanged(float prevSpeed) {
super.onSpeedChanged(prevSpeed); super.onSpeedChanged(prevSpeed);

View file

@ -16,9 +16,9 @@ public interface IAirCurrentSource {
AirCurrent getAirCurrent(); AirCurrent getAirCurrent();
@Nullable @Nullable
World getWorld(); World getAirCurrentWorld();
BlockPos getPos(); BlockPos getAirCurrentPos();
float getSpeed(); float getSpeed();
@ -36,5 +36,5 @@ public interface IAirCurrentSource {
return this.getSpeed() > 0 ? pushDistance : pullDistance; return this.getSpeed() > 0 ? pushDistance : pullDistance;
} }
boolean isRemoved(); boolean isSourceRemoved();
} }

View file

@ -40,6 +40,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.CapabilityItemHandler;
@ -687,6 +688,17 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
return airCurrent; return airCurrent;
} }
@Nullable
@Override
public World getAirCurrentWorld() {
return world;
}
@Override
public BlockPos getAirCurrentPos() {
return pos;
}
@Override @Override
public float getSpeed() { public float getSpeed() {
if (getBlockState().get(ChuteBlock.SHAPE) == Shape.NORMAL && getBlockState().get(ChuteBlock.FACING) != Direction.DOWN) 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; return speed > 0 ? Direction.UP : Direction.DOWN;
} }
@Override
public boolean isSourceRemoved() {
return removed;
}
@Override @Override
public Direction getAirflowOriginSide() { public Direction getAirflowOriginSide() {
return world != null && !(world.getTileEntity(pos.down()) instanceof IAirCurrentSource) return world != null && !(world.getTileEntity(pos.down()) instanceof IAirCurrentSource)