made some stuff protected for Quarris

This commit is contained in:
Ell 2020-08-28 00:29:44 +02:00
parent 294559ca61
commit 9f049e8b89
3 changed files with 20 additions and 15 deletions

View file

@ -44,13 +44,13 @@ public class PipeItem implements INBTSerializable<CompoundNBT>, ILiquidContainer
public float lastY; public float lastY;
public float lastZ; public float lastZ;
private List<BlockPos> path; protected List<BlockPos> path;
private BlockPos startInventory; protected BlockPos startInventory;
private BlockPos destInventory; protected BlockPos destInventory;
private BlockPos currGoalPos; protected BlockPos currGoalPos;
private int currentTile; protected int currentTile;
private boolean dropOnObstruction; protected boolean dropOnObstruction;
private long lastWorldTick; protected long lastWorldTick;
public PipeItem(ItemStack stack, float speed) { public PipeItem(ItemStack stack, float speed) {
this.stack = stack; this.stack = stack;
@ -153,7 +153,7 @@ public class PipeItem implements INBTSerializable<CompoundNBT>, ILiquidContainer
this.z += dist.z * currSpeed; this.z += dist.z * currSpeed;
} }
private void onPathObstructed(PipeTileEntity currPipe, boolean tryReturn) { protected void onPathObstructed(PipeTileEntity currPipe, boolean tryReturn) {
if (currPipe.getWorld().isRemote) if (currPipe.getWorld().isRemote)
return; return;
if (!this.dropOnObstruction && tryReturn) { if (!this.dropOnObstruction && tryReturn) {
@ -171,7 +171,7 @@ public class PipeItem implements INBTSerializable<CompoundNBT>, ILiquidContainer
item.world.addEntity(item); item.world.addEntity(item);
} }
private ItemStack store(PipeTileEntity currPipe) { protected ItemStack store(PipeTileEntity currPipe) {
Direction dir = Utility.getDirectionFromOffset(this.destInventory, this.getDestPipe()); Direction dir = Utility.getDirectionFromOffset(this.destInventory, this.getDestPipe());
IPipeConnectable connectable = currPipe.getPipeConnectable(dir); IPipeConnectable connectable = currPipe.getPipeConnectable(dir);
if (connectable != null) if (connectable != null)
@ -182,7 +182,7 @@ public class PipeItem implements INBTSerializable<CompoundNBT>, ILiquidContainer
return this.stack; return this.stack;
} }
private PipeTileEntity getNextTile(PipeTileEntity currPipe, boolean progress) { protected PipeTileEntity getNextTile(PipeTileEntity currPipe, boolean progress) {
if (this.path.size() <= this.currentTile + 1) if (this.path.size() <= this.currentTile + 1)
return null; return null;
BlockPos pos = this.path.get(this.currentTile + 1); BlockPos pos = this.path.get(this.currentTile + 1);
@ -192,7 +192,7 @@ public class PipeItem implements INBTSerializable<CompoundNBT>, ILiquidContainer
return network.getPipe(pos); return network.getPipe(pos);
} }
private BlockPos getStartPipe() { protected BlockPos getStartPipe() {
return this.path.get(0); return this.path.get(0);
} }
@ -246,7 +246,7 @@ public class PipeItem implements INBTSerializable<CompoundNBT>, ILiquidContainer
this.path.add(NBTUtil.readBlockPos(list.getCompound(i))); this.path.add(NBTUtil.readBlockPos(list.getCompound(i)));
} }
private static List<BlockPos> compilePath(GraphPath<BlockPos, NetworkEdge> path) { protected static List<BlockPos> compilePath(GraphPath<BlockPos, NetworkEdge> path) {
Graph<BlockPos, NetworkEdge> graph = path.getGraph(); Graph<BlockPos, NetworkEdge> graph = path.getGraph();
List<BlockPos> ret = new ArrayList<>(); List<BlockPos> ret = new ArrayList<>();
List<BlockPos> nodes = path.getVertexList(); List<BlockPos> nodes = path.getVertexList();

View file

@ -166,7 +166,7 @@ public class PipeBlock extends ContainerBlock implements IPipeConnectable {
return state; return state;
} }
private static ConnectionType getConnectionType(World world, BlockPos pos, Direction direction, BlockState state) { protected static ConnectionType getConnectionType(World world, BlockPos pos, Direction direction, BlockState state) {
BlockPos offset = pos.offset(direction); BlockPos offset = pos.offset(direction);
if (!world.isBlockLoaded(offset)) if (!world.isBlockLoaded(offset))
return ConnectionType.DISCONNECTED; return ConnectionType.DISCONNECTED;
@ -187,7 +187,7 @@ public class PipeBlock extends ContainerBlock implements IPipeConnectable {
return ConnectionType.DISCONNECTED; return ConnectionType.DISCONNECTED;
} }
private static boolean hasLegsTo(World world, BlockState state, BlockPos pos, Direction direction) { protected static boolean hasLegsTo(World world, BlockState state, BlockPos pos, Direction direction) {
if (state.getBlock() instanceof WallBlock || state.getBlock() instanceof FenceBlock) if (state.getBlock() instanceof WallBlock || state.getBlock() instanceof FenceBlock)
return direction == Direction.DOWN; return direction == Direction.DOWN;
if (state.getMaterial() == Material.ROCK || state.getMaterial() == Material.IRON) if (state.getMaterial() == Material.ROCK || state.getMaterial() == Material.IRON)

View file

@ -20,6 +20,7 @@ import net.minecraft.profiler.IProfiler;
import net.minecraft.tileentity.ChestTileEntity; import net.minecraft.tileentity.ChestTileEntity;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
@ -60,7 +61,11 @@ public class PipeTileEntity extends TileEntity implements INamedContainerProvide
private int priority; private int priority;
public PipeTileEntity() { public PipeTileEntity() {
super(Registry.pipeTileEntity); this(Registry.pipeTileEntity);
}
protected PipeTileEntity(TileEntityType<?> type) {
super(type);
} }
@Override @Override