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.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);

View file

@ -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();
}

View file

@ -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)