From 9f049e8b89b8cbefc3edbec952c8aba4f2b93447 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 28 Aug 2020 00:29:44 +0200 Subject: [PATCH] made some stuff protected for Quarris --- .../ellpeck/prettypipes/network/PipeItem.java | 24 +++++++++---------- .../ellpeck/prettypipes/pipe/PipeBlock.java | 4 ++-- .../prettypipes/pipe/PipeTileEntity.java | 7 +++++- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/main/java/de/ellpeck/prettypipes/network/PipeItem.java b/src/main/java/de/ellpeck/prettypipes/network/PipeItem.java index c9014ec..7087a4c 100644 --- a/src/main/java/de/ellpeck/prettypipes/network/PipeItem.java +++ b/src/main/java/de/ellpeck/prettypipes/network/PipeItem.java @@ -44,13 +44,13 @@ public class PipeItem implements INBTSerializable, ILiquidContainer public float lastY; public float lastZ; - private List path; - private BlockPos startInventory; - private BlockPos destInventory; - private BlockPos currGoalPos; - private int currentTile; - private boolean dropOnObstruction; - private long lastWorldTick; + protected List path; + protected BlockPos startInventory; + protected BlockPos destInventory; + protected BlockPos currGoalPos; + protected int currentTile; + protected boolean dropOnObstruction; + protected long lastWorldTick; public PipeItem(ItemStack stack, float speed) { this.stack = stack; @@ -153,7 +153,7 @@ public class PipeItem implements INBTSerializable, ILiquidContainer this.z += dist.z * currSpeed; } - private void onPathObstructed(PipeTileEntity currPipe, boolean tryReturn) { + protected void onPathObstructed(PipeTileEntity currPipe, boolean tryReturn) { if (currPipe.getWorld().isRemote) return; if (!this.dropOnObstruction && tryReturn) { @@ -171,7 +171,7 @@ public class PipeItem implements INBTSerializable, ILiquidContainer item.world.addEntity(item); } - private ItemStack store(PipeTileEntity currPipe) { + protected ItemStack store(PipeTileEntity currPipe) { Direction dir = Utility.getDirectionFromOffset(this.destInventory, this.getDestPipe()); IPipeConnectable connectable = currPipe.getPipeConnectable(dir); if (connectable != null) @@ -182,7 +182,7 @@ public class PipeItem implements INBTSerializable, ILiquidContainer return this.stack; } - private PipeTileEntity getNextTile(PipeTileEntity currPipe, boolean progress) { + protected PipeTileEntity getNextTile(PipeTileEntity currPipe, boolean progress) { if (this.path.size() <= this.currentTile + 1) return null; BlockPos pos = this.path.get(this.currentTile + 1); @@ -192,7 +192,7 @@ public class PipeItem implements INBTSerializable, ILiquidContainer return network.getPipe(pos); } - private BlockPos getStartPipe() { + protected BlockPos getStartPipe() { return this.path.get(0); } @@ -246,7 +246,7 @@ public class PipeItem implements INBTSerializable, ILiquidContainer this.path.add(NBTUtil.readBlockPos(list.getCompound(i))); } - private static List compilePath(GraphPath path) { + protected static List compilePath(GraphPath path) { Graph graph = path.getGraph(); List ret = new ArrayList<>(); List nodes = path.getVertexList(); diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlock.java b/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlock.java index 6e2d9df..cb2613e 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlock.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlock.java @@ -166,7 +166,7 @@ public class PipeBlock extends ContainerBlock implements IPipeConnectable { 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); if (!world.isBlockLoaded(offset)) return ConnectionType.DISCONNECTED; @@ -187,7 +187,7 @@ public class PipeBlock extends ContainerBlock implements IPipeConnectable { 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) return direction == Direction.DOWN; if (state.getMaterial() == Material.ROCK || state.getMaterial() == Material.IRON) diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java b/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java index 0ba9bfe..80fc80d 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java @@ -20,6 +20,7 @@ import net.minecraft.profiler.IProfiler; import net.minecraft.tileentity.ChestTileEntity; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; @@ -60,7 +61,11 @@ public class PipeTileEntity extends TileEntity implements INamedContainerProvide private int priority; public PipeTileEntity() { - super(Registry.pipeTileEntity); + this(Registry.pipeTileEntity); + } + + protected PipeTileEntity(TileEntityType type) { + super(type); } @Override