From 9f529f9305c4ca7d9ab133e2a195b7144e2eca32 Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Sun, 28 Nov 2021 17:00:52 +0100 Subject: [PATCH 1/6] Bump to 0.5.2 --- CHANGELOG.md | 2 ++ build.gradle | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d094cda..00768a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [0.5.1] - 2021-11-28 + ### Added - Added Italian translation by [@maicol07](https://github.com/maicol07). diff --git a/build.gradle b/build.gradle index 6a13047..ad78bb8 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ apply plugin: 'maven-publish' group = 'com.refinedmods' archivesBaseName = 'refinedpipes' -version = '0.5.1' +version = '0.5.2' if (System.getenv('GITHUB_SHA') != null) { version += '+' + System.getenv('GITHUB_SHA').substring(0, 7) From 00cd1667e74667e259d5bd27153e10cb92ef3b23 Mon Sep 17 00:00:00 2001 From: Raoul Date: Mon, 29 Nov 2021 20:11:45 +0100 Subject: [PATCH 2/6] Remove update URL --- src/main/resources/META-INF/mods.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index f15d63a..c052c05 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -6,7 +6,6 @@ license="MIT" modId="refinedpipes" version="${version}" displayName="Refined Pipes" -updateJSONURL="https://refinedmods.com/refined-pipes/update.json" displayURL="https://refinedmods.com/refined-pipes" authors="Refined Mods" description=''' From b0e53047526ac930db3e7cc4d4402b503c8a081f Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Fri, 17 Dec 2021 16:40:11 +0100 Subject: [PATCH 3/6] Switch to 1.16.5 official mappings --- build.gradle | 8 +- .../refinedpipes/RefinedPipesNetwork.java | 4 +- .../refinedpipes/block/EnergyPipeBlock.java | 8 +- .../refinedpipes/block/FluidPipeBlock.java | 8 +- .../refinedpipes/block/ItemPipeBlock.java | 8 +- .../refinedpipes/block/PipeBlock.java | 84 ++++++------ .../refinedpipes/container/BaseContainer.java | 24 ++-- .../ExtractorAttachmentContainer.java | 22 ++-- .../container/slot/FilterSlot.java | 4 +- .../container/slot/FluidFilterSlot.java | 8 +- .../refinedpipes/item/AttachmentItem.java | 6 +- .../refinedpipes/item/BaseBlockItem.java | 2 +- .../item/EnergyPipeBlockItem.java | 14 +- .../refinedpipes/item/FluidPipeBlockItem.java | 14 +- .../refinedpipes/item/ItemPipeBlockItem.java | 10 +- .../item/group/MainItemGroup.java | 2 +- .../ChangeBlacklistWhitelistMessage.java | 4 +- .../message/ChangeExactModeMessage.java | 4 +- .../message/ChangeRedstoneModeMessage.java | 4 +- .../message/ChangeRoutingModeMessage.java | 4 +- .../message/ChangeStackSizeMessage.java | 4 +- .../message/FluidFilterSlotUpdateMessage.java | 4 +- .../message/FluidPipeMessage.java | 2 +- .../message/ItemTransportMessage.java | 2 +- .../refinedpipes/network/Network.java | 2 +- .../refinedpipes/network/NetworkManager.java | 20 +-- .../network/energy/EnergyNetwork.java | 2 +- .../network/energy/EnergyNetworkFactory.java | 2 +- .../network/fluid/FluidNetwork.java | 2 +- .../network/fluid/FluidNetworkFactory.java | 2 +- .../network/graph/NetworkGraphScanner.java | 4 +- .../network/item/ItemNetworkFactory.java | 2 +- .../refinedpipes/network/pipe/Pipe.java | 4 +- .../attachment/ClientAttachmentManager.java | 2 +- .../attachment/ServerAttachmentManager.java | 2 +- .../extractor/ExtractorAttachment.java | 20 +-- .../extractor/ExtractorAttachmentFactory.java | 20 +-- .../extractor/ItemDestinationFinder.java | 2 +- .../attachment/extractor/RedstoneMode.java | 4 +- .../pipe/energy/EnergyPipeFactory.java | 2 +- .../network/pipe/fluid/FluidPipeFactory.java | 2 +- .../network/pipe/item/ItemPipe.java | 6 +- .../network/pipe/item/ItemPipeFactory.java | 2 +- .../network/pipe/shape/PipeShapeCache.java | 16 +-- .../network/pipe/shape/PipeShapeFactory.java | 24 ++-- .../network/pipe/shape/PipeShapeProps.java | 26 ++-- .../network/pipe/transport/ItemTransport.java | 32 ++--- .../pipe/transport/ItemTransportProps.java | 4 +- .../ItemBounceBackTransportCallback.java | 14 +- .../callback/ItemInsertTransportCallback.java | 10 +- .../ItemPipeGoneTransportCallback.java | 6 +- .../refinedpipes/render/CubeBuilder.java | 58 ++++----- .../render/FluidPipeTileEntityRenderer.java | 34 ++--- .../refinedpipes/render/FluidRenderer.java | 24 ++-- .../render/ItemPipeTileEntityRenderer.java | 16 +-- .../refinedpipes/render/PipeBakedModel.java | 48 +++---- .../refinedpipes/screen/BaseScreen.java | 14 +- .../screen/ExtractorAttachmentScreen.java | 122 +++++++++--------- .../screen/widget/IconButton.java | 4 +- .../refinedpipes/setup/ClientSetup.java | 18 +-- .../refinedpipes/setup/CommonSetup.java | 32 ++--- .../refinedpipes/tile/BaseTileEntity.java | 6 +- .../tile/EnergyPipeTileEntity.java | 6 +- .../tile/FluidPipeTileEntity.java | 2 +- .../refinedpipes/tile/ItemPipeTileEntity.java | 4 +- .../refinedpipes/tile/PipeTileEntity.java | 34 ++--- .../refinedpipes/util/Raytracer.java | 10 +- 67 files changed, 461 insertions(+), 459 deletions(-) diff --git a/build.gradle b/build.gradle index ad78bb8..b0ab033 100644 --- a/build.gradle +++ b/build.gradle @@ -38,7 +38,7 @@ if (System.getenv('RELEASE') != null) { java.toolchain.languageVersion = JavaLanguageVersion.of(8) minecraft { - mappings channel: 'snapshot', version: '20200723-1.16.1' + mappings channel: 'official', version: '1.16.5' runs { client { @@ -52,12 +52,6 @@ minecraft { } } - intellijClient { - parent runs.client - ideaModule "${project.name}.main" - environment 'MOD_CLASSES', "${project.file("out/production/resources").canonicalPath};${project.file("out/production/classes").canonicalPath}" - } - server { workingDirectory project.file('run') property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' diff --git a/src/main/java/com/refinedmods/refinedpipes/RefinedPipesNetwork.java b/src/main/java/com/refinedmods/refinedpipes/RefinedPipesNetwork.java index 0ac6567..4e2aac1 100644 --- a/src/main/java/com/refinedmods/refinedpipes/RefinedPipesNetwork.java +++ b/src/main/java/com/refinedmods/refinedpipes/RefinedPipesNetwork.java @@ -38,7 +38,7 @@ public void sendInArea(World world, BlockPos pos, int radius, Object message) { pos.getY(), pos.getZ(), radius, - world.func_234923_W_() + world.dimension() )), message); } @@ -47,6 +47,6 @@ public void sendToServer(Object message) { } public void sendToClient(ServerPlayerEntity player, Object message) { - handler.sendTo(message, player.connection.netManager, NetworkDirection.PLAY_TO_CLIENT); + handler.sendTo(message, player.connection.connection, NetworkDirection.PLAY_TO_CLIENT); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/block/EnergyPipeBlock.java b/src/main/java/com/refinedmods/refinedpipes/block/EnergyPipeBlock.java index 1b0d19c..7320b3c 100644 --- a/src/main/java/com/refinedmods/refinedpipes/block/EnergyPipeBlock.java +++ b/src/main/java/com/refinedmods/refinedpipes/block/EnergyPipeBlock.java @@ -42,14 +42,14 @@ public TileEntity createTileEntity(BlockState state, IBlockReader world) { @Override protected boolean hasConnection(IWorld world, BlockPos pos, Direction direction) { - TileEntity currentTile = world.getTileEntity(pos); + TileEntity currentTile = world.getBlockEntity(pos); if (currentTile instanceof EnergyPipeTileEntity && ((EnergyPipeTileEntity) currentTile).getAttachmentManager().hasAttachment(direction)) { return false; } - BlockState facingState = world.getBlockState(pos.offset(direction)); - TileEntity facingTile = world.getTileEntity(pos.offset(direction)); + BlockState facingState = world.getBlockState(pos.relative(direction)); + TileEntity facingTile = world.getBlockEntity(pos.relative(direction)); if (facingTile instanceof EnergyPipeTileEntity && ((EnergyPipeTileEntity) facingTile).getAttachmentManager().hasAttachment(direction.getOpposite())) { @@ -62,7 +62,7 @@ protected boolean hasConnection(IWorld world, BlockPos pos, Direction direction) @Override protected boolean hasInvConnection(IWorld world, BlockPos pos, Direction direction) { - TileEntity facingTile = world.getTileEntity(pos.offset(direction)); + TileEntity facingTile = world.getBlockEntity(pos.relative(direction)); if (facingTile == null) { return false; } diff --git a/src/main/java/com/refinedmods/refinedpipes/block/FluidPipeBlock.java b/src/main/java/com/refinedmods/refinedpipes/block/FluidPipeBlock.java index 3e154fd..ff85815 100644 --- a/src/main/java/com/refinedmods/refinedpipes/block/FluidPipeBlock.java +++ b/src/main/java/com/refinedmods/refinedpipes/block/FluidPipeBlock.java @@ -40,14 +40,14 @@ public TileEntity createTileEntity(BlockState state, IBlockReader world) { @Override protected boolean hasConnection(IWorld world, BlockPos pos, Direction direction) { - TileEntity currentTile = world.getTileEntity(pos); + TileEntity currentTile = world.getBlockEntity(pos); if (currentTile instanceof FluidPipeTileEntity && ((FluidPipeTileEntity) currentTile).getAttachmentManager().hasAttachment(direction)) { return false; } - BlockState facingState = world.getBlockState(pos.offset(direction)); - TileEntity facingTile = world.getTileEntity(pos.offset(direction)); + BlockState facingState = world.getBlockState(pos.relative(direction)); + TileEntity facingTile = world.getBlockEntity(pos.relative(direction)); if (facingTile instanceof FluidPipeTileEntity && ((FluidPipeTileEntity) facingTile).getAttachmentManager().hasAttachment(direction.getOpposite())) { @@ -60,7 +60,7 @@ protected boolean hasConnection(IWorld world, BlockPos pos, Direction direction) @Override protected boolean hasInvConnection(IWorld world, BlockPos pos, Direction direction) { - TileEntity facingTile = world.getTileEntity(pos.offset(direction)); + TileEntity facingTile = world.getBlockEntity(pos.relative(direction)); return facingTile != null && facingTile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, direction.getOpposite()).isPresent(); diff --git a/src/main/java/com/refinedmods/refinedpipes/block/ItemPipeBlock.java b/src/main/java/com/refinedmods/refinedpipes/block/ItemPipeBlock.java index 74ad557..3149ffc 100644 --- a/src/main/java/com/refinedmods/refinedpipes/block/ItemPipeBlock.java +++ b/src/main/java/com/refinedmods/refinedpipes/block/ItemPipeBlock.java @@ -40,14 +40,14 @@ public TileEntity createTileEntity(BlockState state, IBlockReader world) { @Override protected boolean hasConnection(IWorld world, BlockPos pos, Direction direction) { - TileEntity currentTile = world.getTileEntity(pos); + TileEntity currentTile = world.getBlockEntity(pos); if (currentTile instanceof ItemPipeTileEntity && ((ItemPipeTileEntity) currentTile).getAttachmentManager().hasAttachment(direction)) { return false; } - BlockState facingState = world.getBlockState(pos.offset(direction)); - TileEntity facingTile = world.getTileEntity(pos.offset(direction)); + BlockState facingState = world.getBlockState(pos.relative(direction)); + TileEntity facingTile = world.getBlockEntity(pos.relative(direction)); if (facingTile instanceof ItemPipeTileEntity && ((ItemPipeTileEntity) facingTile).getAttachmentManager().hasAttachment(direction.getOpposite())) { @@ -59,7 +59,7 @@ protected boolean hasConnection(IWorld world, BlockPos pos, Direction direction) @Override protected boolean hasInvConnection(IWorld world, BlockPos pos, Direction direction) { - TileEntity facingTile = world.getTileEntity(pos.offset(direction)); + TileEntity facingTile = world.getBlockEntity(pos.relative(direction)); return facingTile != null && facingTile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, direction.getOpposite()).isPresent(); diff --git a/src/main/java/com/refinedmods/refinedpipes/block/PipeBlock.java b/src/main/java/com/refinedmods/refinedpipes/block/PipeBlock.java index 6ff37fd..edbc2b3 100644 --- a/src/main/java/com/refinedmods/refinedpipes/block/PipeBlock.java +++ b/src/main/java/com/refinedmods/refinedpipes/block/PipeBlock.java @@ -53,19 +53,19 @@ public abstract class PipeBlock extends Block { private final PipeShapeCache shapeCache; public PipeBlock(PipeShapeCache shapeCache) { - super(Block.Properties.create(Material.ROCK).hardnessAndResistance(0.35F)); + super(Block.Properties.of(Material.STONE).strength(0.35F)); this.shapeCache = shapeCache; - this.setDefaultState(getDefaultState() - .with(NORTH, false).with(EAST, false).with(SOUTH, false).with(WEST, false).with(UP, false).with(DOWN, false) - .with(INV_NORTH, false).with(INV_EAST, false).with(INV_SOUTH, false).with(INV_WEST, false).with(INV_UP, false).with(INV_DOWN, false) + this.registerDefaultState(defaultBlockState() + .setValue(NORTH, false).setValue(EAST, false).setValue(SOUTH, false).setValue(WEST, false).setValue(UP, false).setValue(DOWN, false) + .setValue(INV_NORTH, false).setValue(INV_EAST, false).setValue(INV_SOUTH, false).setValue(INV_WEST, false).setValue(INV_UP, false).setValue(INV_DOWN, false) ); } @Override - protected void fillStateContainer(StateContainer.Builder builder) { - super.fillStateContainer(builder); + protected void createBlockStateDefinition(StateContainer.Builder builder) { + super.createBlockStateDefinition(builder); builder.add( NORTH, EAST, SOUTH, WEST, UP, DOWN, @@ -78,7 +78,7 @@ protected void fillStateContainer(StateContainer.Builder buil public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) { super.neighborChanged(state, world, pos, block, fromPos, isMoving); - if (!world.isRemote) { + if (!world.isClientSide) { Pipe pipe = NetworkManager.get(world).getPipe(pos); if (pipe != null && pipe.getNetwork() != null) { @@ -89,12 +89,12 @@ public void neighborChanged(BlockState state, World world, BlockPos pos, Block b @Override @SuppressWarnings("deprecation") - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { - Direction dirClicked = getAttachmentDirectionClicked(pos, hit.getHitVec()); + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + Direction dirClicked = getAttachmentDirectionClicked(pos, hit.getLocation()); if (dirClicked != null) { - ItemStack held = player.getHeldItemMainhand(); - TileEntity tile = world.getTileEntity(pos); + ItemStack held = player.getMainHandItem(); + TileEntity tile = world.getBlockEntity(pos); if (held.isEmpty() && player.isCrouching()) { return removeAttachment(world, pos, dirClicked); @@ -105,11 +105,11 @@ public ActionResultType onBlockActivated(BlockState state, World world, BlockPos } } - return super.onBlockActivated(state, world, pos, player, hand, hit); + return super.use(state, world, pos, player, hand, hit); } private ActionResultType addAttachment(PlayerEntity player, World world, BlockPos pos, ItemStack attachment, Direction dir) { - if (!world.isRemote) { + if (!world.isClientSide) { Pipe pipe = NetworkManager.get(world).getPipe(pos); if (pipe != null && !pipe.getAttachmentManager().hasAttachment(dir)) { @@ -119,10 +119,10 @@ private ActionResultType addAttachment(PlayerEntity player, World world, BlockPo } pipe.getAttachmentManager().setAttachmentAndScanGraph(dir, type.create(pipe, dir)); - NetworkManager.get(world).markDirty(); + NetworkManager.get(world).setDirty(); pipe.sendBlockUpdate(); - world.setBlockState(pos, getState(world.getBlockState(pos), world, pos)); + world.setBlockAndUpdate(pos, getState(world.getBlockState(pos), world, pos)); if (!player.isCreative()) { attachment.shrink(1); @@ -134,24 +134,24 @@ private ActionResultType addAttachment(PlayerEntity player, World world, BlockPo } private ActionResultType removeAttachment(World world, BlockPos pos, Direction dir) { - if (!world.isRemote) { + if (!world.isClientSide) { Pipe pipe = NetworkManager.get(world).getPipe(pos); if (pipe != null && pipe.getAttachmentManager().hasAttachment(dir)) { Attachment attachment = pipe.getAttachmentManager().getAttachment(dir); pipe.getAttachmentManager().removeAttachmentAndScanGraph(dir); - NetworkManager.get(world).markDirty(); + NetworkManager.get(world).setDirty(); pipe.sendBlockUpdate(); - world.setBlockState(pos, getState(world.getBlockState(pos), world, pos)); + world.setBlockAndUpdate(pos, getState(world.getBlockState(pos), world, pos)); - Block.spawnAsEntity(world, pos.offset(dir), attachment.getDrop()); + Block.popResource(world, pos.relative(dir), attachment.getDrop()); } return ActionResultType.SUCCESS; } else { - return ((PipeTileEntity) world.getTileEntity(pos)).getAttachmentManager().hasAttachment(dir) ? ActionResultType.SUCCESS : ActionResultType.FAIL; + return ((PipeTileEntity) world.getBlockEntity(pos)).getAttachmentManager().hasAttachment(dir) ? ActionResultType.SUCCESS : ActionResultType.FAIL; } } @@ -166,12 +166,12 @@ private ActionResultType openAttachmentContainer(PlayerEntity player, BlockPos p @Nullable @Override public BlockState getStateForPlacement(BlockItemUseContext ctx) { - return getState(getDefaultState(), ctx.getWorld(), ctx.getPos()); + return getState(defaultBlockState(), ctx.getLevel(), ctx.getClickedPos()); } @Override @SuppressWarnings("deprecation") - public BlockState updatePostPlacement(BlockState state, Direction dir, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) { + public BlockState updateShape(BlockState state, Direction dir, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) { return getState(state, world, pos); } @@ -183,26 +183,26 @@ public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, I private BlockState getState(BlockState currentState, IWorld world, BlockPos pos) { return currentState - .with(NORTH, hasConnection(world, pos, Direction.NORTH)) - .with(EAST, hasConnection(world, pos, Direction.EAST)) - .with(SOUTH, hasConnection(world, pos, Direction.SOUTH)) - .with(WEST, hasConnection(world, pos, Direction.WEST)) - .with(UP, hasConnection(world, pos, Direction.UP)) - .with(DOWN, hasConnection(world, pos, Direction.DOWN)) - .with(INV_NORTH, hasInvConnection(world, pos, Direction.NORTH)) - .with(INV_EAST, hasInvConnection(world, pos, Direction.EAST)) - .with(INV_SOUTH, hasInvConnection(world, pos, Direction.SOUTH)) - .with(INV_WEST, hasInvConnection(world, pos, Direction.WEST)) - .with(INV_UP, hasInvConnection(world, pos, Direction.UP)) - .with(INV_DOWN, hasInvConnection(world, pos, Direction.DOWN)); + .setValue(NORTH, hasConnection(world, pos, Direction.NORTH)) + .setValue(EAST, hasConnection(world, pos, Direction.EAST)) + .setValue(SOUTH, hasConnection(world, pos, Direction.SOUTH)) + .setValue(WEST, hasConnection(world, pos, Direction.WEST)) + .setValue(UP, hasConnection(world, pos, Direction.UP)) + .setValue(DOWN, hasConnection(world, pos, Direction.DOWN)) + .setValue(INV_NORTH, hasInvConnection(world, pos, Direction.NORTH)) + .setValue(INV_EAST, hasInvConnection(world, pos, Direction.EAST)) + .setValue(INV_SOUTH, hasInvConnection(world, pos, Direction.SOUTH)) + .setValue(INV_WEST, hasInvConnection(world, pos, Direction.WEST)) + .setValue(INV_UP, hasInvConnection(world, pos, Direction.UP)) + .setValue(INV_DOWN, hasInvConnection(world, pos, Direction.DOWN)); } @Override public ItemStack getPickBlock(BlockState state, RayTraceResult target, IBlockReader world, BlockPos pos, PlayerEntity player) { - Direction dirClicked = getAttachmentDirectionClicked(pos, target.getHitVec()); + Direction dirClicked = getAttachmentDirectionClicked(pos, target.getLocation()); if (dirClicked != null) { - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof PipeTileEntity) { return ((PipeTileEntity) tile).getAttachmentManager().getPickBlock(dirClicked); } @@ -213,27 +213,27 @@ public ItemStack getPickBlock(BlockState state, RayTraceResult target, IBlockRea @Nullable public Direction getAttachmentDirectionClicked(BlockPos pos, Vector3d hit) { - if (Raytracer.inclusiveContains(PipeShapeProps.NORTH_ATTACHMENT_SHAPE.getBoundingBox().offset(pos), hit)) { + if (Raytracer.inclusiveContains(PipeShapeProps.NORTH_ATTACHMENT_SHAPE.bounds().move(pos), hit)) { return Direction.NORTH; } - if (Raytracer.inclusiveContains(PipeShapeProps.EAST_ATTACHMENT_SHAPE.getBoundingBox().offset(pos), hit)) { + if (Raytracer.inclusiveContains(PipeShapeProps.EAST_ATTACHMENT_SHAPE.bounds().move(pos), hit)) { return Direction.EAST; } - if (Raytracer.inclusiveContains(PipeShapeProps.SOUTH_ATTACHMENT_SHAPE.getBoundingBox().offset(pos), hit)) { + if (Raytracer.inclusiveContains(PipeShapeProps.SOUTH_ATTACHMENT_SHAPE.bounds().move(pos), hit)) { return Direction.SOUTH; } - if (Raytracer.inclusiveContains(PipeShapeProps.WEST_ATTACHMENT_SHAPE.getBoundingBox().offset(pos), hit)) { + if (Raytracer.inclusiveContains(PipeShapeProps.WEST_ATTACHMENT_SHAPE.bounds().move(pos), hit)) { return Direction.WEST; } - if (Raytracer.inclusiveContains(PipeShapeProps.UP_ATTACHMENT_SHAPE.getBoundingBox().offset(pos), hit)) { + if (Raytracer.inclusiveContains(PipeShapeProps.UP_ATTACHMENT_SHAPE.bounds().move(pos), hit)) { return Direction.UP; } - if (Raytracer.inclusiveContains(PipeShapeProps.DOWN_ATTACHMENT_SHAPE.getBoundingBox().offset(pos), hit)) { + if (Raytracer.inclusiveContains(PipeShapeProps.DOWN_ATTACHMENT_SHAPE.bounds().move(pos), hit)) { return Direction.DOWN; } diff --git a/src/main/java/com/refinedmods/refinedpipes/container/BaseContainer.java b/src/main/java/com/refinedmods/refinedpipes/container/BaseContainer.java index 804c616..ddcad44 100644 --- a/src/main/java/com/refinedmods/refinedpipes/container/BaseContainer.java +++ b/src/main/java/com/refinedmods/refinedpipes/container/BaseContainer.java @@ -52,16 +52,16 @@ protected void addPlayerInventory(int xInventory, int yInventory) { } @Override - public ItemStack slotClick(int id, int dragType, ClickType clickType, PlayerEntity player) { + public ItemStack clicked(int id, int dragType, ClickType clickType, PlayerEntity player) { Slot slot = id >= 0 ? getSlot(id) : null; - ItemStack holding = player.inventory.getItemStack(); + ItemStack holding = player.inventory.getCarried(); if (slot instanceof FilterSlot) { if (holding.isEmpty()) { - slot.putStack(ItemStack.EMPTY); - } else if (slot.isItemValid(holding)) { - slot.putStack(holding.copy()); + slot.set(ItemStack.EMPTY); + } else if (slot.mayPlace(holding)) { + slot.set(holding.copy()); } return holding; @@ -75,7 +75,7 @@ public ItemStack slotClick(int id, int dragType, ClickType clickType, PlayerEnti return holding; } - return super.slotClick(id, dragType, clickType, player); + return super.clicked(id, dragType, clickType, player); } @Override @@ -89,8 +89,8 @@ protected Slot addSlot(Slot slot) { } @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); + public void broadcastChanges() { + super.broadcastChanges(); if (!(player instanceof ServerPlayerEntity)) { return; @@ -105,13 +105,13 @@ public void detectAndSendChanges() { if (!cached.equals(actual)) { this.fluids.set(i, actual.copy()); - RefinedPipes.NETWORK.sendToClient((ServerPlayerEntity) player, new FluidFilterSlotUpdateMessage(slot.slotNumber, actual)); + RefinedPipes.NETWORK.sendToClient((ServerPlayerEntity) player, new FluidFilterSlotUpdateMessage(slot.getInventoryIndex(), actual)); } } } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return true; } @@ -120,11 +120,11 @@ public List getFluidSlots() { } @Override - public boolean canMergeSlot(ItemStack stack, Slot slot) { + public boolean canTakeItemForPickAll(ItemStack stack, Slot slot) { if (slot instanceof FilterSlot || slot instanceof FluidFilterSlot) { return false; } - return super.canMergeSlot(stack, slot); + return super.canTakeItemForPickAll(stack, slot); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/container/ExtractorAttachmentContainer.java b/src/main/java/com/refinedmods/refinedpipes/container/ExtractorAttachmentContainer.java index c8a3128..b2a3e20 100644 --- a/src/main/java/com/refinedmods/refinedpipes/container/ExtractorAttachmentContainer.java +++ b/src/main/java/com/refinedmods/refinedpipes/container/ExtractorAttachmentContainer.java @@ -139,17 +139,17 @@ public void setExactMode(boolean exactMode) { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int index) { - Slot slot = inventorySlots.get(index); - if (slot != null && slot.getHasStack() && index < 9 * 4) { - for (int i = 9 * 4; i < inventorySlots.size(); ++i) { - Slot filterSlot = inventorySlots.get(i); + public ItemStack quickMoveStack(PlayerEntity player, int index) { + Slot slot = slots.get(index); + if (slot != null && slot.hasItem() && index < 9 * 4) { + for (int i = 9 * 4; i < slots.size(); ++i) { + Slot filterSlot = slots.get(i); if (filterSlot instanceof FluidFilterSlot) { FluidFilterSlot fluidSlot = (FluidFilterSlot) filterSlot; if (fluidSlot.getFluidInventory().getFluid(fluidSlot.getSlotIndex()).isEmpty()) { - FluidStack toInsert = FluidUtil.getFromStack(slot.getStack(), true).getValue(); + FluidStack toInsert = FluidUtil.getFromStack(slot.getItem(), true).getValue(); boolean foundExistingFluid = false; @@ -161,7 +161,7 @@ public ItemStack transferStackInSlot(PlayerEntity player, int index) { } if (!foundExistingFluid) { - fluidSlot.onContainerClicked(slot.getStack()); + fluidSlot.onContainerClicked(slot.getItem()); } break; @@ -169,20 +169,20 @@ public ItemStack transferStackInSlot(PlayerEntity player, int index) { } else if (filterSlot instanceof SlotItemHandler) { SlotItemHandler itemSlot = (SlotItemHandler) filterSlot; - if (!itemSlot.getHasStack()) { - ItemStack toInsert = ItemHandlerHelper.copyStackWithSize(slot.getStack(), 1); + if (!itemSlot.hasItem()) { + ItemStack toInsert = ItemHandlerHelper.copyStackWithSize(slot.getItem(), 1); boolean foundExistingItem = false; for (int j = 0; j < itemSlot.getItemHandler().getSlots(); ++j) { - if (ItemStack.areItemStacksEqual(itemSlot.getItemHandler().getStackInSlot(j), toInsert)) { + if (ItemStack.matches(itemSlot.getItemHandler().getStackInSlot(j), toInsert)) { foundExistingItem = true; break; } } if (!foundExistingItem) { - itemSlot.putStack(toInsert); + itemSlot.set(toInsert); } break; diff --git a/src/main/java/com/refinedmods/refinedpipes/container/slot/FilterSlot.java b/src/main/java/com/refinedmods/refinedpipes/container/slot/FilterSlot.java index a17bf4c..2f7deec 100644 --- a/src/main/java/com/refinedmods/refinedpipes/container/slot/FilterSlot.java +++ b/src/main/java/com/refinedmods/refinedpipes/container/slot/FilterSlot.java @@ -12,11 +12,11 @@ public FilterSlot(IItemHandler handler, int inventoryIndex, int x, int y) { } @Override - public void putStack(@Nonnull ItemStack stack) { + public void set(@Nonnull ItemStack stack) { if (!stack.isEmpty()) { stack.setCount(1); } - super.putStack(stack); + super.set(stack); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/container/slot/FluidFilterSlot.java b/src/main/java/com/refinedmods/refinedpipes/container/slot/FluidFilterSlot.java index 984385c..e677c09 100644 --- a/src/main/java/com/refinedmods/refinedpipes/container/slot/FluidFilterSlot.java +++ b/src/main/java/com/refinedmods/refinedpipes/container/slot/FluidFilterSlot.java @@ -10,15 +10,21 @@ public class FluidFilterSlot extends SlotItemHandler { private FluidInventory fluidInventory; + private final int inventoryIndex; public FluidFilterSlot(FluidInventory inventory, int inventoryIndex, int x, int y) { super(new ItemStackHandler(inventory.getSlots()), inventoryIndex, x, y); this.fluidInventory = inventory; + this.inventoryIndex = inventoryIndex; + } + + public int getInventoryIndex() { + return inventoryIndex; } @Override - public boolean isItemValid(@Nonnull ItemStack stack) { + public boolean mayPlace(@Nonnull ItemStack stack) { return false; } diff --git a/src/main/java/com/refinedmods/refinedpipes/item/AttachmentItem.java b/src/main/java/com/refinedmods/refinedpipes/item/AttachmentItem.java index dc76368..d0eacdf 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/AttachmentItem.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/AttachmentItem.java @@ -15,7 +15,7 @@ public class AttachmentItem extends Item { private final AttachmentFactory type; public AttachmentItem(AttachmentFactory type) { - super(new Item.Properties().group(RefinedPipes.MAIN_GROUP)); + super(new Item.Properties().tab(RefinedPipes.MAIN_GROUP)); this.type = type; @@ -23,8 +23,8 @@ public AttachmentItem(AttachmentFactory type) { } @Override - public void addInformation(ItemStack stack, @Nullable World world, List tooltip, ITooltipFlag flag) { - super.addInformation(stack, world, tooltip, flag); + public void appendHoverText(ItemStack stack, @Nullable World world, List tooltip, ITooltipFlag flag) { + super.appendHoverText(stack, world, tooltip, flag); type.addInformation(tooltip); } diff --git a/src/main/java/com/refinedmods/refinedpipes/item/BaseBlockItem.java b/src/main/java/com/refinedmods/refinedpipes/item/BaseBlockItem.java index 2432bbd..85d1f39 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/BaseBlockItem.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/BaseBlockItem.java @@ -7,7 +7,7 @@ public class BaseBlockItem extends BlockItem { public BaseBlockItem(Block block) { - super(block, new Item.Properties().group(RefinedPipes.MAIN_GROUP)); + super(block, new Item.Properties().tab(RefinedPipes.MAIN_GROUP)); this.setRegistryName(block.getRegistryName()); } diff --git a/src/main/java/com/refinedmods/refinedpipes/item/EnergyPipeBlockItem.java b/src/main/java/com/refinedmods/refinedpipes/item/EnergyPipeBlockItem.java index 8fa0f86..6fdede8 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/EnergyPipeBlockItem.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/EnergyPipeBlockItem.java @@ -24,19 +24,19 @@ public EnergyPipeBlockItem(EnergyPipeBlock block) { } @Override - public void addInformation(ItemStack stack, @Nullable World world, List tooltip, ITooltipFlag flag) { - super.addInformation(stack, world, tooltip, flag); + public void appendHoverText(ItemStack stack, @Nullable World world, List tooltip, ITooltipFlag flag) { + super.appendHoverText(stack, world, tooltip, flag); - tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).mergeStyle(TextFormatting.YELLOW)); + tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).withStyle(TextFormatting.YELLOW)); tooltip.add(new TranslationTextComponent( "tooltip.refinedpipes.energy_pipe.capacity", - new StringTextComponent(StringUtil.formatNumber(type.getCapacity()) + " FE").mergeStyle(TextFormatting.WHITE) - ).mergeStyle(TextFormatting.GRAY)); + new StringTextComponent(StringUtil.formatNumber(type.getCapacity()) + " FE").withStyle(TextFormatting.WHITE) + ).withStyle(TextFormatting.GRAY)); tooltip.add(new TranslationTextComponent( "tooltip.refinedpipes.energy_pipe.transfer_rate", - new StringTextComponent(StringUtil.formatNumber(type.getTransferRate()) + " FE/t").mergeStyle(TextFormatting.WHITE) - ).mergeStyle(TextFormatting.GRAY)); + new StringTextComponent(StringUtil.formatNumber(type.getTransferRate()) + " FE/t").withStyle(TextFormatting.WHITE) + ).withStyle(TextFormatting.GRAY)); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/item/FluidPipeBlockItem.java b/src/main/java/com/refinedmods/refinedpipes/item/FluidPipeBlockItem.java index 840299e..898ba03 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/FluidPipeBlockItem.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/FluidPipeBlockItem.java @@ -24,19 +24,19 @@ public FluidPipeBlockItem(FluidPipeBlock block) { } @Override - public void addInformation(ItemStack stack, @Nullable World world, List tooltip, ITooltipFlag flag) { - super.addInformation(stack, world, tooltip, flag); + public void appendHoverText(ItemStack stack, @Nullable World world, List tooltip, ITooltipFlag flag) { + super.appendHoverText(stack, world, tooltip, flag); - tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).mergeStyle(TextFormatting.YELLOW)); + tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).withStyle(TextFormatting.YELLOW)); tooltip.add(new TranslationTextComponent( "tooltip.refinedpipes.fluid_pipe.capacity", - new StringTextComponent(StringUtil.formatNumber(type.getCapacity()) + " mB").mergeStyle(TextFormatting.WHITE) - ).mergeStyle(TextFormatting.GRAY)); + new StringTextComponent(StringUtil.formatNumber(type.getCapacity()) + " mB").withStyle(TextFormatting.WHITE) + ).withStyle(TextFormatting.GRAY)); tooltip.add(new TranslationTextComponent( "tooltip.refinedpipes.fluid_pipe.transfer_rate", - new StringTextComponent(StringUtil.formatNumber(type.getTransferRate()) + " mB/t").mergeStyle(TextFormatting.WHITE) - ).mergeStyle(TextFormatting.GRAY)); + new StringTextComponent(StringUtil.formatNumber(type.getTransferRate()) + " mB/t").withStyle(TextFormatting.WHITE) + ).withStyle(TextFormatting.GRAY)); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/item/ItemPipeBlockItem.java b/src/main/java/com/refinedmods/refinedpipes/item/ItemPipeBlockItem.java index f56f394..621b1f1 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/ItemPipeBlockItem.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/ItemPipeBlockItem.java @@ -23,14 +23,14 @@ public ItemPipeBlockItem(ItemPipeBlock block) { } @Override - public void addInformation(ItemStack stack, @Nullable World world, List tooltip, ITooltipFlag flag) { - super.addInformation(stack, world, tooltip, flag); + public void appendHoverText(ItemStack stack, @Nullable World world, List tooltip, ITooltipFlag flag) { + super.appendHoverText(stack, world, tooltip, flag); - tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).mergeStyle(TextFormatting.YELLOW)); + tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).withStyle(TextFormatting.YELLOW)); tooltip.add(new TranslationTextComponent( "tooltip.refinedpipes.item_pipe.speed", - new StringTextComponent(type.getSpeedComparedToBasicTier() + "%").mergeStyle(TextFormatting.WHITE) - ).mergeStyle(TextFormatting.GRAY)); + new StringTextComponent(type.getSpeedComparedToBasicTier() + "%").withStyle(TextFormatting.WHITE) + ).withStyle(TextFormatting.GRAY)); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/item/group/MainItemGroup.java b/src/main/java/com/refinedmods/refinedpipes/item/group/MainItemGroup.java index efea0e1..048beca 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/group/MainItemGroup.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/group/MainItemGroup.java @@ -11,7 +11,7 @@ public MainItemGroup() { } @Override - public ItemStack createIcon() { + public ItemStack makeIcon() { return new ItemStack(RefinedPipesItems.BASIC_ITEM_PIPE); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/message/ChangeBlacklistWhitelistMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/ChangeBlacklistWhitelistMessage.java index c1aa70e..0e18f7f 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/ChangeBlacklistWhitelistMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/ChangeBlacklistWhitelistMessage.java @@ -41,7 +41,7 @@ public static ChangeBlacklistWhitelistMessage decode(PacketBuffer buf) { public static void handle(ChangeBlacklistWhitelistMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - TileEntity tile = ctx.get().getSender().world.getTileEntity(message.pos); + TileEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); if (tile instanceof PipeTileEntity) { Attachment attachment = ((PipeTileEntity) tile).getAttachmentManager().getAttachment(message.direction); @@ -49,7 +49,7 @@ public static void handle(ChangeBlacklistWhitelistMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - TileEntity tile = ctx.get().getSender().world.getTileEntity(message.pos); + TileEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); if (tile instanceof PipeTileEntity) { Attachment attachment = ((PipeTileEntity) tile).getAttachmentManager().getAttachment(message.direction); @@ -48,7 +48,7 @@ public static void handle(ChangeExactModeMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - TileEntity tile = ctx.get().getSender().world.getTileEntity(message.pos); + TileEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); if (tile instanceof PipeTileEntity) { Attachment attachment = ((PipeTileEntity) tile).getAttachmentManager().getAttachment(message.direction); @@ -49,7 +49,7 @@ public static void handle(ChangeRedstoneModeMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - TileEntity tile = ctx.get().getSender().world.getTileEntity(message.pos); + TileEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); if (tile instanceof PipeTileEntity) { Attachment attachment = ((PipeTileEntity) tile).getAttachmentManager().getAttachment(message.direction); @@ -49,7 +49,7 @@ public static void handle(ChangeRoutingModeMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - TileEntity tile = ctx.get().getSender().world.getTileEntity(message.pos); + TileEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); if (tile instanceof PipeTileEntity) { Attachment attachment = ((PipeTileEntity) tile).getAttachmentManager().getAttachment(message.direction); @@ -48,7 +48,7 @@ public static void handle(ChangeStackSizeMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - Container container = Minecraft.getInstance().player.openContainer; + Container container = Minecraft.getInstance().player.containerMenu; if (container == null) { return; } - if (message.containerSlot < 0 || message.containerSlot >= container.inventorySlots.size()) { + if (message.containerSlot < 0 || message.containerSlot >= container.slots.size()) { return; } diff --git a/src/main/java/com/refinedmods/refinedpipes/message/FluidPipeMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/FluidPipeMessage.java index dfae38a..405e6f2 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/FluidPipeMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/FluidPipeMessage.java @@ -40,7 +40,7 @@ public static FluidPipeMessage decode(PacketBuffer buf) { public static void handle(FluidPipeMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - TileEntity tile = Minecraft.getInstance().world.getTileEntity(message.pos); + TileEntity tile = Minecraft.getInstance().level.getBlockEntity(message.pos); if (tile instanceof FluidPipeTileEntity) { ((FluidPipeTileEntity) tile).setFluid(message.fluid); diff --git a/src/main/java/com/refinedmods/refinedpipes/message/ItemTransportMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/ItemTransportMessage.java index 6e5a3d8..2001ae1 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/ItemTransportMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/ItemTransportMessage.java @@ -42,7 +42,7 @@ public static ItemTransportMessage decode(PacketBuffer buf) { public static void handle(ItemTransportMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - TileEntity tile = Minecraft.getInstance().world.getTileEntity(message.pos); + TileEntity tile = Minecraft.getInstance().level.getBlockEntity(message.pos); if (tile instanceof ItemPipeTileEntity) { ((ItemPipeTileEntity) tile).setProps(message.props); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/Network.java b/src/main/java/com/refinedmods/refinedpipes/network/Network.java index ff61e31..44e0bfb 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/Network.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/Network.java @@ -42,7 +42,7 @@ public List getDestinations(DestinationType type) { public CompoundNBT writeToNbt(CompoundNBT tag) { tag.putString("id", id); - tag.putLong("origin", originPos.toLong()); + tag.putLong("origin", originPos.asLong()); return tag; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/NetworkManager.java b/src/main/java/com/refinedmods/refinedpipes/network/NetworkManager.java index 4054e53..f2df220 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/NetworkManager.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/NetworkManager.java @@ -31,7 +31,7 @@ public static NetworkManager get(World world) { } public static NetworkManager get(ServerWorld world) { - return world.getSavedData().getOrCreate(() -> new NetworkManager(NAME, world), NAME); + return world.getDataStorage().computeIfAbsent(() -> new NetworkManager(NAME, world), NAME); } private final World world; @@ -53,7 +53,7 @@ public void addNetwork(Network network) { LOGGER.debug("Network {} created", network.getId()); - markDirty(); + setDirty(); } public void removeNetwork(String id) { @@ -65,7 +65,7 @@ public void removeNetwork(String id) { LOGGER.debug("Network {} removed", id); - markDirty(); + setDirty(); } private void formNetworkAt(World world, BlockPos pos, ResourceLocation type) { @@ -124,7 +124,7 @@ public void addPipe(Pipe pipe) { LOGGER.debug("Pipe added at {}", pipe.getPos()); - markDirty(); + setDirty(); Set adjacentPipes = findAdjacentPipes(pipe.getPos(), pipe.getNetworkType()); @@ -149,7 +149,7 @@ public void removePipe(BlockPos pos) { LOGGER.debug("Pipe removed at {}", pipe.getPos()); - markDirty(); + setDirty(); if (pipe.getNetwork() != null) { splitNetworks(pipe); @@ -174,7 +174,7 @@ private void splitNetworks(Pipe originPipe) { if (otherPipeInNetwork != null) { otherPipeInNetwork.getNetwork().setOriginPos(otherPipeInNetwork.getPos()); - markDirty(); + setDirty(); NetworkGraphScannerResult result = otherPipeInNetwork.getNetwork().scanGraph( otherPipeInNetwork.getWorld(), @@ -213,7 +213,7 @@ private Set findAdjacentPipes(BlockPos pos, ResourceLocation networkType) Set pipes = new HashSet<>(); for (Direction dir : Direction.values()) { - Pipe pipe = getPipe(pos.offset(dir)); + Pipe pipe = getPipe(pos.relative(dir)); if (pipe != null && pipe.getNetworkType().equals(networkType)) { pipes.add(pipe); @@ -226,7 +226,7 @@ private Set findAdjacentPipes(BlockPos pos, ResourceLocation networkType) @Nullable private Pipe findFirstAdjacentPipe(BlockPos pos, ResourceLocation networkType) { for (Direction dir : Direction.values()) { - Pipe pipe = getPipe(pos.offset(dir)); + Pipe pipe = getPipe(pos.relative(dir)); if (pipe != null && pipe.getNetworkType().equals(networkType)) { return pipe; @@ -246,7 +246,7 @@ public Collection getNetworks() { } @Override - public void read(CompoundNBT tag) { + public void load(CompoundNBT tag) { ListNBT pipes = tag.getList("pipes", Constants.NBT.TAG_COMPOUND); for (INBT pipeTag : pipes) { CompoundNBT pipeTagCompound = (CompoundNBT) pipeTag; @@ -291,7 +291,7 @@ public void read(CompoundNBT tag) { } @Override - public CompoundNBT write(CompoundNBT tag) { + public CompoundNBT save(CompoundNBT tag) { ListNBT pipes = new ListNBT(); this.pipes.values().forEach(p -> { CompoundNBT pipeTag = new CompoundNBT(); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetwork.java b/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetwork.java index dee229c..7084671 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetwork.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetwork.java @@ -62,7 +62,7 @@ public void update(World world) { } for (Destination destination : destinations) { - TileEntity tile = destination.getConnectedPipe().getWorld().getTileEntity(destination.getReceiver()); + TileEntity tile = destination.getConnectedPipe().getWorld().getBlockEntity(destination.getReceiver()); if (tile == null) { continue; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetworkFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetworkFactory.java index 93f2adf..29a7662 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetworkFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetworkFactory.java @@ -27,7 +27,7 @@ public Network create(BlockPos pos) { @Override public Network create(CompoundNBT tag) { - EnergyNetwork network = new EnergyNetwork(BlockPos.fromLong(tag.getLong("origin")), tag.getString("id"), pipeType); + EnergyNetwork network = new EnergyNetwork(BlockPos.of(tag.getLong("origin")), tag.getString("id"), pipeType); LOGGER.debug("Deserialized energy network {} of type {}", network.getId(), network.getType().toString()); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetwork.java b/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetwork.java index d548d6f..69e0156 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetwork.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetwork.java @@ -64,7 +64,7 @@ public void update(World world) { } for (Destination destination : destinations) { - TileEntity tile = destination.getConnectedPipe().getWorld().getTileEntity(destination.getReceiver()); + TileEntity tile = destination.getConnectedPipe().getWorld().getBlockEntity(destination.getReceiver()); if (tile == null) { continue; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetworkFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetworkFactory.java index 322e581..ff31cb3 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetworkFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetworkFactory.java @@ -27,7 +27,7 @@ public Network create(BlockPos pos) { @Override public Network create(CompoundNBT tag) { - FluidNetwork network = new FluidNetwork(BlockPos.fromLong(tag.getLong("origin")), tag.getString("id"), pipeType); + FluidNetwork network = new FluidNetwork(BlockPos.of(tag.getLong("origin")), tag.getString("id"), pipeType); if (tag.contains("tank")) { network.getFluidTank().readFromNBT(tag.getCompound("tank")); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScanner.java b/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScanner.java index 27dd4b0..d21b0ee 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScanner.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScanner.java @@ -70,7 +70,7 @@ private void singleScanAt(NetworkGraphScannerRequest request) { for (Direction dir : Direction.values()) { addRequest(new NetworkGraphScannerRequest( request.getWorld(), - request.getPos().offset(dir), + request.getPos().relative(dir), dir, request )); @@ -85,7 +85,7 @@ private void singleScanAt(NetworkGraphScannerRequest request) { // If this destination is connected to a pipe with an attachment, then this is not a valid destination. if (!connectedPipe.getAttachmentManager().hasAttachment(request.getDirection())) { - TileEntity tile = request.getWorld().getTileEntity(request.getPos()); + TileEntity tile = request.getWorld().getBlockEntity(request.getPos()); if (tile != null) { tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, request.getDirection().getOpposite()) diff --git a/src/main/java/com/refinedmods/refinedpipes/network/item/ItemNetworkFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/item/ItemNetworkFactory.java index e0b46ad..5e27253 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/item/ItemNetworkFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/item/ItemNetworkFactory.java @@ -20,7 +20,7 @@ public Network create(BlockPos pos) { @Override public Network create(CompoundNBT tag) { - ItemNetwork network = new ItemNetwork(BlockPos.fromLong(tag.getLong("origin")), tag.getString("id")); + ItemNetwork network = new ItemNetwork(BlockPos.of(tag.getLong("origin")), tag.getString("id")); LOGGER.debug("Deserialized item network {}", network.getId()); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/Pipe.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/Pipe.java index af2370e..8e7644a 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/Pipe.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/Pipe.java @@ -67,11 +67,11 @@ public void leaveNetwork() { public void sendBlockUpdate() { BlockState state = world.getBlockState(pos); - world.notifyBlockUpdate(pos, state, state, 1 | 2); + world.sendBlockUpdated(pos, state, state, 1 | 2); } public CompoundNBT writeToNbt(CompoundNBT tag) { - tag.putLong("pos", pos.toLong()); + tag.putLong("pos", pos.asLong()); attachmentManager.writeToNbt(tag); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ClientAttachmentManager.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ClientAttachmentManager.java index 952a7e1..276db17 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ClientAttachmentManager.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ClientAttachmentManager.java @@ -56,7 +56,7 @@ public void readUpdate(CompoundNBT tag) { String pickBlockKey = "pb_" + dir.ordinal(); if (tag.contains(attachmentKey) || tag.contains(pickBlockKey)) { - pickBlocks.put(dir, ItemStack.read(tag.getCompound(pickBlockKey))); + pickBlocks.put(dir, ItemStack.of(tag.getCompound(pickBlockKey))); attachmentState[dir.ordinal()] = new ResourceLocation(tag.getString(attachmentKey)); } else { diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ServerAttachmentManager.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ServerAttachmentManager.java index 2278706..196bd91 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ServerAttachmentManager.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ServerAttachmentManager.java @@ -114,7 +114,7 @@ public void writeUpdate(CompoundNBT tag) { for (Direction dir : Direction.values()) { if (hasAttachment(dir)) { tag.putString("attch_" + dir.ordinal(), getAttachment(dir).getId().toString()); - tag.put("pb_" + dir.ordinal(), getAttachment(dir).getDrop().write(new CompoundNBT())); + tag.put("pb_" + dir.ordinal(), getAttachment(dir).getDrop().save(new CompoundNBT())); } } } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachment.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachment.java index f13de88..3e36646 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachment.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachment.java @@ -84,9 +84,9 @@ public void update() { return; } - BlockPos destinationPos = pipe.getPos().offset(getDirection()); + BlockPos destinationPos = pipe.getPos().relative(getDirection()); - TileEntity tile = pipe.getWorld().getTileEntity(destinationPos); + TileEntity tile = pipe.getWorld().getBlockEntity(destinationPos); if (tile == null) { return; } @@ -125,7 +125,7 @@ private void update(ItemNetwork network, BlockPos sourcePos, IItemHandler source return; } - BlockPos fromPos = pipe.getPos().offset(getDirection()); + BlockPos fromPos = pipe.getPos().relative(getDirection()); ((ItemPipe) pipe).addTransport(new ItemTransport( extracted.copy(), @@ -187,7 +187,7 @@ private void update(FluidNetwork network, IFluidHandler source) { network.getFluidTank().fill(drained, IFluidHandler.FluidAction.EXECUTE); - NetworkManager.get(pipe.getWorld()).markDirty(); + NetworkManager.get(pipe.getWorld()).setDirty(); } private boolean acceptsItem(ItemStack stack) { @@ -195,9 +195,9 @@ private boolean acceptsItem(ItemStack stack) { for (int i = 0; i < itemFilter.getSlots(); ++i) { ItemStack filtered = itemFilter.getStackInSlot(i); - boolean equals = filtered.isItemEqual(stack); + boolean equals = filtered.sameItem(stack); if (exactMode) { - equals = equals && ItemStack.areItemStackTagsEqual(filtered, stack); + equals = equals && ItemStack.tagMatches(filtered, stack); } if (equals) { @@ -210,9 +210,9 @@ private boolean acceptsItem(ItemStack stack) { for (int i = 0; i < itemFilter.getSlots(); ++i) { ItemStack filtered = itemFilter.getStackInSlot(i); - boolean equals = filtered.isItemEqual(stack); + boolean equals = filtered.sameItem(stack); if (exactMode) { - equals = equals && ItemStack.areItemStackTagsEqual(filtered, stack); + equals = equals && ItemStack.tagMatches(filtered, stack); } if (equals) { @@ -380,7 +380,7 @@ protected void onContentsChanged(int slot) { super.onContentsChanged(slot); if (attachment != null) { - NetworkManager.get(attachment.pipe.getWorld()).markDirty(); + NetworkManager.get(attachment.pipe.getWorld()).setDirty(); } } }; @@ -393,7 +393,7 @@ protected void onContentsChanged() { super.onContentsChanged(); if (attachment != null) { - NetworkManager.get(attachment.pipe.getWorld()).markDirty(); + NetworkManager.get(attachment.pipe.getWorld()).setDirty(); } } }; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachmentFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachmentFactory.java index 5e4827a..7f9fec4 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachmentFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachmentFactory.java @@ -88,41 +88,41 @@ public ResourceLocation getModelLocation() { @Override public void addInformation(List tooltip) { - tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).mergeStyle(TextFormatting.YELLOW)); + tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).withStyle(TextFormatting.YELLOW)); ITextComponent itemsToExtract = new StringTextComponent(StringUtil.formatNumber(type.getItemsToExtract()) + " ") .append(new TranslationTextComponent("misc.refinedpipes.item" + (type.getItemsToExtract() == 1 ? "" : "s"))) - .mergeStyle(TextFormatting.WHITE); + .withStyle(TextFormatting.WHITE); float itemSecondsInterval = type.getItemTickInterval() / 20F; ITextComponent itemTickInterval = new StringTextComponent(StringUtil.formatNumber(itemSecondsInterval) + " ") .append(new TranslationTextComponent("misc.refinedpipes.second" + (itemSecondsInterval == 1 ? "" : "s"))) - .mergeStyle(TextFormatting.WHITE); + .withStyle(TextFormatting.WHITE); tooltip.add(new TranslationTextComponent( "tooltip.refinedpipes.extractor_attachment.item_extraction_rate", itemsToExtract, itemTickInterval - ).mergeStyle(TextFormatting.GRAY)); + ).withStyle(TextFormatting.GRAY)); ITextComponent fluidsToExtract = new StringTextComponent(StringUtil.formatNumber(type.getFluidsToExtract()) + " mB") - .mergeStyle(TextFormatting.WHITE); + .withStyle(TextFormatting.WHITE); float fluidSecondsInterval = type.getFluidTickInterval() / 20F; ITextComponent fluidTickInterval = new StringTextComponent(StringUtil.formatNumber(fluidSecondsInterval) + " ") .append(new TranslationTextComponent("misc.refinedpipes.second" + (fluidSecondsInterval == 1 ? "" : "s"))) - .mergeStyle(TextFormatting.WHITE); + .withStyle(TextFormatting.WHITE); tooltip.add(new TranslationTextComponent( "tooltip.refinedpipes.extractor_attachment.fluid_extraction_rate", fluidsToExtract, fluidTickInterval - ).mergeStyle(TextFormatting.GRAY)); + ).withStyle(TextFormatting.GRAY)); tooltip.add(new TranslationTextComponent( "tooltip.refinedpipes.extractor_attachment.filter_slots", - new StringTextComponent("" + type.getFilterSlots()).mergeStyle(TextFormatting.WHITE) - ).mergeStyle(TextFormatting.GRAY)); + new StringTextComponent("" + type.getFilterSlots()).withStyle(TextFormatting.WHITE) + ).withStyle(TextFormatting.GRAY)); addAbilityToInformation(tooltip, type.getCanSetRedstoneMode(), "misc.refinedpipes.redstone_mode"); addAbilityToInformation(tooltip, type.getCanSetWhitelistBlacklist(), "misc.refinedpipes.mode"); @@ -133,7 +133,7 @@ public void addInformation(List tooltip) { private void addAbilityToInformation(List tooltip, boolean possible, String key) { tooltip.add( new StringTextComponent(possible ? "âś“ " : "❌ ").append(new TranslationTextComponent(key)) - .mergeStyle(possible ? TextFormatting.GREEN : TextFormatting.RED) + .withStyle(possible ? TextFormatting.GREEN : TextFormatting.RED) ); } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ItemDestinationFinder.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ItemDestinationFinder.java index c8b1cea..cf1a959 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ItemDestinationFinder.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ItemDestinationFinder.java @@ -80,7 +80,7 @@ public Destination find(RoutingMode routingMode, BlockPos sourcePos, ItemStack e } private boolean isDestinationApplicable(BlockPos sourcePos, ItemStack extracted, Destination destination) { - TileEntity tile = destination.getConnectedPipe().getWorld().getTileEntity(destination.getReceiver()); + TileEntity tile = destination.getConnectedPipe().getWorld().getBlockEntity(destination.getReceiver()); if (tile == null) { return false; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/RedstoneMode.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/RedstoneMode.java index 0294c6e..7340595 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/RedstoneMode.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/RedstoneMode.java @@ -13,9 +13,9 @@ public boolean isEnabled(World world, BlockPos pos) { case IGNORED: return true; case HIGH: - return world.isBlockPowered(pos); + return world.hasNeighborSignal(pos); case LOW: - return !world.isBlockPowered(pos); + return !world.hasNeighborSignal(pos); default: return false; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeFactory.java index 527f8ea..1ff55bb 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeFactory.java @@ -9,7 +9,7 @@ public class EnergyPipeFactory implements PipeFactory { @Override public Pipe createFromNbt(World world, CompoundNBT tag) { - BlockPos pos = BlockPos.fromLong(tag.getLong("pos")); + BlockPos pos = BlockPos.of(tag.getLong("pos")); EnergyPipeType pipeType = EnergyPipeType.values()[tag.getInt("type")]; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeFactory.java index 7bdd2d1..096b634 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeFactory.java @@ -9,7 +9,7 @@ public class FluidPipeFactory implements PipeFactory { @Override public Pipe createFromNbt(World world, CompoundNBT tag) { - BlockPos pos = BlockPos.fromLong(tag.getLong("pos")); + BlockPos pos = BlockPos.of(tag.getLong("pos")); FluidPipeType pipeType = FluidPipeType.values()[tag.getInt("type")]; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipe.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipe.java index 96c97f1..0ed9f93 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipe.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipe.java @@ -37,19 +37,19 @@ public void update() { transports.removeAll(transportsToRemove); if (!transportsToAdd.isEmpty() || !transportsToRemove.isEmpty()) { - NetworkManager.get(world).markDirty(); + NetworkManager.get(world).setDirty(); sendTransportUpdate(); } if (!transports.isEmpty()) { - NetworkManager.get(world).markDirty(); + NetworkManager.get(world).setDirty(); } transportsToAdd.clear(); transportsToRemove.clear(); if (transports.removeIf(t -> t.update(network, this))) { - NetworkManager.get(world).markDirty(); + NetworkManager.get(world).setDirty(); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeFactory.java index e1a3278..16f01f5 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeFactory.java @@ -12,7 +12,7 @@ public class ItemPipeFactory implements PipeFactory { @Override public Pipe createFromNbt(World world, CompoundNBT tag) { - BlockPos pos = BlockPos.fromLong(tag.getLong("pos")); + BlockPos pos = BlockPos.of(tag.getLong("pos")); ItemPipeType pipeType = ItemPipeType.values()[tag.getInt("type")]; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeCache.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeCache.java index 8aff2dc..e6a1ec5 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeCache.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeCache.java @@ -37,19 +37,19 @@ public class PipeShapeCache { public PipeShapeCache(PipeShapeFactory shapeFactory) { this.shapeFactory = shapeFactory; - attachmentShapes.add(PipeShapeProps.NORTH_ATTACHMENT_SHAPE.getBoundingBox()); - attachmentShapes.add(PipeShapeProps.EAST_ATTACHMENT_SHAPE.getBoundingBox()); - attachmentShapes.add(PipeShapeProps.SOUTH_ATTACHMENT_SHAPE.getBoundingBox()); - attachmentShapes.add(PipeShapeProps.WEST_ATTACHMENT_SHAPE.getBoundingBox()); - attachmentShapes.add(PipeShapeProps.UP_ATTACHMENT_SHAPE.getBoundingBox()); - attachmentShapes.add(PipeShapeProps.DOWN_ATTACHMENT_SHAPE.getBoundingBox()); + attachmentShapes.add(PipeShapeProps.NORTH_ATTACHMENT_SHAPE.bounds()); + attachmentShapes.add(PipeShapeProps.EAST_ATTACHMENT_SHAPE.bounds()); + attachmentShapes.add(PipeShapeProps.SOUTH_ATTACHMENT_SHAPE.bounds()); + attachmentShapes.add(PipeShapeProps.WEST_ATTACHMENT_SHAPE.bounds()); + attachmentShapes.add(PipeShapeProps.UP_ATTACHMENT_SHAPE.bounds()); + attachmentShapes.add(PipeShapeProps.DOWN_ATTACHMENT_SHAPE.bounds()); } public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext ctx) { VoxelShape shape = createShapeIfNeeded(state, world, pos); if (ctx.getEntity() instanceof PlayerEntity) { - Item inHand = ((PlayerEntity) ctx.getEntity()).getHeldItemMainhand().getItem(); + Item inHand = ((PlayerEntity) ctx.getEntity()).getMainHandItem().getItem(); if (inHand instanceof AttachmentItem) { shape = addFakeAttachmentShape(state.getBlock(), pos, ctx.getEntity(), shape, ((AttachmentItem) inHand).getFactory()); @@ -77,7 +77,7 @@ private VoxelShape addFakeAttachmentShape(Block block, BlockPos pos, Entity enti private VoxelShape createShapeIfNeeded(BlockState state, IBlockReader world, BlockPos pos) { ResourceLocation[] attachmentState; - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof PipeTileEntity) { attachmentState = ((PipeTileEntity) tile).getAttachmentManager().getState(); } else { diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeFactory.java index 1cad3d0..b859e30 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeFactory.java @@ -11,51 +11,51 @@ public class PipeShapeFactory { public VoxelShape createShape(BlockState state, ResourceLocation[] attachmentState) { VoxelShape shape = PipeShapeProps.CORE_SHAPE; - if (state.get(PipeBlock.NORTH)) { + if (state.getValue(PipeBlock.NORTH)) { shape = VoxelShapes.or(shape, PipeShapeProps.NORTH_EXTENSION_SHAPE); } - if (state.get(PipeBlock.EAST)) { + if (state.getValue(PipeBlock.EAST)) { shape = VoxelShapes.or(shape, PipeShapeProps.EAST_EXTENSION_SHAPE); } - if (state.get(PipeBlock.SOUTH)) { + if (state.getValue(PipeBlock.SOUTH)) { shape = VoxelShapes.or(shape, PipeShapeProps.SOUTH_EXTENSION_SHAPE); } - if (state.get(PipeBlock.WEST)) { + if (state.getValue(PipeBlock.WEST)) { shape = VoxelShapes.or(shape, PipeShapeProps.WEST_EXTENSION_SHAPE); } - if (state.get(PipeBlock.UP)) { + if (state.getValue(PipeBlock.UP)) { shape = VoxelShapes.or(shape, PipeShapeProps.UP_EXTENSION_SHAPE); } - if (state.get(PipeBlock.DOWN)) { + if (state.getValue(PipeBlock.DOWN)) { shape = VoxelShapes.or(shape, PipeShapeProps.DOWN_EXTENSION_SHAPE); } - if (attachmentState[Direction.NORTH.ordinal()] != null || state.get(PipeBlock.INV_NORTH)) { + if (attachmentState[Direction.NORTH.ordinal()] != null || state.getValue(PipeBlock.INV_NORTH)) { shape = VoxelShapes.or(shape, PipeShapeProps.NORTH_ATTACHMENT_SHAPE); } - if (attachmentState[Direction.EAST.ordinal()] != null || state.get(PipeBlock.INV_EAST)) { + if (attachmentState[Direction.EAST.ordinal()] != null || state.getValue(PipeBlock.INV_EAST)) { shape = VoxelShapes.or(shape, PipeShapeProps.EAST_ATTACHMENT_SHAPE); } - if (attachmentState[Direction.SOUTH.ordinal()] != null || state.get(PipeBlock.INV_SOUTH)) { + if (attachmentState[Direction.SOUTH.ordinal()] != null || state.getValue(PipeBlock.INV_SOUTH)) { shape = VoxelShapes.or(shape, PipeShapeProps.SOUTH_ATTACHMENT_SHAPE); } - if (attachmentState[Direction.WEST.ordinal()] != null || state.get(PipeBlock.INV_WEST)) { + if (attachmentState[Direction.WEST.ordinal()] != null || state.getValue(PipeBlock.INV_WEST)) { shape = VoxelShapes.or(shape, PipeShapeProps.WEST_ATTACHMENT_SHAPE); } - if (attachmentState[Direction.UP.ordinal()] != null || state.get(PipeBlock.INV_UP)) { + if (attachmentState[Direction.UP.ordinal()] != null || state.getValue(PipeBlock.INV_UP)) { shape = VoxelShapes.or(shape, PipeShapeProps.UP_ATTACHMENT_SHAPE); } - if (attachmentState[Direction.DOWN.ordinal()] != null || state.get(PipeBlock.INV_DOWN)) { + if (attachmentState[Direction.DOWN.ordinal()] != null || state.getValue(PipeBlock.INV_DOWN)) { shape = VoxelShapes.or(shape, PipeShapeProps.DOWN_ATTACHMENT_SHAPE); } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeProps.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeProps.java index b8607b0..0f2fd7d 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeProps.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeProps.java @@ -4,18 +4,18 @@ import net.minecraft.util.math.shapes.VoxelShape; public class PipeShapeProps { - public static final VoxelShape CORE_SHAPE = Block.makeCuboidShape(4, 4, 4, 12, 12, 12); - public static final VoxelShape NORTH_EXTENSION_SHAPE = Block.makeCuboidShape(4, 4, 0, 12, 12, 4); - public static final VoxelShape EAST_EXTENSION_SHAPE = Block.makeCuboidShape(12, 4, 4, 16, 12, 12); - public static final VoxelShape SOUTH_EXTENSION_SHAPE = Block.makeCuboidShape(4, 4, 12, 12, 12, 16); - public static final VoxelShape WEST_EXTENSION_SHAPE = Block.makeCuboidShape(0, 4, 4, 4, 12, 12); - public static final VoxelShape UP_EXTENSION_SHAPE = Block.makeCuboidShape(4, 12, 4, 12, 16, 12); - public static final VoxelShape DOWN_EXTENSION_SHAPE = Block.makeCuboidShape(4, 0, 4, 12, 4, 12); + public static final VoxelShape CORE_SHAPE = Block.box(4, 4, 4, 12, 12, 12); + public static final VoxelShape NORTH_EXTENSION_SHAPE = Block.box(4, 4, 0, 12, 12, 4); + public static final VoxelShape EAST_EXTENSION_SHAPE = Block.box(12, 4, 4, 16, 12, 12); + public static final VoxelShape SOUTH_EXTENSION_SHAPE = Block.box(4, 4, 12, 12, 12, 16); + public static final VoxelShape WEST_EXTENSION_SHAPE = Block.box(0, 4, 4, 4, 12, 12); + public static final VoxelShape UP_EXTENSION_SHAPE = Block.box(4, 12, 4, 12, 16, 12); + public static final VoxelShape DOWN_EXTENSION_SHAPE = Block.box(4, 0, 4, 12, 4, 12); - public static final VoxelShape NORTH_ATTACHMENT_SHAPE = Block.makeCuboidShape(3, 3, 0, 13, 13, 3); - public static final VoxelShape EAST_ATTACHMENT_SHAPE = Block.makeCuboidShape(13, 3, 3, 16, 13, 13); - public static final VoxelShape SOUTH_ATTACHMENT_SHAPE = Block.makeCuboidShape(3, 3, 13, 13, 13, 16); - public static final VoxelShape WEST_ATTACHMENT_SHAPE = Block.makeCuboidShape(0, 3, 3, 3, 13, 13); - public static final VoxelShape UP_ATTACHMENT_SHAPE = Block.makeCuboidShape(3, 13, 3, 13, 16, 13); - public static final VoxelShape DOWN_ATTACHMENT_SHAPE = Block.makeCuboidShape(3, 0, 3, 13, 3, 13); + public static final VoxelShape NORTH_ATTACHMENT_SHAPE = Block.box(3, 3, 0, 13, 13, 3); + public static final VoxelShape EAST_ATTACHMENT_SHAPE = Block.box(13, 3, 3, 16, 13, 13); + public static final VoxelShape SOUTH_ATTACHMENT_SHAPE = Block.box(3, 3, 13, 13, 13, 16); + public static final VoxelShape WEST_ATTACHMENT_SHAPE = Block.box(0, 3, 3, 3, 13, 13); + public static final VoxelShape UP_ATTACHMENT_SHAPE = Block.box(3, 13, 3, 13, 16, 13); + public static final VoxelShape DOWN_ATTACHMENT_SHAPE = Block.box(3, 0, 3, 13, 3, 13); } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransport.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransport.java index 98180dd..198454b 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransport.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransport.java @@ -93,8 +93,8 @@ public boolean update(Network network, ItemPipe currentPipe) { double progress = (double) progressInCurrentPipe / (double) getMaxTicksInPipe(currentPipe); - BlockPos nextPos = currentPipe.getPos().offset(getDirection(currentPipe)); - if (progress > 0.25 && currentPipe.getWorld().isAirBlock(nextPos)) { + BlockPos nextPos = currentPipe.getPos().relative(getDirection(currentPipe)); + if (progress > 0.25 && currentPipe.getWorld().isEmptyBlock(nextPos)) { currentPipe.removeTransport(this); return onPipeGone(network, currentPipe.getWorld(), nextPos); } @@ -125,27 +125,27 @@ private boolean isLastPipe() { } private static Direction getDirection(BlockPos a, BlockPos b) { - if (a.offset(Direction.NORTH).equals(b)) { + if (a.relative(Direction.NORTH).equals(b)) { return Direction.NORTH; } - if (a.offset(Direction.EAST).equals(b)) { + if (a.relative(Direction.EAST).equals(b)) { return Direction.EAST; } - if (a.offset(Direction.SOUTH).equals(b)) { + if (a.relative(Direction.SOUTH).equals(b)) { return Direction.SOUTH; } - if (a.offset(Direction.WEST).equals(b)) { + if (a.relative(Direction.WEST).equals(b)) { return Direction.WEST; } - if (a.offset(Direction.UP).equals(b)) { + if (a.relative(Direction.UP).equals(b)) { return Direction.UP; } - if (a.offset(Direction.DOWN).equals(b)) { + if (a.relative(Direction.DOWN).equals(b)) { return Direction.DOWN; } @@ -179,13 +179,13 @@ public ItemTransportProps createProps(ItemPipe currentPipe) { } public CompoundNBT writeToNbt(CompoundNBT tag) { - tag.put("v", value.write(new CompoundNBT())); - tag.putLong("src", source.toLong()); - tag.putLong("dst", destination.toLong()); + tag.put("v", value.save(new CompoundNBT())); + tag.putLong("src", source.asLong()); + tag.putLong("dst", destination.asLong()); ListNBT path = new ListNBT(); for (BlockPos pathItem : this.path) { - path.add(LongNBT.valueOf(pathItem.toLong())); + path.add(LongNBT.valueOf(pathItem.asLong())); } tag.put("pth", path); @@ -206,19 +206,19 @@ public CompoundNBT writeToNbt(CompoundNBT tag) { @Nullable public static ItemTransport of(CompoundNBT tag) { - ItemStack value = ItemStack.read(tag.getCompound("v")); + ItemStack value = ItemStack.of(tag.getCompound("v")); if (value.isEmpty()) { LOGGER.warn("Item no longer exists"); return null; } - BlockPos source = BlockPos.fromLong(tag.getLong("src")); - BlockPos destination = BlockPos.fromLong(tag.getLong("dst")); + BlockPos source = BlockPos.of(tag.getLong("src")); + BlockPos destination = BlockPos.of(tag.getLong("dst")); ListNBT pathTag = tag.getList("pth", Constants.NBT.TAG_LONG); Deque path = new ArrayDeque<>(); for (INBT pathItem : pathTag) { - path.add(BlockPos.fromLong(((LongNBT) pathItem).getLong())); + path.add(BlockPos.of(((LongNBT) pathItem).getAsLong())); } Direction initialDirection = DirectionUtil.safeGet((byte) tag.getInt("initd")); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransportProps.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransportProps.java index 0a441c0..8df2576 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransportProps.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransportProps.java @@ -25,7 +25,7 @@ public ItemTransportProps(ItemStack stack, int maxTicksInPipe, int progress, Dir } public void writeToBuffer(PacketBuffer buf) { - buf.writeItemStack(stack); + buf.writeItem(stack); buf.writeInt(maxTicksInPipe); buf.writeInt(progress); buf.writeInt(direction.ordinal()); @@ -36,7 +36,7 @@ public void writeToBuffer(PacketBuffer buf) { public static ItemTransportProps create(PacketBuffer buf) { return new ItemTransportProps( - buf.readItemStack(), + buf.readItem(), buf.readInt(), buf.readInt(), DirectionUtil.safeGet((byte) buf.readInt()), diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemBounceBackTransportCallback.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemBounceBackTransportCallback.java index 7217a89..589e771 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemBounceBackTransportCallback.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemBounceBackTransportCallback.java @@ -31,7 +31,7 @@ public ItemBounceBackTransportCallback(BlockPos originalItemHandlerPosition, Blo @Override public void call(Network network, World world, BlockPos currentPos, TransportCallback cancelCallback) { // TODO: Actually bounce back... - InventoryHelper.spawnItemStack(world, originalItemHandlerPosition.getX(), originalItemHandlerPosition.getY(), originalItemHandlerPosition.getZ(), toInsert); + InventoryHelper.dropItemStack(world, originalItemHandlerPosition.getX(), originalItemHandlerPosition.getY(), originalItemHandlerPosition.getZ(), toInsert); } @Override @@ -41,9 +41,9 @@ public ResourceLocation getId() { @Nullable public static ItemBounceBackTransportCallback of(CompoundNBT tag) { - BlockPos originalItemHandlerPosition = BlockPos.fromLong(tag.getLong("oihpos")); - BlockPos bounceBackItemHandlerPosition = BlockPos.fromLong(tag.getLong("bbihpos")); - ItemStack toInsert = ItemStack.read(tag.getCompound("s")); + BlockPos originalItemHandlerPosition = BlockPos.of(tag.getLong("oihpos")); + BlockPos bounceBackItemHandlerPosition = BlockPos.of(tag.getLong("bbihpos")); + ItemStack toInsert = ItemStack.of(tag.getCompound("s")); if (toInsert.isEmpty()) { LOGGER.warn("Item no longer exists"); @@ -55,9 +55,9 @@ public static ItemBounceBackTransportCallback of(CompoundNBT tag) { @Override public CompoundNBT writeToNbt(CompoundNBT tag) { - tag.putLong("oihpos", originalItemHandlerPosition.toLong()); - tag.putLong("bbihpos", bounceBackItemHandlerPosition.toLong()); - tag.put("s", toInsert.write(new CompoundNBT())); + tag.putLong("oihpos", originalItemHandlerPosition.asLong()); + tag.putLong("bbihpos", bounceBackItemHandlerPosition.asLong()); + tag.put("s", toInsert.save(new CompoundNBT())); return tag; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemInsertTransportCallback.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemInsertTransportCallback.java index e0ded98..6a44a0c 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemInsertTransportCallback.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemInsertTransportCallback.java @@ -35,7 +35,7 @@ public ItemInsertTransportCallback(BlockPos itemHandlerPosition, Direction incom @Override public void call(Network network, World world, BlockPos currentPos, TransportCallback cancelCallback) { - TileEntity tile = world.getTileEntity(itemHandlerPosition); + TileEntity tile = world.getBlockEntity(itemHandlerPosition); if (tile == null) { LOGGER.warn("Destination item handler is gone at " + itemHandlerPosition); cancelCallback.call(network, world, currentPos, cancelCallback); @@ -63,8 +63,8 @@ public ResourceLocation getId() { @Nullable public static ItemInsertTransportCallback of(CompoundNBT tag) { - BlockPos itemHandlerPosition = BlockPos.fromLong(tag.getLong("ihpos")); - ItemStack toInsert = ItemStack.read(tag.getCompound("s")); + BlockPos itemHandlerPosition = BlockPos.of(tag.getLong("ihpos")); + ItemStack toInsert = ItemStack.of(tag.getCompound("s")); Direction incomingDirection = DirectionUtil.safeGet((byte) tag.getInt("incdir")); if (toInsert.isEmpty()) { @@ -77,8 +77,8 @@ public static ItemInsertTransportCallback of(CompoundNBT tag) { @Override public CompoundNBT writeToNbt(CompoundNBT tag) { - tag.putLong("ihpos", itemHandlerPosition.toLong()); - tag.put("s", toInsert.write(new CompoundNBT())); + tag.putLong("ihpos", itemHandlerPosition.asLong()); + tag.put("s", toInsert.save(new CompoundNBT())); tag.putInt("incdir", incomingDirection.ordinal()); return tag; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemPipeGoneTransportCallback.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemPipeGoneTransportCallback.java index 8f5ccea..6da02c4 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemPipeGoneTransportCallback.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemPipeGoneTransportCallback.java @@ -26,7 +26,7 @@ public ItemPipeGoneTransportCallback(ItemStack stack) { @Override public void call(Network network, World world, BlockPos currentPos, TransportCallback cancelCallback) { - InventoryHelper.spawnItemStack(world, currentPos.getX(), currentPos.getY(), currentPos.getZ(), stack); + InventoryHelper.dropItemStack(world, currentPos.getX(), currentPos.getY(), currentPos.getZ(), stack); } @Override @@ -36,7 +36,7 @@ public ResourceLocation getId() { @Nullable public static ItemPipeGoneTransportCallback of(CompoundNBT tag) { - ItemStack stack = ItemStack.read(tag.getCompound("s")); + ItemStack stack = ItemStack.of(tag.getCompound("s")); if (stack.isEmpty()) { LOGGER.warn("Item no longer exists"); @@ -48,7 +48,7 @@ public static ItemPipeGoneTransportCallback of(CompoundNBT tag) { @Override public CompoundNBT writeToNbt(CompoundNBT tag) { - tag.put("s", stack.write(new CompoundNBT())); + tag.put("s", stack.save(new CompoundNBT())); return tag; } diff --git a/src/main/java/com/refinedmods/refinedpipes/render/CubeBuilder.java b/src/main/java/com/refinedmods/refinedpipes/render/CubeBuilder.java index b32097b..180e12e 100644 --- a/src/main/java/com/refinedmods/refinedpipes/render/CubeBuilder.java +++ b/src/main/java/com/refinedmods/refinedpipes/render/CubeBuilder.java @@ -20,7 +20,7 @@ public void putCube(MatrixStack matrixStack, IVertexBuilder builder, float x1, f } public void putCube(MatrixStack matrixStack, IVertexBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2, int r, int g, int b, int a, int light, TextureAtlasSprite sprite, @Nullable Direction exclude) { - matrixStack.push(); + matrixStack.pushPose(); for (Direction face : Direction.values()) { if (face != exclude) { @@ -28,7 +28,7 @@ public void putCube(MatrixStack matrixStack, IVertexBuilder builder, float x1, f } } - matrixStack.pop(); + matrixStack.popPose(); } public void putFace(MatrixStack matrixStack, IVertexBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2, int r, int g, int b, int a, int light, TextureAtlasSprite sprite, Direction face) { @@ -80,40 +80,40 @@ private UvVector getDefaultUv(Direction face, TextureAtlasSprite texture, float switch (face) { case DOWN: - uv.u1 = texture.getInterpolatedU(x1 * 16); - uv.v1 = texture.getInterpolatedV(z1 * 16); - uv.u2 = texture.getInterpolatedU(x2 * 16); - uv.v2 = texture.getInterpolatedV(z2 * 16); + uv.u1 = texture.getU(x1 * 16); + uv.v1 = texture.getV(z1 * 16); + uv.u2 = texture.getU(x2 * 16); + uv.v2 = texture.getV(z2 * 16); break; case UP: - uv.u1 = texture.getInterpolatedU(x1 * 16); - uv.v1 = texture.getInterpolatedV(z1 * 16); - uv.u2 = texture.getInterpolatedU(x2 * 16); - uv.v2 = texture.getInterpolatedV(z2 * 16); + uv.u1 = texture.getU(x1 * 16); + uv.v1 = texture.getV(z1 * 16); + uv.u2 = texture.getU(x2 * 16); + uv.v2 = texture.getV(z2 * 16); break; case NORTH: - uv.u1 = texture.getInterpolatedU(x1 * 16); - uv.v1 = texture.getInterpolatedV(16 - y1 * 16); - uv.u2 = texture.getInterpolatedU(x2 * 16); - uv.v2 = texture.getInterpolatedV(16 - y2 * 16); + uv.u1 = texture.getU(x1 * 16); + uv.v1 = texture.getV(16 - y1 * 16); + uv.u2 = texture.getU(x2 * 16); + uv.v2 = texture.getV(16 - y2 * 16); break; case SOUTH: - uv.u1 = texture.getInterpolatedU(x1 * 16); - uv.v1 = texture.getInterpolatedV(16 - y1 * 16); - uv.u2 = texture.getInterpolatedU(x2 * 16); - uv.v2 = texture.getInterpolatedV(16 - y2 * 16); + uv.u1 = texture.getU(x1 * 16); + uv.v1 = texture.getV(16 - y1 * 16); + uv.u2 = texture.getU(x2 * 16); + uv.v2 = texture.getV(16 - y2 * 16); break; case WEST: - uv.u1 = texture.getInterpolatedU(z1 * 16); - uv.v1 = texture.getInterpolatedV(16 - y1 * 16); - uv.u2 = texture.getInterpolatedU(z2 * 16); - uv.v2 = texture.getInterpolatedV(16 - y2 * 16); + uv.u1 = texture.getU(z1 * 16); + uv.v1 = texture.getV(16 - y1 * 16); + uv.u2 = texture.getU(z2 * 16); + uv.v2 = texture.getV(16 - y2 * 16); break; case EAST: - uv.u1 = texture.getInterpolatedU(z2 * 16); - uv.v1 = texture.getInterpolatedV(16 - y1 * 16); - uv.u2 = texture.getInterpolatedU(z1 * 16); - uv.v2 = texture.getInterpolatedV(16 - y2 * 16); + uv.u1 = texture.getU(z2 * 16); + uv.v1 = texture.getV(16 - y1 * 16); + uv.u2 = texture.getU(z1 * 16); + uv.v2 = texture.getV(16 - y2 * 16); break; } @@ -233,10 +233,10 @@ private void putVertexBL(IVertexBuilder builder, MatrixStack matrixStack, Direct } private void putVertex(IVertexBuilder builder, MatrixStack matrixStack, int r, int g, int b, int a, int light, float x, float y, float z, float u, float v) { - builder.pos(matrixStack.getLast().getMatrix(), x, y, z) + builder.vertex(matrixStack.last().pose(), x, y, z) .color(r, g, b, a) - .tex(u, v) - .lightmap(light) + .uv(u, v) + .uv2(light) .endVertex(); } diff --git a/src/main/java/com/refinedmods/refinedpipes/render/FluidPipeTileEntityRenderer.java b/src/main/java/com/refinedmods/refinedpipes/render/FluidPipeTileEntityRenderer.java index b70717b..c987c8d 100644 --- a/src/main/java/com/refinedmods/refinedpipes/render/FluidPipeTileEntityRenderer.java +++ b/src/main/java/com/refinedmods/refinedpipes/render/FluidPipeTileEntityRenderer.java @@ -28,12 +28,12 @@ public FluidPipeTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { @Override @SuppressWarnings("deprecation") public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer bufferType, int combinedLight, int combinedOverlay) { - World world = tile.getWorld(); + World world = tile.getLevel(); if (world == null) { return; } - BlockState state = world.getBlockState(tile.getPos()); + BlockState state = world.getBlockState(tile.getBlockPos()); if (!(state.getBlock() instanceof FluidPipeBlock)) { return; } @@ -44,9 +44,9 @@ public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack mat return; } - int light = WorldRenderer.getCombinedLight(tile.getWorld(), tile.getPos()); + int light = WorldRenderer.getLightColor(tile.getLevel(), tile.getBlockPos()); FluidAttributes attributes = fluidStack.getFluid().getAttributes(); - TextureAtlasSprite sprite = Minecraft.getInstance().getAtlasSpriteGetter(PlayerContainer.LOCATION_BLOCKS_TEXTURE).apply(attributes.getStillTexture(fluidStack)); + TextureAtlasSprite sprite = Minecraft.getInstance().getTextureAtlas(PlayerContainer.BLOCK_ATLAS).apply(attributes.getStillTexture(fluidStack)); int fluidColor = attributes.getColor(fluidStack); int r = fluidColor >> 16 & 0xFF; @@ -54,14 +54,14 @@ public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack mat int b = fluidColor & 0xFF; int a = fluidColor >> 24 & 0xFF; - IVertexBuilder buffer = bufferType.getBuffer(RenderType.getText(sprite.getAtlasTexture().getTextureLocation())); + IVertexBuilder buffer = bufferType.getBuffer(RenderType.text(sprite.atlas().location())); float fullness = tile.updateAndGetRenderFullness(partialTicks); if (fullness == 0) { return; } - if (state.get(FluidPipeBlock.NORTH)) { + if (state.getValue(FluidPipeBlock.NORTH)) { float x1 = 4; float y1 = 4; float z1 = 0; @@ -88,7 +88,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack mat ); } - if (state.get(FluidPipeBlock.EAST)) { + if (state.getValue(FluidPipeBlock.EAST)) { float x1 = 12; float y1 = 4; float z1 = 4; @@ -115,7 +115,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack mat ); } - if (state.get(FluidPipeBlock.SOUTH)) { + if (state.getValue(FluidPipeBlock.SOUTH)) { float x1 = 4; float y1 = 4; float z1 = 12; @@ -142,7 +142,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack mat ); } - if (state.get(FluidPipeBlock.WEST)) { + if (state.getValue(FluidPipeBlock.WEST)) { float x1 = 0; float y1 = 4; float z1 = 4; @@ -169,7 +169,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack mat ); } - if (state.get(FluidPipeBlock.UP)) { + if (state.getValue(FluidPipeBlock.UP)) { float x1 = 4; float y1 = 12; float z1 = 4; @@ -210,7 +210,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack mat ); } - if (state.get(FluidPipeBlock.DOWN)) { + if (state.getValue(FluidPipeBlock.DOWN)) { float x1 = 4; float y1 = 0; float z1 = 4; @@ -253,7 +253,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack mat float y2 = 4 + (fullness * (12 - 4)); float z2 = 12; - matrixStack.push(); + matrixStack.pushPose(); CubeBuilder.INSTANCE.putFace( matrixStack, @@ -291,7 +291,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack mat Direction.DOWN ); - if (!state.get(FluidPipeBlock.NORTH)) { + if (!state.getValue(FluidPipeBlock.NORTH)) { CubeBuilder.INSTANCE.putFace( matrixStack, buffer, @@ -311,7 +311,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack mat ); } - if (!state.get(FluidPipeBlock.EAST)) { + if (!state.getValue(FluidPipeBlock.EAST)) { CubeBuilder.INSTANCE.putFace( matrixStack, buffer, @@ -331,7 +331,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack mat ); } - if (!state.get(FluidPipeBlock.SOUTH)) { + if (!state.getValue(FluidPipeBlock.SOUTH)) { CubeBuilder.INSTANCE.putFace( matrixStack, buffer, @@ -351,7 +351,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack mat ); } - if (!state.get(FluidPipeBlock.WEST)) { + if (!state.getValue(FluidPipeBlock.WEST)) { CubeBuilder.INSTANCE.putFace( matrixStack, buffer, @@ -371,7 +371,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack mat ); } - matrixStack.pop(); + matrixStack.popPose(); } } } diff --git a/src/main/java/com/refinedmods/refinedpipes/render/FluidRenderer.java b/src/main/java/com/refinedmods/refinedpipes/render/FluidRenderer.java index 61b4217..1bd9472 100644 --- a/src/main/java/com/refinedmods/refinedpipes/render/FluidRenderer.java +++ b/src/main/java/com/refinedmods/refinedpipes/render/FluidRenderer.java @@ -73,7 +73,7 @@ private void drawFluid(final int xPosition, final int yPosition, @Nonnull FluidS private void drawTiledSprite(final int xPosition, final int yPosition, final int tiledWidth, final int tiledHeight, int color, int scaledAmount, TextureAtlasSprite sprite) { Minecraft minecraft = Minecraft.getInstance(); - minecraft.getTextureManager().bindTexture(PlayerContainer.LOCATION_BLOCKS_TEXTURE); + minecraft.getTextureManager().bind(PlayerContainer.BLOCK_ATLAS); setGLColorFromInt(color); final int xTileCount = tiledWidth / TEX_WIDTH; @@ -103,7 +103,7 @@ private static TextureAtlasSprite getStillFluidSprite(FluidStack fluidStack) { Fluid fluid = fluidStack.getFluid(); FluidAttributes attributes = fluid.getAttributes(); ResourceLocation fluidStill = attributes.getStillTexture(fluidStack); - return Minecraft.getInstance().getAtlasSpriteGetter(PlayerContainer.LOCATION_BLOCKS_TEXTURE).apply(fluidStill); + return Minecraft.getInstance().getTextureAtlas(PlayerContainer.BLOCK_ATLAS).apply(fluidStill); } private static void setGLColorFromInt(int color) { @@ -116,20 +116,20 @@ private static void setGLColorFromInt(int color) { } private static void drawTextureWithMasking(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) { - double uMin = textureSprite.getMinU(); - double uMax = textureSprite.getMaxU(); - double vMin = textureSprite.getMinV(); - double vMax = textureSprite.getMaxV(); + double uMin = textureSprite.getU0(); + double uMax = textureSprite.getU1(); + double vMin = textureSprite.getV0(); + double vMax = textureSprite.getV1(); uMax = uMax - (maskRight / 16.0 * (uMax - uMin)); vMax = vMax - (maskTop / 16.0 * (vMax - vMin)); Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferBuilder = tessellator.getBuffer(); + BufferBuilder bufferBuilder = tessellator.getBuilder(); bufferBuilder.begin(7, DefaultVertexFormats.POSITION_TEX); - bufferBuilder.pos(xCoord, yCoord + 16, zLevel).tex((float) uMin, (float) vMax).endVertex(); - bufferBuilder.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex((float) uMax, (float) vMax).endVertex(); - bufferBuilder.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex((float) uMax, (float) vMin).endVertex(); - bufferBuilder.pos(xCoord, yCoord + maskTop, zLevel).tex((float) uMin, (float) vMin).endVertex(); - tessellator.draw(); + bufferBuilder.vertex(xCoord, yCoord + 16, zLevel).uv((float) uMin, (float) vMax).endVertex(); + bufferBuilder.vertex(xCoord + 16 - maskRight, yCoord + 16, zLevel).uv((float) uMax, (float) vMax).endVertex(); + bufferBuilder.vertex(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).uv((float) uMax, (float) vMin).endVertex(); + bufferBuilder.vertex(xCoord, yCoord + maskTop, zLevel).uv((float) uMin, (float) vMin).endVertex(); + tessellator.end(); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/render/ItemPipeTileEntityRenderer.java b/src/main/java/com/refinedmods/refinedpipes/render/ItemPipeTileEntityRenderer.java index 72bc8ee..d2076de 100644 --- a/src/main/java/com/refinedmods/refinedpipes/render/ItemPipeTileEntityRenderer.java +++ b/src/main/java/com/refinedmods/refinedpipes/render/ItemPipeTileEntityRenderer.java @@ -53,23 +53,23 @@ public void render(ItemPipeTileEntity tile, float partialTicks, MatrixStack matr } // If the next pipe is gone.. - if (v > 0.25 && tile.getWorld().isAirBlock(tile.getPos().offset(prop.getDirection()))) { + if (v > 0.25 && tile.getLevel().isEmptyBlock(tile.getBlockPos().relative(prop.getDirection()))) { continue; } v = Math.min(1F, v); - matrixStack.push(); + matrixStack.pushPose(); matrixStack.translate( - 0.5 + (dir.getXOffset() * v), - 0.5 + (dir.getYOffset() * v), - 0.5 + (dir.getZOffset() * v) + 0.5 + (dir.getStepX() * v), + 0.5 + (dir.getStepY() * v), + 0.5 + (dir.getStepZ() * v) ); - matrixStack.rotate(new Quaternion(0, (float) ((Minecraft.getInstance().world.getGameTime() / 25D) % (Math.PI * 2) + (partialTicks / 25D)), 0, false)); + matrixStack.mulPose(new Quaternion(0, (float) ((Minecraft.getInstance().level.getGameTime() / 25D) % (Math.PI * 2) + (partialTicks / 25D)), 0, false)); matrixStack.scale(0.5F, 0.5F, 0.5F); - Minecraft.getInstance().getItemRenderer().renderItem( + Minecraft.getInstance().getItemRenderer().renderStatic( prop.getStack(), ItemCameraTransforms.TransformType.FIXED, combinedLight, @@ -78,7 +78,7 @@ public void render(ItemPipeTileEntity tile, float partialTicks, MatrixStack matr bufferType ); - matrixStack.pop(); + matrixStack.popPose(); } } } diff --git a/src/main/java/com/refinedmods/refinedpipes/render/PipeBakedModel.java b/src/main/java/com/refinedmods/refinedpipes/render/PipeBakedModel.java index 3ca6c7d..60d39b0 100644 --- a/src/main/java/com/refinedmods/refinedpipes/render/PipeBakedModel.java +++ b/src/main/java/com/refinedmods/refinedpipes/render/PipeBakedModel.java @@ -58,12 +58,12 @@ private List createQuads(PipeState state) { List quads = new ArrayList<>(); if (state.getState() != null) { - boolean north = state.getState().get(PipeBlock.NORTH); - boolean east = state.getState().get(PipeBlock.EAST); - boolean south = state.getState().get(PipeBlock.SOUTH); - boolean west = state.getState().get(PipeBlock.WEST); - boolean up = state.getState().get(PipeBlock.UP); - boolean down = state.getState().get(PipeBlock.DOWN); + boolean north = state.getState().getValue(PipeBlock.NORTH); + boolean east = state.getState().getValue(PipeBlock.EAST); + boolean south = state.getState().getValue(PipeBlock.SOUTH); + boolean west = state.getState().getValue(PipeBlock.WEST); + boolean up = state.getState().getValue(PipeBlock.UP); + boolean down = state.getState().getValue(PipeBlock.DOWN); if (north && south && !east && !west && !up && !down) { quads.addAll(straight.getQuads(state.getState(), state.getSide(), state.getRand(), EmptyModelData.INSTANCE)); @@ -113,12 +113,12 @@ private List createQuads(PipeState state) { } if (state.getState() != null) { - boolean invNorth = state.getState().get(PipeBlock.INV_NORTH); - boolean invEast = state.getState().get(PipeBlock.INV_EAST); - boolean invSouth = state.getState().get(PipeBlock.INV_SOUTH); - boolean invWest = state.getState().get(PipeBlock.INV_WEST); - boolean invUp = state.getState().get(PipeBlock.INV_UP); - boolean invDown = state.getState().get(PipeBlock.INV_DOWN); + boolean invNorth = state.getState().getValue(PipeBlock.INV_NORTH); + boolean invEast = state.getState().getValue(PipeBlock.INV_EAST); + boolean invSouth = state.getState().getValue(PipeBlock.INV_SOUTH); + boolean invWest = state.getState().getValue(PipeBlock.INV_WEST); + boolean invUp = state.getState().getValue(PipeBlock.INV_UP); + boolean invDown = state.getState().getValue(PipeBlock.INV_DOWN); if (invNorth && !state.hasAttachmentState(Direction.NORTH)) { quads.addAll(getTransformedQuads(inventoryAttachment, Direction.NORTH, state)); @@ -156,7 +156,7 @@ private static List getTransformedQuads(IBakedModel model, Direction } else if (face == Direction.DOWN) { quaternion = TransformationHelper.quatFromXYZ(new Vector3f(270, 0, 0), true); } else { - double r = Math.PI * (360 - face.getOpposite().getHorizontalIndex() * 90) / 180d; + double r = Math.PI * (360 - face.getOpposite().get2DDataValue() * 90) / 180d; quaternion = TransformationHelper.quatFromXYZ(new Vector3f(0, (float) r, 0), false); } @@ -167,13 +167,13 @@ private static List getTransformedQuads(IBakedModel model, Direction ImmutableList.Builder quads = ImmutableList.builder(); Direction side = state.getSide(); - if (side != null && side.getHorizontalIndex() > -1) { - int faceOffset = 4 + Direction.NORTH.getHorizontalIndex() - facing.getHorizontalIndex(); - side = Direction.byHorizontalIndex((side.getHorizontalIndex() + faceOffset) % 4); + if (side != null && side.get2DDataValue() > -1) { + int faceOffset = 4 + Direction.NORTH.get2DDataValue() - facing.get2DDataValue(); + side = Direction.from2DDataValue((side.get2DDataValue() + faceOffset) % 4); } for (BakedQuad quad : model.getQuads(state.getState(), side, state.getRand(), EmptyModelData.INSTANCE)) { - BakedQuadBuilder builder = new BakedQuadBuilder(quad.func_187508_a()); + BakedQuadBuilder builder = new BakedQuadBuilder(quad.getSprite()); TRSRTransformer transformer = new TRSRTransformer(builder, transformation); quad.pipe(transformer); @@ -185,8 +185,8 @@ private static List getTransformedQuads(IBakedModel model, Direction } @Override - public boolean isAmbientOcclusion() { - return core.isAmbientOcclusion(); + public boolean useAmbientOcclusion() { + return core.useAmbientOcclusion(); } @Override @@ -195,19 +195,19 @@ public boolean isGui3d() { } @Override - public boolean func_230044_c_() { + public boolean usesBlockLight() { return true; } @Override - public boolean isBuiltInRenderer() { - return core.isBuiltInRenderer(); + public boolean isCustomRenderer() { + return core.isCustomRenderer(); } @Override @SuppressWarnings("deprecation") - public TextureAtlasSprite getParticleTexture() { - return core.getParticleTexture(); + public TextureAtlasSprite getParticleIcon() { + return core.getParticleIcon(); } @Override diff --git a/src/main/java/com/refinedmods/refinedpipes/screen/BaseScreen.java b/src/main/java/com/refinedmods/refinedpipes/screen/BaseScreen.java index 701d760..68600fa 100644 --- a/src/main/java/com/refinedmods/refinedpipes/screen/BaseScreen.java +++ b/src/main/java/com/refinedmods/refinedpipes/screen/BaseScreen.java @@ -26,34 +26,34 @@ public BaseScreen(T screenContainer, PlayerInventory inv, ITextComponent title) } @Override - protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - for (FluidFilterSlot slot : container.getFluidSlots()) { + for (FluidFilterSlot slot : menu.getFluidSlots()) { FluidStack stack = slot.getFluidInventory().getFluid(slot.getSlotIndex()); if (stack.isEmpty()) { continue; } - FluidRenderer.INSTANCE.render(guiLeft + slot.xPos, guiTop + slot.yPos, stack); + FluidRenderer.INSTANCE.render(leftPos + slot.x, topPos + slot.y, stack); } } @Override - protected void drawGuiContainerForegroundLayer(MatrixStack matrixStack, int mouseX, int mouseY) { - for (FluidFilterSlot slot : container.getFluidSlots()) { + protected void renderLabels(MatrixStack matrixStack, int mouseX, int mouseY) { + for (FluidFilterSlot slot : menu.getFluidSlots()) { FluidStack stack = slot.getFluidInventory().getFluid(slot.getSlotIndex()); if (stack.isEmpty()) { continue; } - if (!isPointInRegion(slot.xPos, slot.yPos, 17, 17, mouseX, mouseY)) { + if (!isHovering(slot.x, slot.y, 17, 17, mouseX, mouseY)) { continue; } fluidTooltip.set(0, stack.getDisplayName()); - GuiUtils.drawHoveringText(matrixStack, fluidTooltip, mouseX - guiLeft, mouseY - guiTop, width, height, -1, font); + GuiUtils.drawHoveringText(matrixStack, fluidTooltip, mouseX - leftPos, mouseY - topPos, width, height, -1, font); } } } diff --git a/src/main/java/com/refinedmods/refinedpipes/screen/ExtractorAttachmentScreen.java b/src/main/java/com/refinedmods/refinedpipes/screen/ExtractorAttachmentScreen.java index f248fe0..dd2596c 100644 --- a/src/main/java/com/refinedmods/refinedpipes/screen/ExtractorAttachmentScreen.java +++ b/src/main/java/com/refinedmods/refinedpipes/screen/ExtractorAttachmentScreen.java @@ -41,8 +41,8 @@ public class ExtractorAttachmentScreen extends BaseScreen setRedstoneMode((IconButton) btn, container.getRedstoneMode().next()) + getRedstoneModeText(menu.getRedstoneMode()), + btn -> setRedstoneMode((IconButton) btn, menu.getRedstoneMode().next()) )); - redstoneModeButton.active = container.getExtractorAttachmentType().getCanSetRedstoneMode(); + redstoneModeButton.active = menu.getExtractorAttachmentType().getCanSetRedstoneMode(); blacklistWhitelistButton = addButton(new IconButton( - this.guiLeft + 55, - this.guiTop + 76, + this.leftPos + 55, + this.topPos + 76, IconButtonPreset.NORMAL, - getBlacklistWhitelistX(container.getBlacklistWhitelist()), + getBlacklistWhitelistX(menu.getBlacklistWhitelist()), 82, - getBlacklistWhitelistText(container.getBlacklistWhitelist()), - btn -> setBlacklistWhitelist((IconButton) btn, container.getBlacklistWhitelist().next()) + getBlacklistWhitelistText(menu.getBlacklistWhitelist()), + btn -> setBlacklistWhitelist((IconButton) btn, menu.getBlacklistWhitelist().next()) )); - blacklistWhitelistButton.active = container.getExtractorAttachmentType().getCanSetWhitelistBlacklist(); + blacklistWhitelistButton.active = menu.getExtractorAttachmentType().getCanSetWhitelistBlacklist(); exactModeButton = addButton(new IconButton( - this.guiLeft + 78, - this.guiTop + 76, + this.leftPos + 78, + this.topPos + 76, IconButtonPreset.NORMAL, - getExactModeX(container.isExactMode()), + getExactModeX(menu.isExactMode()), 103, - getExactModeText(container.isExactMode()), - btn -> setExactMode((IconButton) btn, !container.isExactMode()) + getExactModeText(menu.isExactMode()), + btn -> setExactMode((IconButton) btn, !menu.isExactMode()) )); - exactModeButton.active = container.getExtractorAttachmentType().getCanSetExactMode(); + exactModeButton.active = menu.getExtractorAttachmentType().getCanSetExactMode(); - if (!container.isFluidMode()) { + if (!menu.isFluidMode()) { routingModeButton = addButton(new IconButton( - this.guiLeft + 101, - this.guiTop + 76, + this.leftPos + 101, + this.topPos + 76, IconButtonPreset.NORMAL, - getRoutingModeX(container.getRoutingMode()), + getRoutingModeX(menu.getRoutingMode()), 194, - getRoutingModeText(container.getRoutingMode()), - btn -> setRoutingMode((IconButton) btn, container.getRoutingMode().next()) + getRoutingModeText(menu.getRoutingMode()), + btn -> setRoutingMode((IconButton) btn, menu.getRoutingMode().next()) )); - routingModeButton.active = container.getExtractorAttachmentType().getCanSetWhitelistBlacklist(); + routingModeButton.active = menu.getExtractorAttachmentType().getCanSetWhitelistBlacklist(); plusButton = addButton(new IconButton( - this.guiLeft + 125, - this.guiTop + 76 - 3, + this.leftPos + 125, + this.topPos + 76 - 3, IconButtonPreset.SMALL, 198, 19, @@ -109,8 +109,8 @@ protected void init() { )); minusButton = addButton(new IconButton( - this.guiLeft + 125, - this.guiTop + 76 + 14 - 3, + this.leftPos + 125, + this.topPos + 76 + 14 - 3, IconButtonPreset.SMALL, 198, 34, @@ -118,8 +118,8 @@ protected void init() { btn -> updateStackSize(-1) )); - minusButton.active = container.getStackSize() > 0; - plusButton.active = container.getStackSize() < container.getExtractorAttachmentType().getItemsToExtract(); + minusButton.active = menu.getStackSize() > 0; + plusButton.active = menu.getStackSize() < menu.getExtractorAttachmentType().getItemsToExtract(); } } @@ -128,19 +128,19 @@ private void updateStackSize(int amount) { amount *= 4; } - int newAmount = container.getStackSize() + amount; + int newAmount = menu.getStackSize() + amount; if (newAmount < 0) { newAmount = 0; } - if (newAmount > container.getExtractorAttachmentType().getItemsToExtract()) { - newAmount = container.getExtractorAttachmentType().getItemsToExtract(); + if (newAmount > menu.getExtractorAttachmentType().getItemsToExtract()) { + newAmount = menu.getExtractorAttachmentType().getItemsToExtract(); } minusButton.active = newAmount > 0; - plusButton.active = newAmount < container.getExtractorAttachmentType().getItemsToExtract(); + plusButton.active = newAmount < menu.getExtractorAttachmentType().getItemsToExtract(); - container.setStackSize(newAmount); + menu.setStackSize(newAmount); } private int getRedstoneModeX(RedstoneMode redstoneMode) { @@ -164,7 +164,7 @@ private void setRedstoneMode(IconButton button, RedstoneMode redstoneMode) { button.setMessage(getRedstoneModeText(redstoneMode)); button.setOverlayTexX(getRedstoneModeX(redstoneMode)); - container.setRedstoneMode(redstoneMode); + menu.setRedstoneMode(redstoneMode); } private int getBlacklistWhitelistX(BlacklistWhitelist blacklistWhitelist) { @@ -186,7 +186,7 @@ private void setBlacklistWhitelist(IconButton button, BlacklistWhitelist blackli button.setMessage(getBlacklistWhitelistText(blacklistWhitelist)); button.setOverlayTexX(getBlacklistWhitelistX(blacklistWhitelist)); - container.setBlacklistWhitelist(blacklistWhitelist); + menu.setBlacklistWhitelist(blacklistWhitelist); } private int getRoutingModeX(RoutingMode routingMode) { @@ -212,7 +212,7 @@ private void setRoutingMode(IconButton button, RoutingMode routingMode) { button.setMessage(getRoutingModeText(routingMode)); button.setOverlayTexX(getRoutingModeX(routingMode)); - container.setRoutingMode(routingMode); + menu.setRoutingMode(routingMode); } private int getExactModeX(boolean exactMode) { @@ -227,57 +227,57 @@ private void setExactMode(IconButton button, boolean exactMode) { button.setMessage(getExactModeText(exactMode)); button.setOverlayTexX(getExactModeX(exactMode)); - container.setExactMode(exactMode); + menu.setExactMode(exactMode); } @Override - protected void drawGuiContainerForegroundLayer(MatrixStack matrixStack, int mouseX, int mouseY) { - font.drawString(matrixStack, title.getString(), 7, 7, 4210752); - font.drawString(matrixStack, I18n.format("container.inventory"), 7, 103 - 4, 4210752); + protected void renderLabels(MatrixStack matrixStack, int mouseX, int mouseY) { + font.draw(matrixStack, title.getString(), 7, 7, 4210752); + font.draw(matrixStack, I18n.get("container.inventory"), 7, 103 - 4, 4210752); - if (!container.isFluidMode()) { - font.drawString(matrixStack, "" + container.getStackSize(), 143, 83, 4210752); + if (!menu.isFluidMode()) { + font.draw(matrixStack, "" + menu.getStackSize(), 143, 83, 4210752); } - func_230459_a_(matrixStack, mouseX - guiLeft, mouseY - guiTop); + renderTooltip(matrixStack, mouseX - leftPos, mouseY - topPos); tooltip.clear(); if (blacklistWhitelistButton.isHovered()) { tooltip.add(new TranslationTextComponent("misc.refinedpipes.mode")); - tooltip.add(getBlacklistWhitelistText(container.getBlacklistWhitelist()).mergeStyle(TextFormatting.GRAY)); + tooltip.add(getBlacklistWhitelistText(menu.getBlacklistWhitelist()).withStyle(TextFormatting.GRAY)); } else if (redstoneModeButton.isHovered()) { tooltip.add(new TranslationTextComponent("misc.refinedpipes.redstone_mode")); - tooltip.add(getRedstoneModeText(container.getRedstoneMode()).mergeStyle(TextFormatting.GRAY)); + tooltip.add(getRedstoneModeText(menu.getRedstoneMode()).withStyle(TextFormatting.GRAY)); } else if (routingModeButton != null && routingModeButton.isHovered()) { tooltip.add(new TranslationTextComponent("misc.refinedpipes.routing_mode")); - tooltip.add(getRoutingModeText(container.getRoutingMode()).mergeStyle(TextFormatting.GRAY)); + tooltip.add(getRoutingModeText(menu.getRoutingMode()).withStyle(TextFormatting.GRAY)); } else if (exactModeButton.isHovered()) { tooltip.add(new TranslationTextComponent("misc.refinedpipes.exact_mode")); - tooltip.add(getExactModeText(container.isExactMode()).mergeStyle(TextFormatting.GRAY)); + tooltip.add(getExactModeText(menu.isExactMode()).withStyle(TextFormatting.GRAY)); } if (!tooltip.isEmpty()) { - GuiUtils.drawHoveringText(matrixStack, tooltip, mouseX - guiLeft, mouseY - guiTop, width, height, -1, Minecraft.getInstance().fontRenderer); + GuiUtils.drawHoveringText(matrixStack, tooltip, mouseX - leftPos, mouseY - topPos, width, height, -1, Minecraft.getInstance().font); } - super.drawGuiContainerForegroundLayer(matrixStack, mouseX, mouseY); + super.renderLabels(matrixStack, mouseX, mouseY); } @Override - protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) { renderBackground(matrixStack); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.minecraft.getTextureManager().bindTexture(RESOURCE); - int i = (this.width - this.xSize) / 2; - int j = (this.height - this.ySize) / 2; - this.blit(matrixStack, i, j, 0, 0, this.xSize, this.ySize); + this.minecraft.getTextureManager().bind(RESOURCE); + int i = (this.width - this.imageWidth) / 2; + int j = (this.height - this.imageHeight) / 2; + this.blit(matrixStack, i, j, 0, 0, this.imageWidth, this.imageHeight); int x = 43; int y = 18; for (int filterSlotId = 1; filterSlotId <= ExtractorAttachment.MAX_FILTER_SLOTS; ++filterSlotId) { - if (filterSlotId > container.getExtractorAttachmentType().getFilterSlots()) { + if (filterSlotId > menu.getExtractorAttachmentType().getFilterSlots()) { this.blit(matrixStack, i + x, j + y, 198, 0, 18, 18); } @@ -289,6 +289,6 @@ protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float pa } } - super.drawGuiContainerBackgroundLayer(matrixStack, partialTicks, mouseX, mouseY); + super.renderBg(matrixStack, partialTicks, mouseX, mouseY); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/screen/widget/IconButton.java b/src/main/java/com/refinedmods/refinedpipes/screen/widget/IconButton.java index 19df996..7a94fe6 100644 --- a/src/main/java/com/refinedmods/refinedpipes/screen/widget/IconButton.java +++ b/src/main/java/com/refinedmods/refinedpipes/screen/widget/IconButton.java @@ -8,6 +8,8 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; +import net.minecraft.client.gui.widget.button.Button.IPressable; + public class IconButton extends Button { private static final ResourceLocation RESOURCE = new ResourceLocation(RefinedPipes.ID, "textures/gui/extractor_attachment.png"); @@ -30,7 +32,7 @@ public void setOverlayTexX(int overlayTexX) { @Override public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { Minecraft minecraft = Minecraft.getInstance(); - minecraft.getTextureManager().bindTexture(RESOURCE); + minecraft.getTextureManager().bind(RESOURCE); RenderSystem.disableDepthTest(); diff --git a/src/main/java/com/refinedmods/refinedpipes/setup/ClientSetup.java b/src/main/java/com/refinedmods/refinedpipes/setup/ClientSetup.java index cdc6402..eb11d00 100644 --- a/src/main/java/com/refinedmods/refinedpipes/setup/ClientSetup.java +++ b/src/main/java/com/refinedmods/refinedpipes/setup/ClientSetup.java @@ -74,17 +74,17 @@ public ClientSetup() { @SubscribeEvent public void onClientSetup(FMLClientSetupEvent e) { - ScreenManager.registerFactory(RefinedPipesContainers.EXTRACTOR_ATTACHMENT, ExtractorAttachmentScreen::new); + ScreenManager.register(RefinedPipesContainers.EXTRACTOR_ATTACHMENT, ExtractorAttachmentScreen::new); - RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.BASIC_ITEM_PIPE, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.IMPROVED_ITEM_PIPE, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.ADVANCED_ITEM_PIPE, RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.BASIC_ITEM_PIPE, RenderType.cutout()); + RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.IMPROVED_ITEM_PIPE, RenderType.cutout()); + RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.ADVANCED_ITEM_PIPE, RenderType.cutout()); - RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.BASIC_FLUID_PIPE, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.IMPROVED_FLUID_PIPE, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.ADVANCED_FLUID_PIPE, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.ELITE_FLUID_PIPE, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.ULTIMATE_FLUID_PIPE, RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.BASIC_FLUID_PIPE, RenderType.cutout()); + RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.IMPROVED_FLUID_PIPE, RenderType.cutout()); + RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.ADVANCED_FLUID_PIPE, RenderType.cutout()); + RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.ELITE_FLUID_PIPE, RenderType.cutout()); + RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.ULTIMATE_FLUID_PIPE, RenderType.cutout()); ClientRegistry.bindTileEntityRenderer(RefinedPipesTileEntities.BASIC_ITEM_PIPE, ItemPipeTileEntityRenderer::new); ClientRegistry.bindTileEntityRenderer(RefinedPipesTileEntities.IMPROVED_ITEM_PIPE, ItemPipeTileEntityRenderer::new); diff --git a/src/main/java/com/refinedmods/refinedpipes/setup/CommonSetup.java b/src/main/java/com/refinedmods/refinedpipes/setup/CommonSetup.java index aee77a9..98c68a0 100644 --- a/src/main/java/com/refinedmods/refinedpipes/setup/CommonSetup.java +++ b/src/main/java/com/refinedmods/refinedpipes/setup/CommonSetup.java @@ -123,21 +123,21 @@ public void onRegisterItems(RegistryEvent.Register e) { @SubscribeEvent public void onRegisterTileEntities(RegistryEvent.Register> e) { - e.getRegistry().register(TileEntityType.Builder.create(() -> new ItemPipeTileEntity(ItemPipeType.BASIC), RefinedPipesBlocks.BASIC_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.BASIC.getId())); - e.getRegistry().register(TileEntityType.Builder.create(() -> new ItemPipeTileEntity(ItemPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.IMPROVED.getId())); - e.getRegistry().register(TileEntityType.Builder.create(() -> new ItemPipeTileEntity(ItemPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.ADVANCED.getId())); - - e.getRegistry().register(TileEntityType.Builder.create(() -> new FluidPipeTileEntity(FluidPipeType.BASIC), RefinedPipesBlocks.BASIC_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.BASIC.getId())); - e.getRegistry().register(TileEntityType.Builder.create(() -> new FluidPipeTileEntity(FluidPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.IMPROVED.getId())); - e.getRegistry().register(TileEntityType.Builder.create(() -> new FluidPipeTileEntity(FluidPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ADVANCED.getId())); - e.getRegistry().register(TileEntityType.Builder.create(() -> new FluidPipeTileEntity(FluidPipeType.ELITE), RefinedPipesBlocks.ELITE_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ELITE.getId())); - e.getRegistry().register(TileEntityType.Builder.create(() -> new FluidPipeTileEntity(FluidPipeType.ULTIMATE), RefinedPipesBlocks.ULTIMATE_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ULTIMATE.getId())); - - e.getRegistry().register(TileEntityType.Builder.create(() -> new EnergyPipeTileEntity(EnergyPipeType.BASIC), RefinedPipesBlocks.BASIC_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.BASIC.getId())); - e.getRegistry().register(TileEntityType.Builder.create(() -> new EnergyPipeTileEntity(EnergyPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.IMPROVED.getId())); - e.getRegistry().register(TileEntityType.Builder.create(() -> new EnergyPipeTileEntity(EnergyPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ADVANCED.getId())); - e.getRegistry().register(TileEntityType.Builder.create(() -> new EnergyPipeTileEntity(EnergyPipeType.ELITE), RefinedPipesBlocks.ELITE_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ELITE.getId())); - e.getRegistry().register(TileEntityType.Builder.create(() -> new EnergyPipeTileEntity(EnergyPipeType.ULTIMATE), RefinedPipesBlocks.ULTIMATE_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ULTIMATE.getId())); + e.getRegistry().register(TileEntityType.Builder.of(() -> new ItemPipeTileEntity(ItemPipeType.BASIC), RefinedPipesBlocks.BASIC_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.BASIC.getId())); + e.getRegistry().register(TileEntityType.Builder.of(() -> new ItemPipeTileEntity(ItemPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.IMPROVED.getId())); + e.getRegistry().register(TileEntityType.Builder.of(() -> new ItemPipeTileEntity(ItemPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.ADVANCED.getId())); + + e.getRegistry().register(TileEntityType.Builder.of(() -> new FluidPipeTileEntity(FluidPipeType.BASIC), RefinedPipesBlocks.BASIC_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.BASIC.getId())); + e.getRegistry().register(TileEntityType.Builder.of(() -> new FluidPipeTileEntity(FluidPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.IMPROVED.getId())); + e.getRegistry().register(TileEntityType.Builder.of(() -> new FluidPipeTileEntity(FluidPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ADVANCED.getId())); + e.getRegistry().register(TileEntityType.Builder.of(() -> new FluidPipeTileEntity(FluidPipeType.ELITE), RefinedPipesBlocks.ELITE_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ELITE.getId())); + e.getRegistry().register(TileEntityType.Builder.of(() -> new FluidPipeTileEntity(FluidPipeType.ULTIMATE), RefinedPipesBlocks.ULTIMATE_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ULTIMATE.getId())); + + e.getRegistry().register(TileEntityType.Builder.of(() -> new EnergyPipeTileEntity(EnergyPipeType.BASIC), RefinedPipesBlocks.BASIC_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.BASIC.getId())); + e.getRegistry().register(TileEntityType.Builder.of(() -> new EnergyPipeTileEntity(EnergyPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.IMPROVED.getId())); + e.getRegistry().register(TileEntityType.Builder.of(() -> new EnergyPipeTileEntity(EnergyPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ADVANCED.getId())); + e.getRegistry().register(TileEntityType.Builder.of(() -> new EnergyPipeTileEntity(EnergyPipeType.ELITE), RefinedPipesBlocks.ELITE_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ELITE.getId())); + e.getRegistry().register(TileEntityType.Builder.of(() -> new EnergyPipeTileEntity(EnergyPipeType.ULTIMATE), RefinedPipesBlocks.ULTIMATE_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ULTIMATE.getId())); } @SubscribeEvent @@ -147,7 +147,7 @@ public void onRegisterContainers(RegistryEvent.Register> e) { @SubscribeEvent public void onWorldTick(TickEvent.WorldTickEvent e) { - if (!e.world.isRemote && e.phase == TickEvent.Phase.END) { + if (!e.world.isClientSide && e.phase == TickEvent.Phase.END) { NetworkManager.get(e.world).getNetworks().forEach(n -> n.update(e.world)); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/tile/BaseTileEntity.java b/src/main/java/com/refinedmods/refinedpipes/tile/BaseTileEntity.java index c1c2f1f..523cb5e 100644 --- a/src/main/java/com/refinedmods/refinedpipes/tile/BaseTileEntity.java +++ b/src/main/java/com/refinedmods/refinedpipes/tile/BaseTileEntity.java @@ -18,17 +18,17 @@ public final CompoundNBT getUpdateTag() { @Override public final SUpdateTileEntityPacket getUpdatePacket() { - return new SUpdateTileEntityPacket(pos, 1, getUpdateTag()); + return new SUpdateTileEntityPacket(worldPosition, 1, getUpdateTag()); } @Override public final void onDataPacket(net.minecraft.network.NetworkManager net, SUpdateTileEntityPacket packet) { - readUpdate(packet.getNbtCompound()); + readUpdate(packet.getTag()); } @Override public final void handleUpdateTag(BlockState state, CompoundNBT tag) { - super.read(state, tag); + super.load(state, tag); readUpdate(tag); } diff --git a/src/main/java/com/refinedmods/refinedpipes/tile/EnergyPipeTileEntity.java b/src/main/java/com/refinedmods/refinedpipes/tile/EnergyPipeTileEntity.java index 5216d6b..4ae3a4d 100644 --- a/src/main/java/com/refinedmods/refinedpipes/tile/EnergyPipeTileEntity.java +++ b/src/main/java/com/refinedmods/refinedpipes/tile/EnergyPipeTileEntity.java @@ -30,10 +30,10 @@ public EnergyPipeTileEntity(EnergyPipeType type) { @Override public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { if (cap == CapabilityEnergy.ENERGY) { - if (!world.isRemote) { - NetworkManager mgr = NetworkManager.get(world); + if (!level.isClientSide) { + NetworkManager mgr = NetworkManager.get(level); - Pipe pipe = mgr.getPipe(pos); + Pipe pipe = mgr.getPipe(worldPosition); if (pipe instanceof EnergyPipe) { return ((EnergyPipe) pipe).getEnergyStorage().cast(); } diff --git a/src/main/java/com/refinedmods/refinedpipes/tile/FluidPipeTileEntity.java b/src/main/java/com/refinedmods/refinedpipes/tile/FluidPipeTileEntity.java index 0a693d6..10bd815 100644 --- a/src/main/java/com/refinedmods/refinedpipes/tile/FluidPipeTileEntity.java +++ b/src/main/java/com/refinedmods/refinedpipes/tile/FluidPipeTileEntity.java @@ -53,7 +53,7 @@ public float updateAndGetRenderFullness(float partialTicks) { @Override public CompoundNBT writeUpdate(CompoundNBT tag) { - Pipe pipe = NetworkManager.get(world).getPipe(pos); + Pipe pipe = NetworkManager.get(level).getPipe(worldPosition); if (pipe instanceof FluidPipe && pipe.getNetwork() != null) { tag.put("fluid", ((FluidNetwork) pipe.getNetwork()).getFluidTank().getFluid().writeToNBT(new CompoundNBT())); tag.putFloat("fullness", ((FluidPipe) pipe).getFullness()); diff --git a/src/main/java/com/refinedmods/refinedpipes/tile/ItemPipeTileEntity.java b/src/main/java/com/refinedmods/refinedpipes/tile/ItemPipeTileEntity.java index 1934df2..4b4ff2f 100644 --- a/src/main/java/com/refinedmods/refinedpipes/tile/ItemPipeTileEntity.java +++ b/src/main/java/com/refinedmods/refinedpipes/tile/ItemPipeTileEntity.java @@ -26,7 +26,7 @@ public ItemPipeTileEntity(ItemPipeType type) { @Override public void tick() { - if (world.isRemote) { + if (level.isClientSide) { props.forEach(ItemTransportProps::tick); } } @@ -44,7 +44,7 @@ protected void spawnDrops(Pipe pipe) { super.spawnDrops(pipe); for (ItemTransport transport : ((ItemPipe) pipe).getTransports()) { - InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), transport.getValue()); + InventoryHelper.dropItemStack(level, worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), transport.getValue()); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/tile/PipeTileEntity.java b/src/main/java/com/refinedmods/refinedpipes/tile/PipeTileEntity.java index 00e84da..bdd3523 100644 --- a/src/main/java/com/refinedmods/refinedpipes/tile/PipeTileEntity.java +++ b/src/main/java/com/refinedmods/refinedpipes/tile/PipeTileEntity.java @@ -29,11 +29,11 @@ public PipeTileEntity(TileEntityType type) { private final AttachmentManager clientAttachmentManager = new ClientAttachmentManager(); public AttachmentManager getAttachmentManager() { - if (world.isRemote) { + if (level.isClientSide) { return clientAttachmentManager; } - Pipe pipe = NetworkManager.get(world).getPipe(pos); + Pipe pipe = NetworkManager.get(level).getPipe(worldPosition); if (pipe != null) { return pipe.getAttachmentManager(); @@ -43,35 +43,35 @@ public AttachmentManager getAttachmentManager() { } @Override - public void validate() { - super.validate(); + public void clearRemoved() { + super.clearRemoved(); - if (!world.isRemote) { - NetworkManager mgr = NetworkManager.get(world); + if (!level.isClientSide) { + NetworkManager mgr = NetworkManager.get(level); - if (mgr.getPipe(pos) == null) { - mgr.addPipe(createPipe(world, pos)); + if (mgr.getPipe(worldPosition) == null) { + mgr.addPipe(createPipe(level, worldPosition)); } } } @Override - public void remove() { - super.remove(); + public void setRemoved() { + super.setRemoved(); - if (!world.isRemote) { - NetworkManager mgr = NetworkManager.get(world); + if (!level.isClientSide) { + NetworkManager mgr = NetworkManager.get(level); - Pipe pipe = mgr.getPipe(pos); + Pipe pipe = mgr.getPipe(worldPosition); if (pipe != null) { spawnDrops(pipe); for (Attachment attachment : pipe.getAttachmentManager().getAttachments()) { - InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), attachment.getDrop()); + InventoryHelper.dropItemStack(level, worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), attachment.getDrop()); } } - mgr.removePipe(pos); + mgr.removePipe(worldPosition); } } @@ -97,8 +97,8 @@ public void readUpdate(CompoundNBT tag) { requestModelDataUpdate(); - BlockState state = world.getBlockState(pos); - world.notifyBlockUpdate(pos, state, state, 1 | 2); + BlockState state = level.getBlockState(worldPosition); + level.sendBlockUpdated(worldPosition, state, state, 1 | 2); } protected abstract Pipe createPipe(World world, BlockPos pos); diff --git a/src/main/java/com/refinedmods/refinedpipes/util/Raytracer.java b/src/main/java/com/refinedmods/refinedpipes/util/Raytracer.java index 40d80f3..234e0ad 100644 --- a/src/main/java/com/refinedmods/refinedpipes/util/Raytracer.java +++ b/src/main/java/com/refinedmods/refinedpipes/util/Raytracer.java @@ -13,9 +13,9 @@ // https://github.com/mekanism/Mekanism/blob/9a3fe1a5d78bb38fa963a3bcbc8d3846412315e4/src/main/java/mekanism/common/util/MultipartUtils.java public class Raytracer { public static Pair getVectors(Entity entity) { - float pitch = entity.rotationPitch; - float yaw = entity.rotationYaw; - Vector3d start = new Vector3d(entity.getPosX(), entity.getPosY() + entity.getEyeHeight(), entity.getPosZ()); + float pitch = entity.xRot; + float yaw = entity.yRot; + Vector3d start = new Vector3d(entity.getX(), entity.getY() + entity.getEyeHeight(), entity.getZ()); float f1 = MathHelper.cos(-yaw * 0.017453292F - (float) Math.PI); float f2 = MathHelper.sin(-yaw * 0.017453292F - (float) Math.PI); float f3 = -MathHelper.cos(-pitch * 0.017453292F); @@ -51,7 +51,7 @@ public static AdvancedRayTraceResult collisionRayTrace(Bloc } public static AdvancedRayTraceResult collisionRayTrace(BlockPos pos, Vector3d start, Vector3d end, AxisAlignedBB bounds, int subHit, Object hitInfo) { - BlockRayTraceResult result = AxisAlignedBB.rayTrace(Collections.singleton(bounds), start, end, pos); + BlockRayTraceResult result = AxisAlignedBB.clip(Collections.singleton(bounds), start, end, pos); if (result == null) { return null; } @@ -76,7 +76,7 @@ public boolean valid() { } public double squareDistanceTo(Vector3d vec) { - return hit.getHitVec().squareDistanceTo(vec); + return hit.getLocation().distanceToSqr(vec); } } From 9634880d3def81768a4d14cfe3aa9885d2b8ae6a Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Fri, 17 Dec 2021 22:59:52 +0100 Subject: [PATCH 4/6] Port to 1.18.1 --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 + .github/workflows/build.yml | 68 +++-- .github/workflows/release.yml | 138 +++++----- CHANGELOG.md | 4 + build.gradle | 14 +- .../refinedpipes/RefinedPipes.java | 31 +-- .../refinedpipes/RefinedPipesContainers.java | 4 +- .../refinedpipes/RefinedPipesNetwork.java | 20 +- .../RefinedPipesTileEntities.java | 28 +-- .../refinedpipes/block/EnergyPipeBlock.java | 44 ++-- .../refinedpipes/block/FluidPipeBlock.java | 42 ++-- .../refinedpipes/block/ItemPipeBlock.java | 52 ++-- .../refinedpipes/block/PipeBlock.java | 92 +++---- .../refinedpipes/container/BaseContainer.java | 40 +-- .../ExtractorAttachmentContainer.java | 46 ++-- .../ExtractorAttachmentContainerFactory.java | 8 +- .../ExtractorAttachmentContainerProvider.java | 56 ++--- .../container/slot/FilterSlot.java | 2 +- .../container/slot/FluidFilterSlot.java | 4 +- .../inventory/fluid/FluidInventory.java | 10 +- .../refinedpipes/item/AttachmentItem.java | 12 +- .../refinedpipes/item/BaseBlockItem.java | 6 +- .../item/EnergyPipeBlockItem.java | 30 +-- .../refinedpipes/item/FluidPipeBlockItem.java | 30 +-- .../refinedpipes/item/ItemPipeBlockItem.java | 24 +- .../item/group/MainItemGroup.java | 6 +- .../ChangeBlacklistWhitelistMessage.java | 16 +- .../message/ChangeExactModeMessage.java | 16 +- .../message/ChangeRedstoneModeMessage.java | 16 +- .../message/ChangeRoutingModeMessage.java | 16 +- .../message/ChangeStackSizeMessage.java | 16 +- .../message/FluidFilterSlotUpdateMessage.java | 14 +- .../message/FluidPipeMessage.java | 14 +- .../message/ItemTransportMessage.java | 14 +- .../refinedpipes/network/Network.java | 14 +- .../refinedpipes/network/NetworkFactory.java | 6 +- .../refinedpipes/network/NetworkManager.java | 75 +++--- .../refinedpipes/network/NetworkRegistry.java | 6 +- .../network/energy/EnergyNetwork.java | 14 +- .../network/energy/EnergyNetworkFactory.java | 6 +- .../network/fluid/FluidNetwork.java | 20 +- .../network/fluid/FluidNetworkFactory.java | 6 +- .../network/graph/NetworkGraph.java | 6 +- .../network/graph/NetworkGraphScanner.java | 14 +- .../graph/NetworkGraphScannerRequest.java | 20 +- .../network/item/ItemNetwork.java | 8 +- .../network/item/ItemNetworkFactory.java | 6 +- .../item/routing/DestinationPathCache.java | 2 +- .../routing/DestinationPathCacheFactory.java | 2 +- .../network/item/routing/EdgeFactory.java | 2 +- .../network/pipe/Destination.java | 4 +- .../refinedpipes/network/pipe/Pipe.java | 22 +- .../network/pipe/PipeFactory.java | 6 +- .../network/pipe/PipeRegistry.java | 2 +- .../network/pipe/attachment/Attachment.java | 14 +- .../pipe/attachment/AttachmentFactory.java | 14 +- .../pipe/attachment/AttachmentManager.java | 16 +- .../pipe/attachment/AttachmentRegistry.java | 2 +- .../attachment/ClientAttachmentManager.java | 18 +- .../attachment/DummyAttachmentManager.java | 19 +- .../attachment/ServerAttachmentManager.java | 37 ++- .../extractor/BlacklistWhitelist.java | 20 +- .../extractor/ExtractorAttachment.java | 100 ++++---- .../extractor/ExtractorAttachmentFactory.java | 64 ++--- .../extractor/ExtractorAttachmentType.java | 24 +- .../extractor/ItemDestinationFinder.java | 8 +- .../attachment/extractor/RedstoneMode.java | 26 +- .../network/pipe/energy/EnergyPipe.java | 12 +- .../pipe/energy/EnergyPipeFactory.java | 8 +- .../network/pipe/energy/EnergyPipeType.java | 6 +- .../network/pipe/fluid/FluidPipe.java | 12 +- .../network/pipe/fluid/FluidPipeFactory.java | 8 +- .../network/pipe/fluid/FluidPipeType.java | 6 +- .../network/pipe/item/ItemPipe.java | 18 +- .../network/pipe/item/ItemPipeFactory.java | 16 +- .../network/pipe/item/ItemPipeType.java | 6 +- .../network/pipe/shape/PipeShapeCache.java | 53 ++-- .../pipe/shape/PipeShapeCacheEntry.java | 4 +- .../network/pipe/shape/PipeShapeFactory.java | 34 +-- .../network/pipe/shape/PipeShapeProps.java | 4 +- .../network/pipe/transport/ItemTransport.java | 237 +++++++++--------- .../pipe/transport/ItemTransportProps.java | 30 +-- .../ItemBounceBackTransportCallback.java | 44 ++-- .../callback/ItemInsertTransportCallback.java | 54 ++-- .../ItemPipeGoneTransportCallback.java | 42 ++-- .../transport/callback/TransportCallback.java | 12 +- .../callback/TransportCallbackFactory.java | 4 +- .../TransportCallbackFactoryRegistry.java | 2 +- .../refinedpipes/render/CubeBuilder.java | 22 +- .../render/FluidPipeTileEntityRenderer.java | 35 ++- .../refinedpipes/render/FluidRenderer.java | 92 ++++--- .../render/ItemPipeTileEntityRenderer.java | 26 +- .../refinedpipes/render/PipeBakedModel.java | 108 ++++---- .../refinedpipes/render/PipeState.java | 6 +- .../refinedpipes/screen/BaseScreen.java | 32 +-- .../screen/ExtractorAttachmentScreen.java | 89 +++---- .../screen/widget/IconButton.java | 18 +- .../refinedpipes/setup/ClientSetup.java | 111 ++++---- .../refinedpipes/setup/CommonSetup.java | 97 +++---- .../refinedpipes/tile/BaseTileEntity.java | 39 +-- .../tile/EnergyPipeTileEntity.java | 13 +- .../tile/FluidPipeTileEntity.java | 30 ++- .../refinedpipes/tile/ItemPipeTileEntity.java | 29 +-- .../refinedpipes/tile/PipeTileEntity.java | 41 +-- .../refinedpipes/util/DirectionUtil.java | 2 +- .../refinedpipes/util/FluidUtil.java | 2 +- .../refinedpipes/util/Raytracer.java | 80 +++--- src/main/resources/META-INF/mods.toml | 2 +- src/main/resources/pack.mcmeta | 2 +- 109 files changed, 1501 insertions(+), 1524 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index eddd4b0..c3d4b35 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -33,6 +33,7 @@ body: attributes: label: What Minecraft version is this happening on? options: + - Minecraft 1.18.1 - Minecraft 1.16.5 - type: input id: forge diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a80204c..080dd9f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,45 +8,37 @@ jobs: strategy: matrix: java: [ - 8 + 17 ] os: [ ubuntu-latest ] runs-on: ${{ matrix.os }} steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1 - - name: Setup JDK ${{ matrix.java }} - uses: actions/setup-java@v1 - with: - java-version: ${{ matrix.java }} - # https://docs.sonarqube.org/latest/analysis/github-integration/ - #- name: Cache SonarQube packages - # uses: actions/cache@v1 - # with: - # path: ~/.sonar/cache - # key: ${{ runner.os }}-sonar - # restore-keys: ${{ runner.os }}-sonar - - name: Cache Gradle packages - uses: actions/cache@v1 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} - restore-keys: ${{ runner.os }}-gradle - - name: Make Gradle wrapper executable - if: ${{ runner.os != 'Windows' }} - run: chmod +x ./gradlew - - name: Build - run: ./gradlew build - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - name: Upload build artifacts - if: ${{ runner.os == 'Linux' && matrix.java == '8' }} - uses: actions/upload-artifact@v2 - with: - name: Artifacts - path: build/libs/ + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Setup JDK ${{ matrix.java }} + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + - name: Cache Gradle packages + uses: actions/cache@v1 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + - name: Make Gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + - name: Build + run: ./gradlew build + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload build artifacts + if: ${{ runner.os == 'Linux' && matrix.java == '17' }} + uses: actions/upload-artifact@v2 + with: + name: Artifacts + path: build/libs/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e1f107f..369d1b8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,69 +7,77 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: Get tag name - uses: olegtarasov/get-tag@v2.1 - id: tagName - - name: Validate semver - run: | - echo $GIT_TAG_NAME | grep -oP '^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' - - name: Checkout repository - uses: actions/checkout@v2 - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1 - - name: Setup JDK 8 - uses: actions/setup-java@v1 - with: - java-version: 8 - - name: Make Gradle wrapper executable - if: ${{ runner.os != 'Windows' }} - run: chmod +x ./gradlew - - name: Build - run: ./gradlew build - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - RELEASE: ${{ steps.tagName.outputs.tag }} - - name: Publish - run: ./gradlew publish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RELEASE: ${{ steps.tagName.outputs.tag }} - - name: Retrieve changelog - id: changelog_reader - uses: mindsers/changelog-reader-action@v2 - with: - version: 'Unreleased' - path: ./CHANGELOG.md - - name: Release on GitHub - uses: softprops/action-gh-release@v1 - id: ghRelease - with: - body: ${{ steps.changelog_reader.outputs.changes }} - name: ${{ steps.tagName.outputs.tag }} - files: | - build/libs/*.jar - - name: Release on CurseForge - run: ./gradlew curseforge - env: - RELEASE: ${{ steps.tagName.outputs.tag }} - CHANGELOG: ${{ steps.changelog_reader.outputs.changes }} - CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} + - name: Get tag name + uses: olegtarasov/get-tag@v2.1 + id: tagName + - name: Validate semver + run: | + echo $GIT_TAG_NAME | grep -oP '^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' + - name: Checkout repository + uses: actions/checkout@v2 + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Setup JDK 17 + uses: actions/setup-java@v1 + with: + java-version: 17 + - name: Make Gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + - name: Build + run: ./gradlew build + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE: ${{ steps.tagName.outputs.tag }} + - name: Build documentation + run: ./gradlew javadoc + env: + RELEASE: ${{ steps.tagName.outputs.tag }} + - name: Publish documentation + uses: JamesIves/github-pages-deploy-action@4.1.5 + with: + branch: gh-pages + folder: build/docs/javadoc + - name: Publish + run: ./gradlew publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE: ${{ steps.tagName.outputs.tag }} + - name: Retrieve changelog + id: changelog_reader + uses: mindsers/changelog-reader-action@v2 + with: + version: 'Unreleased' + path: ./CHANGELOG.md + - name: Release on GitHub + uses: softprops/action-gh-release@v1 + id: ghRelease + with: + body: ${{ steps.changelog_reader.outputs.changes }} + name: ${{ steps.tagName.outputs.tag }} + files: | + build/libs/*.jar + - name: Release on CurseForge + run: ./gradlew curseforge + env: + RELEASE: ${{ steps.tagName.outputs.tag }} + CHANGELOG: ${{ steps.changelog_reader.outputs.changes }} + CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} # This is necessary because the Discord action doesn't support GH actions variable expansion? - - name: Set release URL - run: | - echo "RELEASE_URL=${{ steps.ghRelease.outputs.url }}" >> $GITHUB_ENV - - name: Notify Discord - uses: Ilshidur/action-discord@0.3.2 - with: - args: 'Refined Pipes {{ GIT_TAG_NAME }} has been released! {{ RELEASE_URL }}' - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - - name: Notify Twitter - uses: ethomson/send-tweet-action@v1 - with: - status: Refined Pipes ${{ env.GIT_TAG_NAME }} has been released! ${{ env.RELEASE_URL }} - consumer-key: ${{ secrets.TWITTER_CONSUMER_API_KEY }} - consumer-secret: ${{ secrets.TWITTER_CONSUMER_API_SECRET }} - access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }} - access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} + - name: Set release URL + run: | + echo "RELEASE_URL=${{ steps.ghRelease.outputs.url }}" >> $GITHUB_ENV + - name: Notify Discord + uses: Ilshidur/action-discord@0.3.2 + with: + args: 'Refined Pipes {{ GIT_TAG_NAME }} has been released! {{ RELEASE_URL }}' + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + - name: Notify Twitter + uses: ethomson/send-tweet-action@v1 + with: + status: Refined Pipes ${{ env.GIT_TAG_NAME }} has been released! ${{ env.RELEASE_URL }} + consumer-key: ${{ secrets.TWITTER_CONSUMER_API_KEY }} + consumer-secret: ${{ secrets.TWITTER_CONSUMER_API_SECRET }} + access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }} + access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 00768a5..86c7323 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added + +- Ported to Minecraft 1.18.1. + ## [0.5.1] - 2021-11-28 ### Added diff --git a/build.gradle b/build.gradle index b0ab033..8be752c 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ apply plugin: 'maven-publish' group = 'com.refinedmods' archivesBaseName = 'refinedpipes' -version = '0.5.2' +version = '0.6.0' if (System.getenv('GITHUB_SHA') != null) { version += '+' + System.getenv('GITHUB_SHA').substring(0, 7) @@ -35,10 +35,10 @@ if (System.getenv('RELEASE') != null) { version = System.getenv('RELEASE').substring(1) // remove 'v' } -java.toolchain.languageVersion = JavaLanguageVersion.of(8) +java.toolchain.languageVersion = JavaLanguageVersion.of(17) minecraft { - mappings channel: 'official', version: '1.16.5' + mappings channel: 'official', version: '1.18.1' runs { client { @@ -86,8 +86,8 @@ processResources { } dependencies { - minecraft 'net.minecraftforge:forge:1.16.5-36.2.19' - runtimeOnly fg.deobf("mezz.jei:jei-1.16.5:7.7.1.137") + minecraft 'net.minecraftforge:forge:1.18.1-39.0.0' + runtimeOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.41") } jar { @@ -138,4 +138,8 @@ publishing { } } +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' +} + jar.finalizedBy('reobfJar') diff --git a/src/main/java/com/refinedmods/refinedpipes/RefinedPipes.java b/src/main/java/com/refinedmods/refinedpipes/RefinedPipes.java index 95f1b63..05db198 100644 --- a/src/main/java/com/refinedmods/refinedpipes/RefinedPipes.java +++ b/src/main/java/com/refinedmods/refinedpipes/RefinedPipes.java @@ -4,11 +4,11 @@ import com.refinedmods.refinedpipes.item.group.MainItemGroup; import com.refinedmods.refinedpipes.setup.ClientSetup; import com.refinedmods.refinedpipes.setup.CommonSetup; -import net.minecraft.block.Block; -import net.minecraft.inventory.container.ContainerType; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; -import net.minecraft.tileentity.TileEntityType; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.DistExecutor; @@ -20,22 +20,25 @@ @Mod(RefinedPipes.ID) public class RefinedPipes { public static final String ID = "refinedpipes"; - public static final ItemGroup MAIN_GROUP = new MainItemGroup(); + public static final CreativeModeTab MAIN_GROUP = new MainItemGroup(); public static final RefinedPipesNetwork NETWORK = new RefinedPipesNetwork(); public static final ServerConfig SERVER_CONFIG = new ServerConfig(); public RefinedPipes() { - CommonSetup commonSetup = new CommonSetup(); - - DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> ClientSetup::new); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> { + FMLJavaModLoadingContext.get().getModEventBus().addListener(ClientSetup::onClientSetup); + FMLJavaModLoadingContext.get().getModEventBus().addListener(ClientSetup::onModelBake); + }); ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, SERVER_CONFIG.getSpec()); - FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(Block.class, commonSetup::onRegisterBlocks); - FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(Item.class, commonSetup::onRegisterItems); - FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(TileEntityType.class, commonSetup::onRegisterTileEntities); - FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(ContainerType.class, commonSetup::onRegisterContainers); + FMLJavaModLoadingContext.get().getModEventBus().addListener(CommonSetup::onConstructMod); + FMLJavaModLoadingContext.get().getModEventBus().addListener(CommonSetup::onCommonSetup); + FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(Block.class, CommonSetup::onRegisterBlocks); + FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(Item.class, CommonSetup::onRegisterItems); + FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(BlockEntityType.class, CommonSetup::onRegisterTileEntities); + FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(MenuType.class, CommonSetup::onRegisterContainers); - MinecraftForge.EVENT_BUS.addListener(commonSetup::onWorldTick); + MinecraftForge.EVENT_BUS.addListener(CommonSetup::onWorldTick); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/RefinedPipesContainers.java b/src/main/java/com/refinedmods/refinedpipes/RefinedPipesContainers.java index eef53ee..29a8aa3 100644 --- a/src/main/java/com/refinedmods/refinedpipes/RefinedPipesContainers.java +++ b/src/main/java/com/refinedmods/refinedpipes/RefinedPipesContainers.java @@ -1,10 +1,10 @@ package com.refinedmods.refinedpipes; import com.refinedmods.refinedpipes.container.ExtractorAttachmentContainer; -import net.minecraft.inventory.container.ContainerType; +import net.minecraft.world.inventory.MenuType; import net.minecraftforge.registries.ObjectHolder; public class RefinedPipesContainers { @ObjectHolder(RefinedPipes.ID + ":extractor_attachment") - public static final ContainerType EXTRACTOR_ATTACHMENT = null; + public static final MenuType EXTRACTOR_ATTACHMENT = null; } diff --git a/src/main/java/com/refinedmods/refinedpipes/RefinedPipesNetwork.java b/src/main/java/com/refinedmods/refinedpipes/RefinedPipesNetwork.java index 4e2aac1..74a81f4 100644 --- a/src/main/java/com/refinedmods/refinedpipes/RefinedPipesNetwork.java +++ b/src/main/java/com/refinedmods/refinedpipes/RefinedPipesNetwork.java @@ -1,14 +1,14 @@ package com.refinedmods.refinedpipes; import com.refinedmods.refinedpipes.message.*; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkDirection; -import net.minecraftforge.fml.network.NetworkRegistry; -import net.minecraftforge.fml.network.PacketDistributor; -import net.minecraftforge.fml.network.simple.SimpleChannel; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.level.Level; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkRegistry; +import net.minecraftforge.network.PacketDistributor; +import net.minecraftforge.network.simple.SimpleChannel; public class RefinedPipesNetwork { private final String protocolVersion = Integer.toString(1); @@ -32,7 +32,7 @@ public void register() { handler.registerMessage(id++, FluidFilterSlotUpdateMessage.class, FluidFilterSlotUpdateMessage::encode, FluidFilterSlotUpdateMessage::decode, FluidFilterSlotUpdateMessage::handle); } - public void sendInArea(World world, BlockPos pos, int radius, Object message) { + public void sendInArea(Level world, BlockPos pos, int radius, Object message) { handler.send(PacketDistributor.NEAR.with(() -> new PacketDistributor.TargetPoint( pos.getX(), pos.getY(), @@ -46,7 +46,7 @@ public void sendToServer(Object message) { handler.sendToServer(message); } - public void sendToClient(ServerPlayerEntity player, Object message) { + public void sendToClient(ServerPlayer player, Object message) { handler.sendTo(message, player.connection.connection, NetworkDirection.PLAY_TO_CLIENT); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/RefinedPipesTileEntities.java b/src/main/java/com/refinedmods/refinedpipes/RefinedPipesTileEntities.java index a41b305..2cd5877 100644 --- a/src/main/java/com/refinedmods/refinedpipes/RefinedPipesTileEntities.java +++ b/src/main/java/com/refinedmods/refinedpipes/RefinedPipesTileEntities.java @@ -3,34 +3,34 @@ import com.refinedmods.refinedpipes.tile.EnergyPipeTileEntity; import com.refinedmods.refinedpipes.tile.FluidPipeTileEntity; import com.refinedmods.refinedpipes.tile.ItemPipeTileEntity; -import net.minecraft.tileentity.TileEntityType; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraftforge.registries.ObjectHolder; public class RefinedPipesTileEntities { @ObjectHolder(RefinedPipes.ID + ":basic_item_pipe") - public static final TileEntityType BASIC_ITEM_PIPE = null; + public static final BlockEntityType BASIC_ITEM_PIPE = null; @ObjectHolder(RefinedPipes.ID + ":improved_item_pipe") - public static final TileEntityType IMPROVED_ITEM_PIPE = null; + public static final BlockEntityType IMPROVED_ITEM_PIPE = null; @ObjectHolder(RefinedPipes.ID + ":advanced_item_pipe") - public static final TileEntityType ADVANCED_ITEM_PIPE = null; + public static final BlockEntityType ADVANCED_ITEM_PIPE = null; @ObjectHolder(RefinedPipes.ID + ":basic_fluid_pipe") - public static final TileEntityType BASIC_FLUID_PIPE = null; + public static final BlockEntityType BASIC_FLUID_PIPE = null; @ObjectHolder(RefinedPipes.ID + ":improved_fluid_pipe") - public static final TileEntityType IMPROVED_FLUID_PIPE = null; + public static final BlockEntityType IMPROVED_FLUID_PIPE = null; @ObjectHolder(RefinedPipes.ID + ":advanced_fluid_pipe") - public static final TileEntityType ADVANCED_FLUID_PIPE = null; + public static final BlockEntityType ADVANCED_FLUID_PIPE = null; @ObjectHolder(RefinedPipes.ID + ":elite_fluid_pipe") - public static final TileEntityType ELITE_FLUID_PIPE = null; + public static final BlockEntityType ELITE_FLUID_PIPE = null; @ObjectHolder(RefinedPipes.ID + ":ultimate_fluid_pipe") - public static final TileEntityType ULTIMATE_FLUID_PIPE = null; + public static final BlockEntityType ULTIMATE_FLUID_PIPE = null; @ObjectHolder(RefinedPipes.ID + ":basic_energy_pipe") - public static final TileEntityType BASIC_ENERGY_PIPE = null; + public static final BlockEntityType BASIC_ENERGY_PIPE = null; @ObjectHolder(RefinedPipes.ID + ":improved_energy_pipe") - public static final TileEntityType IMPROVED_ENERGY_PIPE = null; + public static final BlockEntityType IMPROVED_ENERGY_PIPE = null; @ObjectHolder(RefinedPipes.ID + ":advanced_energy_pipe") - public static final TileEntityType ADVANCED_ENERGY_PIPE = null; + public static final BlockEntityType ADVANCED_ENERGY_PIPE = null; @ObjectHolder(RefinedPipes.ID + ":elite_energy_pipe") - public static final TileEntityType ELITE_ENERGY_PIPE = null; + public static final BlockEntityType ELITE_ENERGY_PIPE = null; @ObjectHolder(RefinedPipes.ID + ":ultimate_energy_pipe") - public static final TileEntityType ULTIMATE_ENERGY_PIPE = null; + public static final BlockEntityType ULTIMATE_ENERGY_PIPE = null; } diff --git a/src/main/java/com/refinedmods/refinedpipes/block/EnergyPipeBlock.java b/src/main/java/com/refinedmods/refinedpipes/block/EnergyPipeBlock.java index 7320b3c..94f0685 100644 --- a/src/main/java/com/refinedmods/refinedpipes/block/EnergyPipeBlock.java +++ b/src/main/java/com/refinedmods/refinedpipes/block/EnergyPipeBlock.java @@ -4,18 +4,17 @@ import com.refinedmods.refinedpipes.network.pipe.energy.EnergyPipeType; import com.refinedmods.refinedpipes.network.pipe.shape.PipeShapeCache; import com.refinedmods.refinedpipes.tile.EnergyPipeTileEntity; -import net.minecraft.block.BlockState; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.IWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; - -public class EnergyPipeBlock extends PipeBlock { +public class EnergyPipeBlock extends PipeBlock implements EntityBlock { private final EnergyPipeType type; public EnergyPipeBlock(PipeShapeCache shapeCache, EnergyPipeType type) { @@ -30,26 +29,15 @@ public EnergyPipeType getType() { } @Override - public boolean hasTileEntity(BlockState state) { - return true; - } - - @Nullable - @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new EnergyPipeTileEntity(type); - } - - @Override - protected boolean hasConnection(IWorld world, BlockPos pos, Direction direction) { - TileEntity currentTile = world.getBlockEntity(pos); + protected boolean hasConnection(LevelAccessor world, BlockPos pos, Direction direction) { + BlockEntity currentTile = world.getBlockEntity(pos); if (currentTile instanceof EnergyPipeTileEntity && ((EnergyPipeTileEntity) currentTile).getAttachmentManager().hasAttachment(direction)) { return false; } BlockState facingState = world.getBlockState(pos.relative(direction)); - TileEntity facingTile = world.getBlockEntity(pos.relative(direction)); + BlockEntity facingTile = world.getBlockEntity(pos.relative(direction)); if (facingTile instanceof EnergyPipeTileEntity && ((EnergyPipeTileEntity) facingTile).getAttachmentManager().hasAttachment(direction.getOpposite())) { @@ -61,8 +49,8 @@ protected boolean hasConnection(IWorld world, BlockPos pos, Direction direction) } @Override - protected boolean hasInvConnection(IWorld world, BlockPos pos, Direction direction) { - TileEntity facingTile = world.getBlockEntity(pos.relative(direction)); + protected boolean hasInvConnection(LevelAccessor world, BlockPos pos, Direction direction) { + BlockEntity facingTile = world.getBlockEntity(pos.relative(direction)); if (facingTile == null) { return false; } @@ -78,4 +66,10 @@ protected boolean hasInvConnection(IWorld world, BlockPos pos, Direction directi return true; } + + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new EnergyPipeTileEntity(pos, state, type); + } } diff --git a/src/main/java/com/refinedmods/refinedpipes/block/FluidPipeBlock.java b/src/main/java/com/refinedmods/refinedpipes/block/FluidPipeBlock.java index ff85815..49ed3c5 100644 --- a/src/main/java/com/refinedmods/refinedpipes/block/FluidPipeBlock.java +++ b/src/main/java/com/refinedmods/refinedpipes/block/FluidPipeBlock.java @@ -3,17 +3,15 @@ import com.refinedmods.refinedpipes.network.pipe.fluid.FluidPipeType; import com.refinedmods.refinedpipes.network.pipe.shape.PipeShapeCache; import com.refinedmods.refinedpipes.tile.FluidPipeTileEntity; -import net.minecraft.block.BlockState; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.IWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; -import javax.annotation.Nullable; - -public class FluidPipeBlock extends PipeBlock { +public class FluidPipeBlock extends PipeBlock implements EntityBlock { private final FluidPipeType type; public FluidPipeBlock(PipeShapeCache shapeCache, FluidPipeType type) { @@ -28,26 +26,15 @@ public FluidPipeType getType() { } @Override - public boolean hasTileEntity(BlockState state) { - return true; - } - - @Nullable - @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new FluidPipeTileEntity(type); - } - - @Override - protected boolean hasConnection(IWorld world, BlockPos pos, Direction direction) { - TileEntity currentTile = world.getBlockEntity(pos); + protected boolean hasConnection(LevelAccessor world, BlockPos pos, Direction direction) { + BlockEntity currentTile = world.getBlockEntity(pos); if (currentTile instanceof FluidPipeTileEntity && ((FluidPipeTileEntity) currentTile).getAttachmentManager().hasAttachment(direction)) { return false; } BlockState facingState = world.getBlockState(pos.relative(direction)); - TileEntity facingTile = world.getBlockEntity(pos.relative(direction)); + BlockEntity facingTile = world.getBlockEntity(pos.relative(direction)); if (facingTile instanceof FluidPipeTileEntity && ((FluidPipeTileEntity) facingTile).getAttachmentManager().hasAttachment(direction.getOpposite())) { @@ -59,10 +46,15 @@ protected boolean hasConnection(IWorld world, BlockPos pos, Direction direction) } @Override - protected boolean hasInvConnection(IWorld world, BlockPos pos, Direction direction) { - TileEntity facingTile = world.getBlockEntity(pos.relative(direction)); + protected boolean hasInvConnection(LevelAccessor world, BlockPos pos, Direction direction) { + BlockEntity facingTile = world.getBlockEntity(pos.relative(direction)); return facingTile != null && facingTile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, direction.getOpposite()).isPresent(); } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new FluidPipeTileEntity(pos, state, type); + } } diff --git a/src/main/java/com/refinedmods/refinedpipes/block/ItemPipeBlock.java b/src/main/java/com/refinedmods/refinedpipes/block/ItemPipeBlock.java index 3149ffc..7019326 100644 --- a/src/main/java/com/refinedmods/refinedpipes/block/ItemPipeBlock.java +++ b/src/main/java/com/refinedmods/refinedpipes/block/ItemPipeBlock.java @@ -3,17 +3,19 @@ import com.refinedmods.refinedpipes.network.pipe.item.ItemPipeType; import com.refinedmods.refinedpipes.network.pipe.shape.PipeShapeCache; import com.refinedmods.refinedpipes.tile.ItemPipeTileEntity; -import net.minecraft.block.BlockState; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.IWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.items.CapabilityItemHandler; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; - -public class ItemPipeBlock extends PipeBlock { +public class ItemPipeBlock extends PipeBlock implements EntityBlock { private final ItemPipeType type; public ItemPipeBlock(PipeShapeCache shapeCache, ItemPipeType type) { @@ -28,26 +30,15 @@ public ItemPipeType getType() { } @Override - public boolean hasTileEntity(BlockState state) { - return true; - } - - @Nullable - @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new ItemPipeTileEntity(type); - } - - @Override - protected boolean hasConnection(IWorld world, BlockPos pos, Direction direction) { - TileEntity currentTile = world.getBlockEntity(pos); + protected boolean hasConnection(LevelAccessor world, BlockPos pos, Direction direction) { + BlockEntity currentTile = world.getBlockEntity(pos); if (currentTile instanceof ItemPipeTileEntity && ((ItemPipeTileEntity) currentTile).getAttachmentManager().hasAttachment(direction)) { return false; } BlockState facingState = world.getBlockState(pos.relative(direction)); - TileEntity facingTile = world.getBlockEntity(pos.relative(direction)); + BlockEntity facingTile = world.getBlockEntity(pos.relative(direction)); if (facingTile instanceof ItemPipeTileEntity && ((ItemPipeTileEntity) facingTile).getAttachmentManager().hasAttachment(direction.getOpposite())) { @@ -58,10 +49,21 @@ protected boolean hasConnection(IWorld world, BlockPos pos, Direction direction) } @Override - protected boolean hasInvConnection(IWorld world, BlockPos pos, Direction direction) { - TileEntity facingTile = world.getBlockEntity(pos.relative(direction)); + protected boolean hasInvConnection(LevelAccessor world, BlockPos pos, Direction direction) { + BlockEntity facingTile = world.getBlockEntity(pos.relative(direction)); return facingTile != null && facingTile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, direction.getOpposite()).isPresent(); } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new ItemPipeTileEntity(pos, state, type); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType type) { + return level.isClientSide ? (levelTicker, pos, stateTicker, blockEntity) -> ItemPipeTileEntity.tick((ItemPipeTileEntity) blockEntity) : null; + } } diff --git a/src/main/java/com/refinedmods/refinedpipes/block/PipeBlock.java b/src/main/java/com/refinedmods/refinedpipes/block/PipeBlock.java index edbc2b3..b8b748c 100644 --- a/src/main/java/com/refinedmods/refinedpipes/block/PipeBlock.java +++ b/src/main/java/com/refinedmods/refinedpipes/block/PipeBlock.java @@ -10,28 +10,28 @@ import com.refinedmods.refinedpipes.network.pipe.shape.PipeShapeProps; import com.refinedmods.refinedpipes.tile.PipeTileEntity; import com.refinedmods.refinedpipes.util.Raytracer; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.material.Material; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.item.ItemStack; -import net.minecraft.state.BooleanProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Direction; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.IWorld; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.Material; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import javax.annotation.Nullable; @@ -64,7 +64,7 @@ public PipeBlock(PipeShapeCache shapeCache) { } @Override - protected void createBlockStateDefinition(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { super.createBlockStateDefinition(builder); builder.add( @@ -75,7 +75,7 @@ protected void createBlockStateDefinition(StateContainer.Builder fluidSlots = new ArrayList<>(); private final List fluids = new ArrayList<>(); - private final PlayerEntity player; + private final Player player; - protected BaseContainer(@Nullable ContainerType type, int windowId, PlayerEntity player) { + protected BaseContainer(@Nullable MenuType type, int windowId, Player player) { super(type, windowId); this.player = player; @@ -33,7 +33,7 @@ protected void addPlayerInventory(int xInventory, int yInventory) { for (int y = 0; y < 3; y++) { for (int x = 0; x < 9; x++) { - addSlot(new Slot(player.inventory, id, xInventory + x * 18, yInventory + y * 18)); + addSlot(new Slot(player.getInventory(), id, xInventory + x * 18, yInventory + y * 18)); id++; } @@ -45,17 +45,17 @@ protected void addPlayerInventory(int xInventory, int yInventory) { int x = xInventory + i * 18; int y = yInventory + 4 + (3 * 18); - addSlot(new Slot(player.inventory, id, x, y)); + addSlot(new Slot(player.getInventory(), id, x, y)); id++; } } @Override - public ItemStack clicked(int id, int dragType, ClickType clickType, PlayerEntity player) { + public void clicked(int id, int dragType, ClickType clickType, Player player) { Slot slot = id >= 0 ? getSlot(id) : null; - ItemStack holding = player.inventory.getCarried(); + ItemStack holding = player.containerMenu.getCarried(); if (slot instanceof FilterSlot) { if (holding.isEmpty()) { @@ -64,7 +64,7 @@ public ItemStack clicked(int id, int dragType, ClickType clickType, PlayerEntity slot.set(holding.copy()); } - return holding; + return; } else if (slot instanceof FluidFilterSlot) { if (holding.isEmpty()) { ((FluidFilterSlot) slot).onContainerClicked(ItemStack.EMPTY); @@ -72,10 +72,10 @@ public ItemStack clicked(int id, int dragType, ClickType clickType, PlayerEntity ((FluidFilterSlot) slot).onContainerClicked(holding); } - return holding; + return; } - return super.clicked(id, dragType, clickType, player); + super.clicked(id, dragType, clickType, player); } @Override @@ -92,7 +92,7 @@ protected Slot addSlot(Slot slot) { public void broadcastChanges() { super.broadcastChanges(); - if (!(player instanceof ServerPlayerEntity)) { + if (!(player instanceof ServerPlayer)) { return; } @@ -105,13 +105,13 @@ public void broadcastChanges() { if (!cached.equals(actual)) { this.fluids.set(i, actual.copy()); - RefinedPipes.NETWORK.sendToClient((ServerPlayerEntity) player, new FluidFilterSlotUpdateMessage(slot.getInventoryIndex(), actual)); + RefinedPipes.NETWORK.sendToClient((ServerPlayer) player, new FluidFilterSlotUpdateMessage(slot.getInventoryIndex(), actual)); } } } @Override - public boolean stillValid(PlayerEntity player) { + public boolean stillValid(Player player) { return true; } diff --git a/src/main/java/com/refinedmods/refinedpipes/container/ExtractorAttachmentContainer.java b/src/main/java/com/refinedmods/refinedpipes/container/ExtractorAttachmentContainer.java index b2a3e20..942d75a 100644 --- a/src/main/java/com/refinedmods/refinedpipes/container/ExtractorAttachmentContainer.java +++ b/src/main/java/com/refinedmods/refinedpipes/container/ExtractorAttachmentContainer.java @@ -11,11 +11,11 @@ import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.RedstoneMode; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.RoutingMode; import com.refinedmods.refinedpipes.util.FluidUtil; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemStackHandler; @@ -35,7 +35,7 @@ public class ExtractorAttachmentContainer extends BaseContainer { public ExtractorAttachmentContainer( int windowId, - PlayerEntity player, + Player player, BlockPos pos, Direction dir, RedstoneMode redstoneMode, @@ -92,46 +92,46 @@ public RedstoneMode getRedstoneMode() { return redstoneMode; } - public BlacklistWhitelist getBlacklistWhitelist() { - return blacklistWhitelist; - } - - public RoutingMode getRoutingMode() { - return routingMode; - } - - public int getStackSize() { - return stackSize; - } - - public boolean isExactMode() { - return exactMode; - } - public void setRedstoneMode(RedstoneMode redstoneMode) { this.redstoneMode = redstoneMode; RefinedPipes.NETWORK.sendToServer(new ChangeRedstoneModeMessage(pos, dir, redstoneMode)); } + public BlacklistWhitelist getBlacklistWhitelist() { + return blacklistWhitelist; + } + public void setBlacklistWhitelist(BlacklistWhitelist blacklistWhitelist) { this.blacklistWhitelist = blacklistWhitelist; RefinedPipes.NETWORK.sendToServer(new ChangeBlacklistWhitelistMessage(pos, dir, blacklistWhitelist)); } + public RoutingMode getRoutingMode() { + return routingMode; + } + public void setRoutingMode(RoutingMode routingMode) { this.routingMode = routingMode; RefinedPipes.NETWORK.sendToServer(new ChangeRoutingModeMessage(pos, dir, routingMode)); } + public int getStackSize() { + return stackSize; + } + public void setStackSize(int stackSize) { this.stackSize = stackSize; RefinedPipes.NETWORK.sendToServer(new ChangeStackSizeMessage(pos, dir, stackSize)); } + public boolean isExactMode() { + return exactMode; + } + public void setExactMode(boolean exactMode) { this.exactMode = exactMode; @@ -139,7 +139,7 @@ public void setExactMode(boolean exactMode) { } @Override - public ItemStack quickMoveStack(PlayerEntity player, int index) { + public ItemStack quickMoveStack(Player player, int index) { Slot slot = slots.get(index); if (slot != null && slot.hasItem() && index < 9 * 4) { for (int i = 9 * 4; i < slots.size(); ++i) { diff --git a/src/main/java/com/refinedmods/refinedpipes/container/factory/ExtractorAttachmentContainerFactory.java b/src/main/java/com/refinedmods/refinedpipes/container/factory/ExtractorAttachmentContainerFactory.java index 67fed3a..548843a 100644 --- a/src/main/java/com/refinedmods/refinedpipes/container/factory/ExtractorAttachmentContainerFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/container/factory/ExtractorAttachmentContainerFactory.java @@ -3,13 +3,13 @@ import com.refinedmods.refinedpipes.container.ExtractorAttachmentContainer; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.*; import com.refinedmods.refinedpipes.util.DirectionUtil; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.network.PacketBuffer; -import net.minecraftforge.fml.network.IContainerFactory; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraftforge.network.IContainerFactory; public class ExtractorAttachmentContainerFactory implements IContainerFactory { @Override - public ExtractorAttachmentContainer create(int windowId, PlayerInventory inv, PacketBuffer buf) { + public ExtractorAttachmentContainer create(int windowId, Inventory inv, FriendlyByteBuf buf) { return new ExtractorAttachmentContainer( windowId, inv.player, diff --git a/src/main/java/com/refinedmods/refinedpipes/container/provider/ExtractorAttachmentContainerProvider.java b/src/main/java/com/refinedmods/refinedpipes/container/provider/ExtractorAttachmentContainerProvider.java index 20964d7..c93f941 100644 --- a/src/main/java/com/refinedmods/refinedpipes/container/provider/ExtractorAttachmentContainerProvider.java +++ b/src/main/java/com/refinedmods/refinedpipes/container/provider/ExtractorAttachmentContainerProvider.java @@ -4,18 +4,18 @@ import com.refinedmods.refinedpipes.container.ExtractorAttachmentContainer; import com.refinedmods.refinedpipes.network.pipe.Pipe; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.ExtractorAttachment; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraftforge.fml.network.NetworkHooks; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraftforge.network.NetworkHooks; import javax.annotation.Nullable; -public class ExtractorAttachmentContainerProvider implements INamedContainerProvider { +public class ExtractorAttachmentContainerProvider implements MenuProvider { private final Pipe pipe; private final ExtractorAttachment attachment; @@ -24,14 +24,30 @@ public ExtractorAttachmentContainerProvider(Pipe pipe, ExtractorAttachment attac this.attachment = attachment; } + public static void open(Pipe pipe, ExtractorAttachment attachment, ServerPlayer player) { + ExtractorAttachmentContainerProvider provider = new ExtractorAttachmentContainerProvider(pipe, attachment); + + NetworkHooks.openGui(player, provider, buf -> { + buf.writeBlockPos(pipe.getPos()); + buf.writeByte(attachment.getDirection().ordinal()); + buf.writeByte(attachment.getRedstoneMode().ordinal()); + buf.writeByte(attachment.getBlacklistWhitelist().ordinal()); + buf.writeByte(attachment.getRoutingMode().ordinal()); + buf.writeInt(attachment.getStackSize()); + buf.writeBoolean(attachment.isExactMode()); + buf.writeByte(attachment.getType().ordinal()); + buf.writeBoolean(attachment.isFluidMode()); + }); + } + @Override - public ITextComponent getDisplayName() { - return new TranslationTextComponent("item." + RefinedPipes.ID + "." + attachment.getType().getId().getPath() + "_attachment"); + public Component getDisplayName() { + return new TranslatableComponent("item." + RefinedPipes.ID + "." + attachment.getType().getId().getPath() + "_attachment"); } @Nullable @Override - public Container createMenu(int windowId, PlayerInventory inv, PlayerEntity player) { + public AbstractContainerMenu createMenu(int windowId, Inventory inv, Player player) { return new ExtractorAttachmentContainer( windowId, player, @@ -48,20 +64,4 @@ public Container createMenu(int windowId, PlayerInventory inv, PlayerEntity play attachment.isFluidMode() ); } - - public static void open(Pipe pipe, ExtractorAttachment attachment, ServerPlayerEntity player) { - ExtractorAttachmentContainerProvider provider = new ExtractorAttachmentContainerProvider(pipe, attachment); - - NetworkHooks.openGui(player, provider, buf -> { - buf.writeBlockPos(pipe.getPos()); - buf.writeByte(attachment.getDirection().ordinal()); - buf.writeByte(attachment.getRedstoneMode().ordinal()); - buf.writeByte(attachment.getBlacklistWhitelist().ordinal()); - buf.writeByte(attachment.getRoutingMode().ordinal()); - buf.writeInt(attachment.getStackSize()); - buf.writeBoolean(attachment.isExactMode()); - buf.writeByte(attachment.getType().ordinal()); - buf.writeBoolean(attachment.isFluidMode()); - }); - } } diff --git a/src/main/java/com/refinedmods/refinedpipes/container/slot/FilterSlot.java b/src/main/java/com/refinedmods/refinedpipes/container/slot/FilterSlot.java index 2f7deec..23c5276 100644 --- a/src/main/java/com/refinedmods/refinedpipes/container/slot/FilterSlot.java +++ b/src/main/java/com/refinedmods/refinedpipes/container/slot/FilterSlot.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedpipes.container.slot; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.SlotItemHandler; diff --git a/src/main/java/com/refinedmods/refinedpipes/container/slot/FluidFilterSlot.java b/src/main/java/com/refinedmods/refinedpipes/container/slot/FluidFilterSlot.java index e677c09..67ba520 100644 --- a/src/main/java/com/refinedmods/refinedpipes/container/slot/FluidFilterSlot.java +++ b/src/main/java/com/refinedmods/refinedpipes/container/slot/FluidFilterSlot.java @@ -2,15 +2,15 @@ import com.refinedmods.refinedpipes.inventory.fluid.FluidInventory; import com.refinedmods.refinedpipes.util.FluidUtil; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.SlotItemHandler; import javax.annotation.Nonnull; public class FluidFilterSlot extends SlotItemHandler { - private FluidInventory fluidInventory; private final int inventoryIndex; + private FluidInventory fluidInventory; public FluidFilterSlot(FluidInventory inventory, int inventoryIndex, int x, int y) { super(new ItemStackHandler(inventory.getSlots()), inventoryIndex, x, y); diff --git a/src/main/java/com/refinedmods/refinedpipes/inventory/fluid/FluidInventory.java b/src/main/java/com/refinedmods/refinedpipes/inventory/fluid/FluidInventory.java index 906262f..0f90330 100644 --- a/src/main/java/com/refinedmods/refinedpipes/inventory/fluid/FluidInventory.java +++ b/src/main/java/com/refinedmods/refinedpipes/inventory/fluid/FluidInventory.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedpipes.inventory.fluid; -import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.CompoundTag; import net.minecraftforge.fluids.FluidStack; import javax.annotation.Nonnull; @@ -52,21 +52,21 @@ public void setFluid(int slot, @Nonnull FluidStack stack) { onContentsChanged(); } - public CompoundNBT writeToNbt() { - CompoundNBT tag = new CompoundNBT(); + public CompoundTag writeToNbt() { + CompoundTag tag = new CompoundTag(); for (int i = 0; i < getSlots(); ++i) { FluidStack stack = getFluid(i); if (!stack.isEmpty()) { - tag.put(String.format(NBT_SLOT, i), stack.writeToNBT(new CompoundNBT())); + tag.put(String.format(NBT_SLOT, i), stack.writeToNBT(new CompoundTag())); } } return tag; } - public void readFromNbt(CompoundNBT tag) { + public void readFromNbt(CompoundTag tag) { for (int i = 0; i < getSlots(); ++i) { String key = String.format(NBT_SLOT, i); diff --git a/src/main/java/com/refinedmods/refinedpipes/item/AttachmentItem.java b/src/main/java/com/refinedmods/refinedpipes/item/AttachmentItem.java index d0eacdf..925e5ec 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/AttachmentItem.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/AttachmentItem.java @@ -2,11 +2,11 @@ import com.refinedmods.refinedpipes.RefinedPipes; import com.refinedmods.refinedpipes.network.pipe.attachment.AttachmentFactory; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.world.World; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; import javax.annotation.Nullable; import java.util.List; @@ -23,7 +23,7 @@ public AttachmentItem(AttachmentFactory type) { } @Override - public void appendHoverText(ItemStack stack, @Nullable World world, List tooltip, ITooltipFlag flag) { + public void appendHoverText(ItemStack stack, @Nullable Level world, List tooltip, TooltipFlag flag) { super.appendHoverText(stack, world, tooltip, flag); type.addInformation(tooltip); diff --git a/src/main/java/com/refinedmods/refinedpipes/item/BaseBlockItem.java b/src/main/java/com/refinedmods/refinedpipes/item/BaseBlockItem.java index 85d1f39..7e178bc 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/BaseBlockItem.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/BaseBlockItem.java @@ -1,9 +1,9 @@ package com.refinedmods.refinedpipes.item; import com.refinedmods.refinedpipes.RefinedPipes; -import net.minecraft.block.Block; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; public class BaseBlockItem extends BlockItem { public BaseBlockItem(Block block) { diff --git a/src/main/java/com/refinedmods/refinedpipes/item/EnergyPipeBlockItem.java b/src/main/java/com/refinedmods/refinedpipes/item/EnergyPipeBlockItem.java index 6fdede8..f79bf7e 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/EnergyPipeBlockItem.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/EnergyPipeBlockItem.java @@ -3,13 +3,13 @@ import com.refinedmods.refinedpipes.block.EnergyPipeBlock; import com.refinedmods.refinedpipes.network.pipe.energy.EnergyPipeType; import com.refinedmods.refinedpipes.util.StringUtil; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; import javax.annotation.Nullable; import java.util.List; @@ -24,19 +24,19 @@ public EnergyPipeBlockItem(EnergyPipeBlock block) { } @Override - public void appendHoverText(ItemStack stack, @Nullable World world, List tooltip, ITooltipFlag flag) { + public void appendHoverText(ItemStack stack, @Nullable Level world, List tooltip, TooltipFlag flag) { super.appendHoverText(stack, world, tooltip, flag); - tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).withStyle(TextFormatting.YELLOW)); + tooltip.add(new TranslatableComponent("misc.refinedpipes.tier", new TranslatableComponent("enchantment.level." + type.getTier())).withStyle(ChatFormatting.YELLOW)); - tooltip.add(new TranslationTextComponent( + tooltip.add(new TranslatableComponent( "tooltip.refinedpipes.energy_pipe.capacity", - new StringTextComponent(StringUtil.formatNumber(type.getCapacity()) + " FE").withStyle(TextFormatting.WHITE) - ).withStyle(TextFormatting.GRAY)); + new TextComponent(StringUtil.formatNumber(type.getCapacity()) + " FE").withStyle(ChatFormatting.WHITE) + ).withStyle(ChatFormatting.GRAY)); - tooltip.add(new TranslationTextComponent( + tooltip.add(new TranslatableComponent( "tooltip.refinedpipes.energy_pipe.transfer_rate", - new StringTextComponent(StringUtil.formatNumber(type.getTransferRate()) + " FE/t").withStyle(TextFormatting.WHITE) - ).withStyle(TextFormatting.GRAY)); + new TextComponent(StringUtil.formatNumber(type.getTransferRate()) + " FE/t").withStyle(ChatFormatting.WHITE) + ).withStyle(ChatFormatting.GRAY)); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/item/FluidPipeBlockItem.java b/src/main/java/com/refinedmods/refinedpipes/item/FluidPipeBlockItem.java index 898ba03..2227c9d 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/FluidPipeBlockItem.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/FluidPipeBlockItem.java @@ -3,13 +3,13 @@ import com.refinedmods.refinedpipes.block.FluidPipeBlock; import com.refinedmods.refinedpipes.network.pipe.fluid.FluidPipeType; import com.refinedmods.refinedpipes.util.StringUtil; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; import javax.annotation.Nullable; import java.util.List; @@ -24,19 +24,19 @@ public FluidPipeBlockItem(FluidPipeBlock block) { } @Override - public void appendHoverText(ItemStack stack, @Nullable World world, List tooltip, ITooltipFlag flag) { + public void appendHoverText(ItemStack stack, @Nullable Level world, List tooltip, TooltipFlag flag) { super.appendHoverText(stack, world, tooltip, flag); - tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).withStyle(TextFormatting.YELLOW)); + tooltip.add(new TranslatableComponent("misc.refinedpipes.tier", new TranslatableComponent("enchantment.level." + type.getTier())).withStyle(ChatFormatting.YELLOW)); - tooltip.add(new TranslationTextComponent( + tooltip.add(new TranslatableComponent( "tooltip.refinedpipes.fluid_pipe.capacity", - new StringTextComponent(StringUtil.formatNumber(type.getCapacity()) + " mB").withStyle(TextFormatting.WHITE) - ).withStyle(TextFormatting.GRAY)); + new TextComponent(StringUtil.formatNumber(type.getCapacity()) + " mB").withStyle(ChatFormatting.WHITE) + ).withStyle(ChatFormatting.GRAY)); - tooltip.add(new TranslationTextComponent( + tooltip.add(new TranslatableComponent( "tooltip.refinedpipes.fluid_pipe.transfer_rate", - new StringTextComponent(StringUtil.formatNumber(type.getTransferRate()) + " mB/t").withStyle(TextFormatting.WHITE) - ).withStyle(TextFormatting.GRAY)); + new TextComponent(StringUtil.formatNumber(type.getTransferRate()) + " mB/t").withStyle(ChatFormatting.WHITE) + ).withStyle(ChatFormatting.GRAY)); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/item/ItemPipeBlockItem.java b/src/main/java/com/refinedmods/refinedpipes/item/ItemPipeBlockItem.java index 621b1f1..4e75583 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/ItemPipeBlockItem.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/ItemPipeBlockItem.java @@ -2,13 +2,13 @@ import com.refinedmods.refinedpipes.block.ItemPipeBlock; import com.refinedmods.refinedpipes.network.pipe.item.ItemPipeType; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; import javax.annotation.Nullable; import java.util.List; @@ -23,14 +23,14 @@ public ItemPipeBlockItem(ItemPipeBlock block) { } @Override - public void appendHoverText(ItemStack stack, @Nullable World world, List tooltip, ITooltipFlag flag) { + public void appendHoverText(ItemStack stack, @Nullable Level world, List tooltip, TooltipFlag flag) { super.appendHoverText(stack, world, tooltip, flag); - tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).withStyle(TextFormatting.YELLOW)); + tooltip.add(new TranslatableComponent("misc.refinedpipes.tier", new TranslatableComponent("enchantment.level." + type.getTier())).withStyle(ChatFormatting.YELLOW)); - tooltip.add(new TranslationTextComponent( + tooltip.add(new TranslatableComponent( "tooltip.refinedpipes.item_pipe.speed", - new StringTextComponent(type.getSpeedComparedToBasicTier() + "%").withStyle(TextFormatting.WHITE) - ).withStyle(TextFormatting.GRAY)); + new TextComponent(type.getSpeedComparedToBasicTier() + "%").withStyle(ChatFormatting.WHITE) + ).withStyle(ChatFormatting.GRAY)); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/item/group/MainItemGroup.java b/src/main/java/com/refinedmods/refinedpipes/item/group/MainItemGroup.java index 048beca..aa15029 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/group/MainItemGroup.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/group/MainItemGroup.java @@ -2,10 +2,10 @@ import com.refinedmods.refinedpipes.RefinedPipes; import com.refinedmods.refinedpipes.RefinedPipesItems; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; -public class MainItemGroup extends ItemGroup { +public class MainItemGroup extends CreativeModeTab { public MainItemGroup() { super(RefinedPipes.ID); } diff --git a/src/main/java/com/refinedmods/refinedpipes/message/ChangeBlacklistWhitelistMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/ChangeBlacklistWhitelistMessage.java index 0e18f7f..f276e51 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/ChangeBlacklistWhitelistMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/ChangeBlacklistWhitelistMessage.java @@ -6,11 +6,11 @@ import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.ExtractorAttachment; import com.refinedmods.refinedpipes.tile.PipeTileEntity; import com.refinedmods.refinedpipes.util.DirectionUtil; -import net.minecraft.network.PacketBuffer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; @@ -25,13 +25,13 @@ public ChangeBlacklistWhitelistMessage(BlockPos pos, Direction direction, Blackl this.blacklistWhitelist = blacklistWhitelist; } - public static void encode(ChangeBlacklistWhitelistMessage message, PacketBuffer buf) { + public static void encode(ChangeBlacklistWhitelistMessage message, FriendlyByteBuf buf) { buf.writeBlockPos(message.pos); buf.writeByte(message.direction.ordinal()); buf.writeByte(message.blacklistWhitelist.ordinal()); } - public static ChangeBlacklistWhitelistMessage decode(PacketBuffer buf) { + public static ChangeBlacklistWhitelistMessage decode(FriendlyByteBuf buf) { BlockPos pos = buf.readBlockPos(); Direction direction = DirectionUtil.safeGet(buf.readByte()); BlacklistWhitelist blacklistWhitelist = BlacklistWhitelist.get(buf.readByte()); @@ -41,7 +41,7 @@ public static ChangeBlacklistWhitelistMessage decode(PacketBuffer buf) { public static void handle(ChangeBlacklistWhitelistMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - TileEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); + BlockEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); if (tile instanceof PipeTileEntity) { Attachment attachment = ((PipeTileEntity) tile).getAttachmentManager().getAttachment(message.direction); diff --git a/src/main/java/com/refinedmods/refinedpipes/message/ChangeExactModeMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/ChangeExactModeMessage.java index 8204924..d7c84cb 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/ChangeExactModeMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/ChangeExactModeMessage.java @@ -5,11 +5,11 @@ import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.ExtractorAttachment; import com.refinedmods.refinedpipes.tile.PipeTileEntity; import com.refinedmods.refinedpipes.util.DirectionUtil; -import net.minecraft.network.PacketBuffer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; @@ -24,13 +24,13 @@ public ChangeExactModeMessage(BlockPos pos, Direction direction, boolean exactMo this.exactMode = exactMode; } - public static void encode(ChangeExactModeMessage message, PacketBuffer buf) { + public static void encode(ChangeExactModeMessage message, FriendlyByteBuf buf) { buf.writeBlockPos(message.pos); buf.writeByte(message.direction.ordinal()); buf.writeBoolean(message.exactMode); } - public static ChangeExactModeMessage decode(PacketBuffer buf) { + public static ChangeExactModeMessage decode(FriendlyByteBuf buf) { BlockPos pos = buf.readBlockPos(); Direction direction = DirectionUtil.safeGet(buf.readByte()); boolean exactMode = buf.readBoolean(); @@ -40,7 +40,7 @@ public static ChangeExactModeMessage decode(PacketBuffer buf) { public static void handle(ChangeExactModeMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - TileEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); + BlockEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); if (tile instanceof PipeTileEntity) { Attachment attachment = ((PipeTileEntity) tile).getAttachmentManager().getAttachment(message.direction); diff --git a/src/main/java/com/refinedmods/refinedpipes/message/ChangeRedstoneModeMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/ChangeRedstoneModeMessage.java index 40cbe09..6274a4a 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/ChangeRedstoneModeMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/ChangeRedstoneModeMessage.java @@ -6,11 +6,11 @@ import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.RedstoneMode; import com.refinedmods.refinedpipes.tile.PipeTileEntity; import com.refinedmods.refinedpipes.util.DirectionUtil; -import net.minecraft.network.PacketBuffer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; @@ -25,13 +25,13 @@ public ChangeRedstoneModeMessage(BlockPos pos, Direction direction, RedstoneMode this.redstoneMode = redstoneMode; } - public static void encode(ChangeRedstoneModeMessage message, PacketBuffer buf) { + public static void encode(ChangeRedstoneModeMessage message, FriendlyByteBuf buf) { buf.writeBlockPos(message.pos); buf.writeByte(message.direction.ordinal()); buf.writeByte(message.redstoneMode.ordinal()); } - public static ChangeRedstoneModeMessage decode(PacketBuffer buf) { + public static ChangeRedstoneModeMessage decode(FriendlyByteBuf buf) { BlockPos pos = buf.readBlockPos(); Direction direction = DirectionUtil.safeGet(buf.readByte()); RedstoneMode redstoneMode = RedstoneMode.get(buf.readByte()); @@ -41,7 +41,7 @@ public static ChangeRedstoneModeMessage decode(PacketBuffer buf) { public static void handle(ChangeRedstoneModeMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - TileEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); + BlockEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); if (tile instanceof PipeTileEntity) { Attachment attachment = ((PipeTileEntity) tile).getAttachmentManager().getAttachment(message.direction); diff --git a/src/main/java/com/refinedmods/refinedpipes/message/ChangeRoutingModeMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/ChangeRoutingModeMessage.java index 7363159..08619ea 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/ChangeRoutingModeMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/ChangeRoutingModeMessage.java @@ -6,11 +6,11 @@ import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.RoutingMode; import com.refinedmods.refinedpipes.tile.PipeTileEntity; import com.refinedmods.refinedpipes.util.DirectionUtil; -import net.minecraft.network.PacketBuffer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; @@ -25,13 +25,13 @@ public ChangeRoutingModeMessage(BlockPos pos, Direction direction, RoutingMode r this.routingMode = routingMode; } - public static void encode(ChangeRoutingModeMessage message, PacketBuffer buf) { + public static void encode(ChangeRoutingModeMessage message, FriendlyByteBuf buf) { buf.writeBlockPos(message.pos); buf.writeByte(message.direction.ordinal()); buf.writeByte(message.routingMode.ordinal()); } - public static ChangeRoutingModeMessage decode(PacketBuffer buf) { + public static ChangeRoutingModeMessage decode(FriendlyByteBuf buf) { BlockPos pos = buf.readBlockPos(); Direction direction = DirectionUtil.safeGet(buf.readByte()); RoutingMode redstoneMode = RoutingMode.get(buf.readByte()); @@ -41,7 +41,7 @@ public static ChangeRoutingModeMessage decode(PacketBuffer buf) { public static void handle(ChangeRoutingModeMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - TileEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); + BlockEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); if (tile instanceof PipeTileEntity) { Attachment attachment = ((PipeTileEntity) tile).getAttachmentManager().getAttachment(message.direction); diff --git a/src/main/java/com/refinedmods/refinedpipes/message/ChangeStackSizeMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/ChangeStackSizeMessage.java index 6244f1b..67de0bc 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/ChangeStackSizeMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/ChangeStackSizeMessage.java @@ -5,11 +5,11 @@ import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.ExtractorAttachment; import com.refinedmods.refinedpipes.tile.PipeTileEntity; import com.refinedmods.refinedpipes.util.DirectionUtil; -import net.minecraft.network.PacketBuffer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; @@ -24,13 +24,13 @@ public ChangeStackSizeMessage(BlockPos pos, Direction direction, int stackSize) this.stackSize = stackSize; } - public static void encode(ChangeStackSizeMessage message, PacketBuffer buf) { + public static void encode(ChangeStackSizeMessage message, FriendlyByteBuf buf) { buf.writeBlockPos(message.pos); buf.writeByte(message.direction.ordinal()); buf.writeInt(message.stackSize); } - public static ChangeStackSizeMessage decode(PacketBuffer buf) { + public static ChangeStackSizeMessage decode(FriendlyByteBuf buf) { BlockPos pos = buf.readBlockPos(); Direction direction = DirectionUtil.safeGet(buf.readByte()); int stackSize = buf.readInt(); @@ -40,7 +40,7 @@ public static ChangeStackSizeMessage decode(PacketBuffer buf) { public static void handle(ChangeStackSizeMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - TileEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); + BlockEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); if (tile instanceof PipeTileEntity) { Attachment attachment = ((PipeTileEntity) tile).getAttachmentManager().getAttachment(message.direction); diff --git a/src/main/java/com/refinedmods/refinedpipes/message/FluidFilterSlotUpdateMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/FluidFilterSlotUpdateMessage.java index 7bc51e2..5184e31 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/FluidFilterSlotUpdateMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/FluidFilterSlotUpdateMessage.java @@ -2,11 +2,11 @@ import com.refinedmods.refinedpipes.container.slot.FluidFilterSlot; import net.minecraft.client.Minecraft; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.Slot; -import net.minecraft.network.PacketBuffer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; @@ -19,18 +19,18 @@ public FluidFilterSlotUpdateMessage(int containerSlot, FluidStack stack) { this.stack = stack; } - public static void encode(FluidFilterSlotUpdateMessage message, PacketBuffer buf) { + public static void encode(FluidFilterSlotUpdateMessage message, FriendlyByteBuf buf) { buf.writeInt(message.containerSlot); message.stack.writeToPacket(buf); } - public static FluidFilterSlotUpdateMessage decode(PacketBuffer buf) { + public static FluidFilterSlotUpdateMessage decode(FriendlyByteBuf buf) { return new FluidFilterSlotUpdateMessage(buf.readInt(), FluidStack.readFromPacket(buf)); } public static void handle(FluidFilterSlotUpdateMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - Container container = Minecraft.getInstance().player.containerMenu; + AbstractContainerMenu container = Minecraft.getInstance().player.containerMenu; if (container == null) { return; } diff --git a/src/main/java/com/refinedmods/refinedpipes/message/FluidPipeMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/FluidPipeMessage.java index 405e6f2..e27537e 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/FluidPipeMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/FluidPipeMessage.java @@ -2,11 +2,11 @@ import com.refinedmods.refinedpipes.tile.FluidPipeTileEntity; import net.minecraft.client.Minecraft; -import net.minecraft.network.PacketBuffer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; @@ -24,13 +24,13 @@ public FluidPipeMessage(BlockPos pos, FluidStack fluid, float fullness) { public FluidPipeMessage() { } - public static void encode(FluidPipeMessage message, PacketBuffer buf) { + public static void encode(FluidPipeMessage message, FriendlyByteBuf buf) { buf.writeBlockPos(message.pos); buf.writeFluidStack(message.fluid); buf.writeFloat(message.fullness); } - public static FluidPipeMessage decode(PacketBuffer buf) { + public static FluidPipeMessage decode(FriendlyByteBuf buf) { BlockPos pos = buf.readBlockPos(); FluidStack fluid = buf.readFluidStack(); float fullness = buf.readFloat(); @@ -40,7 +40,7 @@ public static FluidPipeMessage decode(PacketBuffer buf) { public static void handle(FluidPipeMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - TileEntity tile = Minecraft.getInstance().level.getBlockEntity(message.pos); + BlockEntity tile = Minecraft.getInstance().level.getBlockEntity(message.pos); if (tile instanceof FluidPipeTileEntity) { ((FluidPipeTileEntity) tile).setFluid(message.fluid); diff --git a/src/main/java/com/refinedmods/refinedpipes/message/ItemTransportMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/ItemTransportMessage.java index 2001ae1..c8a2622 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/ItemTransportMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/ItemTransportMessage.java @@ -3,10 +3,10 @@ import com.refinedmods.refinedpipes.network.pipe.transport.ItemTransportProps; import com.refinedmods.refinedpipes.tile.ItemPipeTileEntity; import net.minecraft.client.Minecraft; -import net.minecraft.network.PacketBuffer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.core.BlockPos; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraftforge.network.NetworkEvent; import java.util.ArrayList; import java.util.List; @@ -21,14 +21,14 @@ public ItemTransportMessage(BlockPos pos, List props) { this.props = props; } - public static void encode(ItemTransportMessage message, PacketBuffer buf) { + public static void encode(ItemTransportMessage message, FriendlyByteBuf buf) { buf.writeBlockPos(message.pos); buf.writeInt(message.props.size()); message.props.forEach(p -> p.writeToBuffer(buf)); } - public static ItemTransportMessage decode(PacketBuffer buf) { + public static ItemTransportMessage decode(FriendlyByteBuf buf) { BlockPos pos = buf.readBlockPos(); int count = buf.readInt(); List props = new ArrayList<>(); @@ -42,7 +42,7 @@ public static ItemTransportMessage decode(PacketBuffer buf) { public static void handle(ItemTransportMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - TileEntity tile = Minecraft.getInstance().level.getBlockEntity(message.pos); + BlockEntity tile = Minecraft.getInstance().level.getBlockEntity(message.pos); if (tile instanceof ItemPipeTileEntity) { ((ItemPipeTileEntity) tile).setProps(message.props); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/Network.java b/src/main/java/com/refinedmods/refinedpipes/network/Network.java index 44e0bfb..dcdc5b7 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/Network.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/Network.java @@ -5,10 +5,10 @@ import com.refinedmods.refinedpipes.network.pipe.Destination; import com.refinedmods.refinedpipes.network.pipe.DestinationType; import com.refinedmods.refinedpipes.network.pipe.Pipe; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; import java.util.List; import java.util.Objects; @@ -32,7 +32,7 @@ public String getId() { return id; } - public NetworkGraphScannerResult scanGraph(World world, BlockPos pos) { + public NetworkGraphScannerResult scanGraph(Level world, BlockPos pos) { return graph.scan(world, pos); } @@ -40,14 +40,14 @@ public List getDestinations(DestinationType type) { return graph.getDestinations(type); } - public CompoundNBT writeToNbt(CompoundNBT tag) { + public CompoundTag writeToNbt(CompoundTag tag) { tag.putString("id", id); tag.putLong("origin", originPos.asLong()); return tag; } - public void update(World world) { + public void update(Level world) { if (!didDoInitialScan) { didDoInitialScan = true; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/NetworkFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/NetworkFactory.java index c6e1112..dc08351 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/NetworkFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/NetworkFactory.java @@ -1,10 +1,10 @@ package com.refinedmods.refinedpipes.network; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; public interface NetworkFactory { Network create(BlockPos pos); - Network create(CompoundNBT tag); + Network create(CompoundTag tag); } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/NetworkManager.java b/src/main/java/com/refinedmods/refinedpipes/network/NetworkManager.java index f2df220..694d324 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/NetworkManager.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/NetworkManager.java @@ -6,42 +6,42 @@ import com.refinedmods.refinedpipes.network.pipe.PipeFactory; import com.refinedmods.refinedpipes.network.pipe.PipeRegistry; import com.refinedmods.refinedpipes.network.pipe.item.ItemPipe; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.INBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; -import net.minecraft.world.storage.WorldSavedData; -import net.minecraftforge.common.util.Constants; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.saveddata.SavedData; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import javax.annotation.Nullable; import java.util.*; -public class NetworkManager extends WorldSavedData { +public class NetworkManager extends SavedData { private static final String NAME = RefinedPipes.ID + "_networks"; private static final Logger LOGGER = LogManager.getLogger(NetworkManager.class); + private final Level world; + private final Map networks = new HashMap<>(); + private final Map pipes = new HashMap<>(); - public static NetworkManager get(World world) { - return get((ServerWorld) world); + public NetworkManager(Level world) { + this.world = world; } - public static NetworkManager get(ServerWorld world) { - return world.getDataStorage().computeIfAbsent(() -> new NetworkManager(NAME, world), NAME); + public static NetworkManager get(Level world) { + return get((ServerLevel) world); } - private final World world; - private final Map networks = new HashMap<>(); - private final Map pipes = new HashMap<>(); - - public NetworkManager(String name, World world) { - super(name); - - this.world = world; + public static NetworkManager get(ServerLevel world) { + return world.getDataStorage().computeIfAbsent((tag) -> { + NetworkManager networkManager = new NetworkManager(world); + networkManager.load(tag); + return networkManager; + }, () -> new NetworkManager(world), NAME); } public void addNetwork(Network network) { @@ -68,7 +68,7 @@ public void removeNetwork(String id) { setDirty(); } - private void formNetworkAt(World world, BlockPos pos, ResourceLocation type) { + private void formNetworkAt(Level world, BlockPos pos, ResourceLocation type) { Network network = NetworkRegistry.INSTANCE.getFactory(type).create(pos); addNetwork(network); @@ -76,7 +76,7 @@ private void formNetworkAt(World world, BlockPos pos, ResourceLocation type) { network.scanGraph(world, pos); } - private void mergeNetworksIntoOne(Set candidates, World world, BlockPos pos) { + private void mergeNetworksIntoOne(Set candidates, Level world, BlockPos pos) { if (candidates.isEmpty()) { throw new RuntimeException("Cannot merge networks: no candidates"); } @@ -245,11 +245,10 @@ public Collection getNetworks() { return networks.values(); } - @Override - public void load(CompoundNBT tag) { - ListNBT pipes = tag.getList("pipes", Constants.NBT.TAG_COMPOUND); - for (INBT pipeTag : pipes) { - CompoundNBT pipeTagCompound = (CompoundNBT) pipeTag; + public void load(CompoundTag tag) { + ListTag pipes = tag.getList("pipes", Tag.TAG_COMPOUND); + for (Tag pipeTag : pipes) { + CompoundTag pipeTagCompound = (CompoundTag) pipeTag; // @BC ResourceLocation factoryId = pipeTagCompound.contains("id") ? new ResourceLocation(pipeTagCompound.getString("id")) : ItemPipe.ID; @@ -265,9 +264,9 @@ public void load(CompoundNBT tag) { this.pipes.put(pipe.getPos(), pipe); } - ListNBT nets = tag.getList("networks", Constants.NBT.TAG_COMPOUND); - for (INBT netTag : nets) { - CompoundNBT netTagCompound = (CompoundNBT) netTag; + ListTag nets = tag.getList("networks", Tag.TAG_COMPOUND); + for (Tag netTag : nets) { + CompoundTag netTagCompound = (CompoundTag) netTag; if (!netTagCompound.contains("type")) { LOGGER.warn("Skipping network without type"); continue; @@ -291,18 +290,18 @@ public void load(CompoundNBT tag) { } @Override - public CompoundNBT save(CompoundNBT tag) { - ListNBT pipes = new ListNBT(); + public CompoundTag save(CompoundTag tag) { + ListTag pipes = new ListTag(); this.pipes.values().forEach(p -> { - CompoundNBT pipeTag = new CompoundNBT(); + CompoundTag pipeTag = new CompoundTag(); pipeTag.putString("id", p.getId().toString()); pipes.add(p.writeToNbt(pipeTag)); }); tag.put("pipes", pipes); - ListNBT networks = new ListNBT(); + ListTag networks = new ListTag(); this.networks.values().forEach(n -> { - CompoundNBT networkTag = new CompoundNBT(); + CompoundTag networkTag = new CompoundTag(); networkTag.putString("type", n.getType().toString()); networks.add(n.writeToNbt(networkTag)); }); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/NetworkRegistry.java b/src/main/java/com/refinedmods/refinedpipes/network/NetworkRegistry.java index 777c7d6..2970531 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/NetworkRegistry.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/NetworkRegistry.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedpipes.network; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,10 +9,8 @@ import java.util.Map; public class NetworkRegistry { - private static final Logger LOGGER = LogManager.getLogger(NetworkRegistry.class); - public static final NetworkRegistry INSTANCE = new NetworkRegistry(); - + private static final Logger LOGGER = LogManager.getLogger(NetworkRegistry.class); private final Map factories = new HashMap<>(); private NetworkRegistry() { diff --git a/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetwork.java b/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetwork.java index 7084671..cd549e8 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetwork.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetwork.java @@ -6,10 +6,10 @@ import com.refinedmods.refinedpipes.network.pipe.DestinationType; import com.refinedmods.refinedpipes.network.pipe.energy.EnergyPipe; import com.refinedmods.refinedpipes.network.pipe.energy.EnergyPipeType; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; @@ -28,7 +28,7 @@ public EnergyNetwork(BlockPos originPos, String id, EnergyPipeType pipeType) { } @Override - public NetworkGraphScannerResult scanGraph(World world, BlockPos pos) { + public NetworkGraphScannerResult scanGraph(Level world, BlockPos pos) { NetworkGraphScannerResult result = super.scanGraph(world, pos); energyStorage.setCapacityAndMaxExtract( @@ -51,7 +51,7 @@ public EnergyStorage getEnergyStorage() { } @Override - public void update(World world) { + public void update(Level world) { super.update(world); List destinations = graph.getDestinations(DestinationType.ENERGY_STORAGE); @@ -62,7 +62,7 @@ public void update(World world) { } for (Destination destination : destinations) { - TileEntity tile = destination.getConnectedPipe().getWorld().getBlockEntity(destination.getReceiver()); + BlockEntity tile = destination.getConnectedPipe().getWorld().getBlockEntity(destination.getReceiver()); if (tile == null) { continue; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetworkFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetworkFactory.java index 29a7662..c42a5f8 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetworkFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetworkFactory.java @@ -4,8 +4,8 @@ import com.refinedmods.refinedpipes.network.NetworkFactory; import com.refinedmods.refinedpipes.network.pipe.energy.EnergyPipeType; import com.refinedmods.refinedpipes.util.StringUtil; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -26,7 +26,7 @@ public Network create(BlockPos pos) { } @Override - public Network create(CompoundNBT tag) { + public Network create(CompoundTag tag) { EnergyNetwork network = new EnergyNetwork(BlockPos.of(tag.getLong("origin")), tag.getString("id"), pipeType); LOGGER.debug("Deserialized energy network {} of type {}", network.getId(), network.getType().toString()); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetwork.java b/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetwork.java index 69e0156..f8e8afb 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetwork.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetwork.java @@ -6,11 +6,11 @@ import com.refinedmods.refinedpipes.network.pipe.DestinationType; import com.refinedmods.refinedpipes.network.pipe.fluid.FluidPipe; import com.refinedmods.refinedpipes.network.pipe.fluid.FluidPipeType; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; @@ -35,7 +35,7 @@ public FluidTank getFluidTank() { } @Override - public NetworkGraphScannerResult scanGraph(World world, BlockPos pos) { + public NetworkGraphScannerResult scanGraph(Level world, BlockPos pos) { NetworkGraphScannerResult result = super.scanGraph(world, pos); fluidTank.setCapacity( @@ -54,7 +54,7 @@ public NetworkGraphScannerResult scanGraph(World world, BlockPos pos) { } @Override - public void update(World world) { + public void update(Level world) { super.update(world); List destinations = graph.getDestinations(DestinationType.FLUID_HANDLER); @@ -64,7 +64,7 @@ public void update(World world) { } for (Destination destination : destinations) { - TileEntity tile = destination.getConnectedPipe().getWorld().getBlockEntity(destination.getReceiver()); + BlockEntity tile = destination.getConnectedPipe().getWorld().getBlockEntity(destination.getReceiver()); if (tile == null) { continue; } @@ -107,8 +107,8 @@ public ResourceLocation getType() { } @Override - public CompoundNBT writeToNbt(CompoundNBT tag) { - tag.put("tank", fluidTank.writeToNBT(new CompoundNBT())); + public CompoundTag writeToNbt(CompoundTag tag) { + tag.put("tank", fluidTank.writeToNBT(new CompoundTag())); return super.writeToNbt(tag); } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetworkFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetworkFactory.java index ff31cb3..54e1eb5 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetworkFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetworkFactory.java @@ -4,8 +4,8 @@ import com.refinedmods.refinedpipes.network.NetworkFactory; import com.refinedmods.refinedpipes.network.pipe.fluid.FluidPipeType; import com.refinedmods.refinedpipes.util.StringUtil; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -26,7 +26,7 @@ public Network create(BlockPos pos) { } @Override - public Network create(CompoundNBT tag) { + public Network create(CompoundTag tag) { FluidNetwork network = new FluidNetwork(BlockPos.of(tag.getLong("origin")), tag.getString("id"), pipeType); if (tag.contains("tank")) { diff --git a/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraph.java b/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraph.java index 1024085..a2c208f 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraph.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraph.java @@ -4,8 +4,8 @@ import com.refinedmods.refinedpipes.network.pipe.Destination; import com.refinedmods.refinedpipes.network.pipe.DestinationType; import com.refinedmods.refinedpipes.network.pipe.Pipe; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import java.util.*; @@ -19,7 +19,7 @@ public NetworkGraph(Network network) { this.network = network; } - public NetworkGraphScannerResult scan(World originWorld, BlockPos originPos) { + public NetworkGraphScannerResult scan(Level originWorld, BlockPos originPos) { NetworkGraphScanner scanner = new NetworkGraphScanner(pipes, network.getType()); NetworkGraphScannerResult result = scanner.scanAt(originWorld, originPos); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScanner.java b/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScanner.java index d21b0ee..7629409 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScanner.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScanner.java @@ -5,11 +5,11 @@ import com.refinedmods.refinedpipes.network.pipe.DestinationType; import com.refinedmods.refinedpipes.network.pipe.Pipe; import com.refinedmods.refinedpipes.network.pipe.energy.EnergyPipeEnergyStorage; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.items.CapabilityItemHandler; @@ -33,7 +33,7 @@ public NetworkGraphScanner(Set currentPipes, ResourceLocation requiredNetw this.requiredNetworkType = requiredNetworkType; } - public NetworkGraphScannerResult scanAt(World world, BlockPos pos) { + public NetworkGraphScannerResult scanAt(Level world, BlockPos pos) { addRequest(new NetworkGraphScannerRequest(world, pos, null, null)); NetworkGraphScannerRequest request; @@ -85,7 +85,7 @@ private void singleScanAt(NetworkGraphScannerRequest request) { // If this destination is connected to a pipe with an attachment, then this is not a valid destination. if (!connectedPipe.getAttachmentManager().hasAttachment(request.getDirection())) { - TileEntity tile = request.getWorld().getBlockEntity(request.getPos()); + BlockEntity tile = request.getWorld().getBlockEntity(request.getPos()); if (tile != null) { tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, request.getDirection().getOpposite()) diff --git a/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScannerRequest.java b/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScannerRequest.java index 1c15b60..3e66e08 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScannerRequest.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScannerRequest.java @@ -1,13 +1,13 @@ package com.refinedmods.refinedpipes.network.graph; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; import javax.annotation.Nullable; public class NetworkGraphScannerRequest { - private final World world; + private final Level world; private final BlockPos pos; @Nullable private final Direction direction; @@ -15,14 +15,14 @@ public class NetworkGraphScannerRequest { private final NetworkGraphScannerRequest parent; private boolean successful; - public NetworkGraphScannerRequest(World world, BlockPos pos, @Nullable Direction direction, @Nullable NetworkGraphScannerRequest parent) { + public NetworkGraphScannerRequest(Level world, BlockPos pos, @Nullable Direction direction, @Nullable NetworkGraphScannerRequest parent) { this.world = world; this.pos = pos; this.direction = direction; this.parent = parent; } - public World getWorld() { + public Level getWorld() { return world; } @@ -40,11 +40,11 @@ public NetworkGraphScannerRequest getParent() { return parent; } - public void setSuccessful(boolean successful) { - this.successful = successful; - } - public boolean isSuccessful() { return successful; } + + public void setSuccessful(boolean successful) { + this.successful = successful; + } } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/item/ItemNetwork.java b/src/main/java/com/refinedmods/refinedpipes/network/item/ItemNetwork.java index 33ee80d..7043845 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/item/ItemNetwork.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/item/ItemNetwork.java @@ -13,9 +13,9 @@ import com.refinedmods.refinedpipes.routing.Graph; import com.refinedmods.refinedpipes.routing.Node; import com.refinedmods.refinedpipes.routing.NodeIndex; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; import java.util.List; import java.util.Set; @@ -31,7 +31,7 @@ public ItemNetwork(BlockPos originPos, String id) { } @Override - public NetworkGraphScannerResult scanGraph(World world, BlockPos pos) { + public NetworkGraphScannerResult scanGraph(Level world, BlockPos pos) { NetworkGraphScannerResult result = super.scanGraph(world, pos); updateRouting(result, graph.getDestinations(DestinationType.ITEM_HANDLER)); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/item/ItemNetworkFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/item/ItemNetworkFactory.java index 5e27253..a22b0db 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/item/ItemNetworkFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/item/ItemNetworkFactory.java @@ -3,8 +3,8 @@ import com.refinedmods.refinedpipes.network.Network; import com.refinedmods.refinedpipes.network.NetworkFactory; import com.refinedmods.refinedpipes.util.StringUtil; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -19,7 +19,7 @@ public Network create(BlockPos pos) { } @Override - public Network create(CompoundNBT tag) { + public Network create(CompoundTag tag) { ItemNetwork network = new ItemNetwork(BlockPos.of(tag.getLong("origin")), tag.getString("id")); LOGGER.debug("Deserialized item network {}", network.getId()); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/item/routing/DestinationPathCache.java b/src/main/java/com/refinedmods/refinedpipes/network/item/routing/DestinationPathCache.java index ebc39ce..292cbc6 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/item/routing/DestinationPathCache.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/item/routing/DestinationPathCache.java @@ -2,7 +2,7 @@ import com.refinedmods.refinedpipes.network.pipe.Destination; import com.refinedmods.refinedpipes.routing.Path; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; import javax.annotation.Nullable; import java.util.HashMap; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/item/routing/DestinationPathCacheFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/item/routing/DestinationPathCacheFactory.java index d8c3af7..09a488a 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/item/routing/DestinationPathCacheFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/item/routing/DestinationPathCacheFactory.java @@ -3,7 +3,7 @@ import com.refinedmods.refinedpipes.network.pipe.Destination; import com.refinedmods.refinedpipes.network.pipe.Pipe; import com.refinedmods.refinedpipes.routing.*; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/item/routing/EdgeFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/item/routing/EdgeFactory.java index 3a49833..86fd7e0 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/item/routing/EdgeFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/item/routing/EdgeFactory.java @@ -3,7 +3,7 @@ import com.refinedmods.refinedpipes.network.graph.NetworkGraphScannerRequest; import com.refinedmods.refinedpipes.routing.Edge; import com.refinedmods.refinedpipes.routing.NodeIndex; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/Destination.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/Destination.java index 81c2cd6..c314585 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/Destination.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/Destination.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedpipes.network.pipe; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; import java.util.Objects; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/Pipe.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/Pipe.java index 8e7644a..8b5bc05 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/Pipe.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/Pipe.java @@ -3,26 +3,24 @@ import com.refinedmods.refinedpipes.network.Network; import com.refinedmods.refinedpipes.network.pipe.attachment.Attachment; import com.refinedmods.refinedpipes.network.pipe.attachment.ServerAttachmentManager; -import net.minecraft.block.BlockState; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.Objects; public abstract class Pipe { - private final Logger logger = LogManager.getLogger(getClass()); - - protected final World world; + protected final Level world; protected final BlockPos pos; protected final ServerAttachmentManager attachmentManager = new ServerAttachmentManager(this); - + private final Logger logger = LogManager.getLogger(getClass()); protected Network network; - public Pipe(World world, BlockPos pos) { + public Pipe(Level world, BlockPos pos) { this.world = world; this.pos = pos; } @@ -37,7 +35,7 @@ public ServerAttachmentManager getAttachmentManager() { return attachmentManager; } - public World getWorld() { + public Level getWorld() { return world; } @@ -70,7 +68,7 @@ public void sendBlockUpdate() { world.sendBlockUpdated(pos, state, state, 1 | 2); } - public CompoundNBT writeToNbt(CompoundNBT tag) { + public CompoundTag writeToNbt(CompoundTag tag) { tag.putLong("pos", pos.asLong()); attachmentManager.writeToNbt(tag); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/PipeFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/PipeFactory.java index af30e74..0b9e030 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/PipeFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/PipeFactory.java @@ -1,8 +1,8 @@ package com.refinedmods.refinedpipes.network.pipe; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.world.World; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.Level; public interface PipeFactory { - Pipe createFromNbt(World world, CompoundNBT tag); + Pipe createFromNbt(Level world, CompoundTag tag); } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/PipeRegistry.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/PipeRegistry.java index 1e30809..0bcbae8 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/PipeRegistry.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/PipeRegistry.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedpipes.network.pipe; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; import javax.annotation.Nullable; import java.util.HashMap; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/Attachment.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/Attachment.java index 5392216..a8a8654 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/Attachment.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/Attachment.java @@ -1,11 +1,11 @@ package com.refinedmods.refinedpipes.network.pipe.attachment; import com.refinedmods.refinedpipes.network.pipe.Pipe; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.ItemStack; public abstract class Attachment { protected final Pipe pipe; @@ -24,7 +24,7 @@ public Pipe getPipe() { return pipe; } - public CompoundNBT writeToNbt(CompoundNBT tag) { + public CompoundTag writeToNbt(CompoundTag tag) { tag.putInt("dir", direction.ordinal()); return tag; @@ -36,6 +36,6 @@ public CompoundNBT writeToNbt(CompoundNBT tag) { public abstract ItemStack getDrop(); - public void openContainer(ServerPlayerEntity player) { + public void openContainer(ServerPlayer player) { } } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/AttachmentFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/AttachmentFactory.java index ed58163..438d65c 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/AttachmentFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/AttachmentFactory.java @@ -1,16 +1,16 @@ package com.refinedmods.refinedpipes.network.pipe.attachment; import com.refinedmods.refinedpipes.network.pipe.Pipe; -import net.minecraft.block.Block; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Block; import java.util.List; public interface AttachmentFactory { - Attachment createFromNbt(Pipe pipe, CompoundNBT tag); + Attachment createFromNbt(Pipe pipe, CompoundTag tag); Attachment create(Pipe pipe, Direction dir); @@ -20,7 +20,7 @@ public interface AttachmentFactory { ResourceLocation getModelLocation(); - void addInformation(List tooltip); + void addInformation(List tooltip); boolean canPlaceOnPipe(Block pipe); } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/AttachmentManager.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/AttachmentManager.java index b1bd53b..f356f8b 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/AttachmentManager.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/AttachmentManager.java @@ -1,10 +1,10 @@ package com.refinedmods.refinedpipes.network.pipe.attachment; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.ItemStack; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -14,7 +14,7 @@ public interface AttachmentManager { boolean hasAttachment(Direction dir); - void openAttachmentContainer(Direction dir, ServerPlayerEntity player); + void openAttachmentContainer(Direction dir, ServerPlayer player); @Nonnull ItemStack getPickBlock(Direction dir); @@ -22,7 +22,7 @@ public interface AttachmentManager { @Nullable Attachment getAttachment(Direction dir); - void writeUpdate(CompoundNBT tag); + void writeUpdate(CompoundTag tag); - void readUpdate(CompoundNBT tag); + void readUpdate(@Nullable CompoundTag tag); } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/AttachmentRegistry.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/AttachmentRegistry.java index 0e0204f..3ce9b0b 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/AttachmentRegistry.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/AttachmentRegistry.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedpipes.network.pipe.attachment; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; import javax.annotation.Nullable; import java.util.Collection; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ClientAttachmentManager.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ClientAttachmentManager.java index 276db17..473712e 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ClientAttachmentManager.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ClientAttachmentManager.java @@ -1,10 +1,10 @@ package com.refinedmods.refinedpipes.network.pipe.attachment; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.ItemStack; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -26,7 +26,7 @@ public boolean hasAttachment(Direction dir) { } @Override - public void openAttachmentContainer(Direction dir, ServerPlayerEntity player) { + public void openAttachmentContainer(Direction dir, ServerPlayer player) { throw new RuntimeException("Server-side only"); } @@ -43,19 +43,19 @@ public Attachment getAttachment(Direction dir) { } @Override - public void writeUpdate(CompoundNBT tag) { + public void writeUpdate(CompoundTag tag) { throw new RuntimeException("Server-side only"); } @Override - public void readUpdate(CompoundNBT tag) { + public void readUpdate(@Nullable CompoundTag tag) { this.pickBlocks.clear(); for (Direction dir : Direction.values()) { String attachmentKey = "attch_" + dir.ordinal(); String pickBlockKey = "pb_" + dir.ordinal(); - if (tag.contains(attachmentKey) || tag.contains(pickBlockKey)) { + if (tag != null && (tag.contains(attachmentKey) || tag.contains(pickBlockKey))) { pickBlocks.put(dir, ItemStack.of(tag.getCompound(pickBlockKey))); attachmentState[dir.ordinal()] = new ResourceLocation(tag.getString(attachmentKey)); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/DummyAttachmentManager.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/DummyAttachmentManager.java index 9b65ca6..7fba2a9 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/DummyAttachmentManager.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/DummyAttachmentManager.java @@ -1,18 +1,17 @@ package com.refinedmods.refinedpipes.network.pipe.attachment; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.ItemStack; import javax.annotation.Nonnull; import javax.annotation.Nullable; public class DummyAttachmentManager implements AttachmentManager { - private static final ResourceLocation[] STATE = new ResourceLocation[Direction.values().length]; - public static final DummyAttachmentManager INSTANCE = new DummyAttachmentManager(); + private static final ResourceLocation[] STATE = new ResourceLocation[Direction.values().length]; private DummyAttachmentManager() { } @@ -28,7 +27,7 @@ public boolean hasAttachment(Direction dir) { } @Override - public void openAttachmentContainer(Direction dir, ServerPlayerEntity player) { + public void openAttachmentContainer(Direction dir, ServerPlayer player) { } @@ -45,12 +44,12 @@ public Attachment getAttachment(Direction dir) { } @Override - public void writeUpdate(CompoundNBT tag) { + public void writeUpdate(CompoundTag tag) { } @Override - public void readUpdate(CompoundNBT tag) { + public void readUpdate(@Nullable CompoundTag tag) { } } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ServerAttachmentManager.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ServerAttachmentManager.java index 196bd91..5c59b2c 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ServerAttachmentManager.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ServerAttachmentManager.java @@ -1,14 +1,13 @@ package com.refinedmods.refinedpipes.network.pipe.attachment; import com.refinedmods.refinedpipes.network.pipe.Pipe; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.INBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.util.Constants; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.ItemStack; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -36,7 +35,7 @@ public boolean hasAttachment(Direction dir) { } @Override - public void openAttachmentContainer(Direction dir, ServerPlayerEntity player) { + public void openAttachmentContainer(Direction dir, ServerPlayer player) { if (hasAttachment(dir)) { getAttachment(dir).openContainer(player); } @@ -78,10 +77,10 @@ public Collection getAttachments() { return attachments.values(); } - public CompoundNBT writeToNbt(CompoundNBT tag) { - ListNBT attch = new ListNBT(); + public CompoundTag writeToNbt(CompoundTag tag) { + ListTag attch = new ListTag(); getAttachments().forEach(a -> { - CompoundNBT attchTag = new CompoundNBT(); + CompoundTag attchTag = new CompoundTag(); attchTag.putString("typ", a.getId().toString()); attch.add(a.writeToNbt(attchTag)); }); @@ -89,10 +88,10 @@ public CompoundNBT writeToNbt(CompoundNBT tag) { return tag; } - public void readFromNbt(CompoundNBT tag) { - ListNBT attch = tag.getList("attch", Constants.NBT.TAG_COMPOUND); - for (INBT item : attch) { - CompoundNBT attchTag = (CompoundNBT) item; + public void readFromNbt(CompoundTag tag) { + ListTag attch = tag.getList("attch", Tag.TAG_COMPOUND); + for (Tag item : attch) { + CompoundTag attchTag = (CompoundTag) item; AttachmentFactory factory = AttachmentRegistry.INSTANCE.getFactory(new ResourceLocation(attchTag.getString("typ"))); if (factory != null) { @@ -110,17 +109,17 @@ public ResourceLocation[] getState() { } @Override - public void writeUpdate(CompoundNBT tag) { + public void writeUpdate(CompoundTag tag) { for (Direction dir : Direction.values()) { if (hasAttachment(dir)) { tag.putString("attch_" + dir.ordinal(), getAttachment(dir).getId().toString()); - tag.put("pb_" + dir.ordinal(), getAttachment(dir).getDrop().save(new CompoundNBT())); + tag.put("pb_" + dir.ordinal(), getAttachment(dir).getDrop().save(new CompoundTag())); } } } @Override - public void readUpdate(CompoundNBT tag) { + public void readUpdate(@Nullable CompoundTag tag) { throw new RuntimeException("Client-side only"); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/BlacklistWhitelist.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/BlacklistWhitelist.java index 51d836a..35d0efe 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/BlacklistWhitelist.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/BlacklistWhitelist.java @@ -4,6 +4,16 @@ public enum BlacklistWhitelist { BLACKLIST, WHITELIST; + public static BlacklistWhitelist get(byte b) { + BlacklistWhitelist[] v = values(); + + if (b < 0 || b >= v.length) { + return BLACKLIST; + } + + return v[b]; + } + public BlacklistWhitelist next() { switch (this) { case BLACKLIST: @@ -14,14 +24,4 @@ public BlacklistWhitelist next() { return BLACKLIST; } } - - public static BlacklistWhitelist get(byte b) { - BlacklistWhitelist[] v = values(); - - if (b < 0 || b >= v.length) { - return BLACKLIST; - } - - return v[b]; - } } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachment.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachment.java index 3e36646..d447780 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachment.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachment.java @@ -15,13 +15,13 @@ import com.refinedmods.refinedpipes.network.pipe.transport.callback.ItemInsertTransportCallback; import com.refinedmods.refinedpipes.network.pipe.transport.callback.ItemPipeGoneTransportCallback; import com.refinedmods.refinedpipes.routing.Path; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; @@ -35,10 +35,8 @@ import javax.annotation.Nullable; public class ExtractorAttachment extends Attachment { - private static final Logger LOGGER = LogManager.getLogger(ExtractorAttachment.class); - public static final int MAX_FILTER_SLOTS = 15; - + private static final Logger LOGGER = LogManager.getLogger(ExtractorAttachment.class); private final ExtractorAttachmentType type; private final ItemStackHandler itemFilter; private final FluidInventory fluidFilter; @@ -61,6 +59,32 @@ public ExtractorAttachment(Pipe pipe, Direction direction, ExtractorAttachmentTy this.fluidFilter = createFluidFilterInventory(this); } + public static ItemStackHandler createItemFilterInventory(@Nullable ExtractorAttachment attachment) { + return new ItemStackHandler(MAX_FILTER_SLOTS) { + @Override + protected void onContentsChanged(int slot) { + super.onContentsChanged(slot); + + if (attachment != null) { + NetworkManager.get(attachment.pipe.getWorld()).setDirty(); + } + } + }; + } + + public static FluidInventory createFluidFilterInventory(@Nullable ExtractorAttachment attachment) { + return new FluidInventory(MAX_FILTER_SLOTS) { + @Override + protected void onContentsChanged() { + super.onContentsChanged(); + + if (attachment != null) { + NetworkManager.get(attachment.pipe.getWorld()).setDirty(); + } + } + }; + } + public boolean isFluidMode() { return pipe.getNetwork() instanceof FluidNetwork; } @@ -86,7 +110,7 @@ public void update() { BlockPos destinationPos = pipe.getPos().relative(getDirection()); - TileEntity tile = pipe.getWorld().getBlockEntity(destinationPos); + BlockEntity tile = pipe.getWorld().getBlockEntity(destinationPos); if (tile == null) { return; } @@ -263,7 +287,7 @@ private boolean acceptsFluid(FluidStack stack) { } @Override - public void openContainer(ServerPlayerEntity player) { + public void openContainer(ServerPlayer player) { super.openContainer(player); ExtractorAttachmentContainerProvider.open(pipe, this, player); @@ -280,7 +304,7 @@ public ItemStack getDrop() { } @Override - public CompoundNBT writeToNbt(CompoundNBT tag) { + public CompoundTag writeToNbt(CompoundTag tag) { tag.putByte("rm", (byte) redstoneMode.ordinal()); tag.put("itemfilter", itemFilter.serializeNBT()); tag.putByte("bw", (byte) blacklistWhitelist.ordinal()); @@ -317,6 +341,10 @@ public void setRedstoneMode(RedstoneMode redstoneMode) { this.redstoneMode = redstoneMode; } + public BlacklistWhitelist getBlacklistWhitelist() { + return blacklistWhitelist; + } + public void setBlacklistWhitelist(BlacklistWhitelist blacklistWhitelist) { if (!type.getCanSetWhitelistBlacklist()) { return; @@ -325,8 +353,8 @@ public void setBlacklistWhitelist(BlacklistWhitelist blacklistWhitelist) { this.blacklistWhitelist = blacklistWhitelist; } - public BlacklistWhitelist getBlacklistWhitelist() { - return blacklistWhitelist; + public RoutingMode getRoutingMode() { + return routingMode; } public void setRoutingMode(RoutingMode routingMode) { @@ -337,8 +365,8 @@ public void setRoutingMode(RoutingMode routingMode) { this.routingMode = routingMode; } - public RoutingMode getRoutingMode() { - return routingMode; + public int getStackSize() { + return stackSize; } public void setStackSize(int stackSize) { @@ -353,14 +381,14 @@ public void setStackSize(int stackSize) { this.stackSize = stackSize; } - public int getStackSize() { - return stackSize; - } - public void setRoundRobinIndex(int roundRobinIndex) { itemDestinationFinder.setRoundRobinIndex(roundRobinIndex); } + public boolean isExactMode() { + return exactMode; + } + public void setExactMode(boolean exactMode) { if (!type.getCanSetExactMode()) { return; @@ -368,34 +396,4 @@ public void setExactMode(boolean exactMode) { this.exactMode = exactMode; } - - public boolean isExactMode() { - return exactMode; - } - - public static ItemStackHandler createItemFilterInventory(@Nullable ExtractorAttachment attachment) { - return new ItemStackHandler(MAX_FILTER_SLOTS) { - @Override - protected void onContentsChanged(int slot) { - super.onContentsChanged(slot); - - if (attachment != null) { - NetworkManager.get(attachment.pipe.getWorld()).setDirty(); - } - } - }; - } - - public static FluidInventory createFluidFilterInventory(@Nullable ExtractorAttachment attachment) { - return new FluidInventory(MAX_FILTER_SLOTS) { - @Override - protected void onContentsChanged() { - super.onContentsChanged(); - - if (attachment != null) { - NetworkManager.get(attachment.pipe.getWorld()).setDirty(); - } - } - }; - } } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachmentFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachmentFactory.java index 7f9fec4..de83745 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachmentFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachmentFactory.java @@ -7,14 +7,14 @@ import com.refinedmods.refinedpipes.network.pipe.attachment.AttachmentFactory; import com.refinedmods.refinedpipes.util.DirectionUtil; import com.refinedmods.refinedpipes.util.StringUtil; -import net.minecraft.block.Block; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.ChatFormatting; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Block; import java.util.List; @@ -26,7 +26,7 @@ public ExtractorAttachmentFactory(ExtractorAttachmentType type) { } @Override - public Attachment createFromNbt(Pipe pipe, CompoundNBT tag) { + public Attachment createFromNbt(Pipe pipe, CompoundTag tag) { Direction dir = DirectionUtil.safeGet((byte) tag.getInt("dir")); ExtractorAttachment attachment = new ExtractorAttachment(pipe, dir, type); @@ -87,42 +87,42 @@ public ResourceLocation getModelLocation() { } @Override - public void addInformation(List tooltip) { - tooltip.add(new TranslationTextComponent("misc.refinedpipes.tier", new TranslationTextComponent("enchantment.level." + type.getTier())).withStyle(TextFormatting.YELLOW)); + public void addInformation(List tooltip) { + tooltip.add(new TranslatableComponent("misc.refinedpipes.tier", new TranslatableComponent("enchantment.level." + type.getTier())).withStyle(ChatFormatting.YELLOW)); - ITextComponent itemsToExtract = new StringTextComponent(StringUtil.formatNumber(type.getItemsToExtract()) + " ") - .append(new TranslationTextComponent("misc.refinedpipes.item" + (type.getItemsToExtract() == 1 ? "" : "s"))) - .withStyle(TextFormatting.WHITE); + Component itemsToExtract = new TextComponent(StringUtil.formatNumber(type.getItemsToExtract()) + " ") + .append(new TranslatableComponent("misc.refinedpipes.item" + (type.getItemsToExtract() == 1 ? "" : "s"))) + .withStyle(ChatFormatting.WHITE); float itemSecondsInterval = type.getItemTickInterval() / 20F; - ITextComponent itemTickInterval = new StringTextComponent(StringUtil.formatNumber(itemSecondsInterval) + " ") - .append(new TranslationTextComponent("misc.refinedpipes.second" + (itemSecondsInterval == 1 ? "" : "s"))) - .withStyle(TextFormatting.WHITE); + Component itemTickInterval = new TextComponent(StringUtil.formatNumber(itemSecondsInterval) + " ") + .append(new TranslatableComponent("misc.refinedpipes.second" + (itemSecondsInterval == 1 ? "" : "s"))) + .withStyle(ChatFormatting.WHITE); - tooltip.add(new TranslationTextComponent( + tooltip.add(new TranslatableComponent( "tooltip.refinedpipes.extractor_attachment.item_extraction_rate", itemsToExtract, itemTickInterval - ).withStyle(TextFormatting.GRAY)); + ).withStyle(ChatFormatting.GRAY)); - ITextComponent fluidsToExtract = new StringTextComponent(StringUtil.formatNumber(type.getFluidsToExtract()) + " mB") - .withStyle(TextFormatting.WHITE); + Component fluidsToExtract = new TextComponent(StringUtil.formatNumber(type.getFluidsToExtract()) + " mB") + .withStyle(ChatFormatting.WHITE); float fluidSecondsInterval = type.getFluidTickInterval() / 20F; - ITextComponent fluidTickInterval = new StringTextComponent(StringUtil.formatNumber(fluidSecondsInterval) + " ") - .append(new TranslationTextComponent("misc.refinedpipes.second" + (fluidSecondsInterval == 1 ? "" : "s"))) - .withStyle(TextFormatting.WHITE); + Component fluidTickInterval = new TextComponent(StringUtil.formatNumber(fluidSecondsInterval) + " ") + .append(new TranslatableComponent("misc.refinedpipes.second" + (fluidSecondsInterval == 1 ? "" : "s"))) + .withStyle(ChatFormatting.WHITE); - tooltip.add(new TranslationTextComponent( + tooltip.add(new TranslatableComponent( "tooltip.refinedpipes.extractor_attachment.fluid_extraction_rate", fluidsToExtract, fluidTickInterval - ).withStyle(TextFormatting.GRAY)); + ).withStyle(ChatFormatting.GRAY)); - tooltip.add(new TranslationTextComponent( + tooltip.add(new TranslatableComponent( "tooltip.refinedpipes.extractor_attachment.filter_slots", - new StringTextComponent("" + type.getFilterSlots()).withStyle(TextFormatting.WHITE) - ).withStyle(TextFormatting.GRAY)); + new TextComponent("" + type.getFilterSlots()).withStyle(ChatFormatting.WHITE) + ).withStyle(ChatFormatting.GRAY)); addAbilityToInformation(tooltip, type.getCanSetRedstoneMode(), "misc.refinedpipes.redstone_mode"); addAbilityToInformation(tooltip, type.getCanSetWhitelistBlacklist(), "misc.refinedpipes.mode"); @@ -130,10 +130,10 @@ public void addInformation(List tooltip) { addAbilityToInformation(tooltip, type.getCanSetExactMode(), "misc.refinedpipes.exact_mode"); } - private void addAbilityToInformation(List tooltip, boolean possible, String key) { + private void addAbilityToInformation(List tooltip, boolean possible, String key) { tooltip.add( - new StringTextComponent(possible ? "âś“ " : "❌ ").append(new TranslationTextComponent(key)) - .withStyle(possible ? TextFormatting.GREEN : TextFormatting.RED) + new TextComponent(possible ? "âś“ " : "❌ ").append(new TranslatableComponent(key)) + .withStyle(possible ? ChatFormatting.GREEN : ChatFormatting.RED) ); } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachmentType.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachmentType.java index 84fa7ad..e5dd7ed 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachmentType.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachmentType.java @@ -3,8 +3,8 @@ import com.refinedmods.refinedpipes.RefinedPipes; import com.refinedmods.refinedpipes.RefinedPipesItems; import com.refinedmods.refinedpipes.config.ServerConfig; -import net.minecraft.item.Item; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; public enum ExtractorAttachmentType { BASIC(1), @@ -19,6 +19,16 @@ public enum ExtractorAttachmentType { this.tier = tier; } + public static ExtractorAttachmentType get(byte b) { + ExtractorAttachmentType[] v = values(); + + if (b < 0 || b >= v.length) { + return BASIC; + } + + return v[b]; + } + public int getTier() { return tier; } @@ -143,14 +153,4 @@ ResourceLocation getModelLocation() { throw new RuntimeException("?"); } } - - public static ExtractorAttachmentType get(byte b) { - ExtractorAttachmentType[] v = values(); - - if (b < 0 || b >= v.length) { - return BASIC; - } - - return v[b]; - } } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ItemDestinationFinder.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ItemDestinationFinder.java index cf1a959..db73465 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ItemDestinationFinder.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ItemDestinationFinder.java @@ -4,9 +4,9 @@ import com.refinedmods.refinedpipes.network.pipe.Destination; import com.refinedmods.refinedpipes.network.pipe.DestinationType; import com.refinedmods.refinedpipes.network.pipe.attachment.Attachment; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; @@ -80,7 +80,7 @@ public Destination find(RoutingMode routingMode, BlockPos sourcePos, ItemStack e } private boolean isDestinationApplicable(BlockPos sourcePos, ItemStack extracted, Destination destination) { - TileEntity tile = destination.getConnectedPipe().getWorld().getBlockEntity(destination.getReceiver()); + BlockEntity tile = destination.getConnectedPipe().getWorld().getBlockEntity(destination.getReceiver()); if (tile == null) { return false; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/RedstoneMode.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/RedstoneMode.java index 7340595..c62d1ae 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/RedstoneMode.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/RedstoneMode.java @@ -1,14 +1,24 @@ package com.refinedmods.refinedpipes.network.pipe.attachment.extractor; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; public enum RedstoneMode { IGNORED, HIGH, LOW; - public boolean isEnabled(World world, BlockPos pos) { + public static RedstoneMode get(byte b) { + RedstoneMode[] m = values(); + + if (b < 0 || b >= m.length) { + return IGNORED; + } + + return m[b]; + } + + public boolean isEnabled(Level world, BlockPos pos) { switch (this) { case IGNORED: return true; @@ -21,16 +31,6 @@ public boolean isEnabled(World world, BlockPos pos) { } } - public static RedstoneMode get(byte b) { - RedstoneMode[] m = values(); - - if (b < 0 || b >= m.length) { - return IGNORED; - } - - return m[b]; - } - public RedstoneMode next() { switch (this) { case IGNORED: diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipe.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipe.java index 5963609..8083cf6 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipe.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipe.java @@ -4,10 +4,10 @@ import com.refinedmods.refinedpipes.network.Network; import com.refinedmods.refinedpipes.network.energy.EnergyNetwork; import com.refinedmods.refinedpipes.network.pipe.Pipe; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; import net.minecraftforge.common.util.LazyOptional; public class EnergyPipe extends Pipe { @@ -17,7 +17,7 @@ public class EnergyPipe extends Pipe { private LazyOptional energyStorage = LazyOptional.empty(); - public EnergyPipe(World world, BlockPos pos, EnergyPipeType type) { + public EnergyPipe(Level world, BlockPos pos, EnergyPipeType type) { super(world, pos); this.type = type; } @@ -45,7 +45,7 @@ public EnergyPipeType getType() { } @Override - public CompoundNBT writeToNbt(CompoundNBT tag) { + public CompoundTag writeToNbt(CompoundTag tag) { tag = super.writeToNbt(tag); tag.putInt("type", type.ordinal()); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeFactory.java index 1ff55bb..5947eab 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeFactory.java @@ -2,13 +2,13 @@ import com.refinedmods.refinedpipes.network.pipe.Pipe; import com.refinedmods.refinedpipes.network.pipe.PipeFactory; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.Level; public class EnergyPipeFactory implements PipeFactory { @Override - public Pipe createFromNbt(World world, CompoundNBT tag) { + public Pipe createFromNbt(Level world, CompoundTag tag) { BlockPos pos = BlockPos.of(tag.getLong("pos")); EnergyPipeType pipeType = EnergyPipeType.values()[tag.getInt("type")]; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeType.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeType.java index 70af153..2246d52 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeType.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeType.java @@ -3,8 +3,8 @@ import com.refinedmods.refinedpipes.RefinedPipes; import com.refinedmods.refinedpipes.RefinedPipesTileEntities; import com.refinedmods.refinedpipes.tile.EnergyPipeTileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.entity.BlockEntityType; public enum EnergyPipeType { BASIC(1), @@ -91,7 +91,7 @@ public ResourceLocation getNetworkType() { } } - public TileEntityType getTileType() { + public BlockEntityType getTileType() { switch (this) { case BASIC: return RefinedPipesTileEntities.BASIC_ENERGY_PIPE; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipe.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipe.java index a50e0a9..c0848c8 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipe.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipe.java @@ -4,10 +4,10 @@ import com.refinedmods.refinedpipes.message.FluidPipeMessage; import com.refinedmods.refinedpipes.network.fluid.FluidNetwork; import com.refinedmods.refinedpipes.network.pipe.Pipe; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; public class FluidPipe extends Pipe { public static final ResourceLocation ID = new ResourceLocation(RefinedPipes.ID, "fluid"); @@ -15,7 +15,7 @@ public class FluidPipe extends Pipe { private final FluidPipeType type; private float lastFullness = 0; - public FluidPipe(World world, BlockPos pos, FluidPipeType type) { + public FluidPipe(Level world, BlockPos pos, FluidPipeType type) { super(world, pos); this.type = type; @@ -49,7 +49,7 @@ public FluidPipeType getType() { } @Override - public CompoundNBT writeToNbt(CompoundNBT tag) { + public CompoundTag writeToNbt(CompoundTag tag) { tag = super.writeToNbt(tag); tag.putInt("type", type.ordinal()); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeFactory.java index 096b634..7fee1ea 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeFactory.java @@ -2,13 +2,13 @@ import com.refinedmods.refinedpipes.network.pipe.Pipe; import com.refinedmods.refinedpipes.network.pipe.PipeFactory; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.Level; public class FluidPipeFactory implements PipeFactory { @Override - public Pipe createFromNbt(World world, CompoundNBT tag) { + public Pipe createFromNbt(Level world, CompoundTag tag) { BlockPos pos = BlockPos.of(tag.getLong("pos")); FluidPipeType pipeType = FluidPipeType.values()[tag.getInt("type")]; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeType.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeType.java index 30398fa..621d80e 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeType.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeType.java @@ -3,8 +3,8 @@ import com.refinedmods.refinedpipes.RefinedPipes; import com.refinedmods.refinedpipes.RefinedPipesTileEntities; import com.refinedmods.refinedpipes.tile.FluidPipeTileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.entity.BlockEntityType; public enum FluidPipeType { BASIC(1), @@ -23,7 +23,7 @@ public int getTier() { return tier; } - public TileEntityType getTileType() { + public BlockEntityType getTileType() { switch (this) { case BASIC: return RefinedPipesTileEntities.BASIC_FLUID_PIPE; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipe.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipe.java index 0ed9f93..8c3c826 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipe.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipe.java @@ -7,11 +7,11 @@ import com.refinedmods.refinedpipes.network.pipe.Pipe; import com.refinedmods.refinedpipes.network.pipe.transport.ItemTransport; import com.refinedmods.refinedpipes.network.pipe.transport.ItemTransportProps; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; import java.util.ArrayList; import java.util.List; @@ -24,7 +24,7 @@ public class ItemPipe extends Pipe { private final List transportsToRemove = new ArrayList<>(); private final ItemPipeType type; - public ItemPipe(World world, BlockPos pos, ItemPipeType type) { + public ItemPipe(Level world, BlockPos pos, ItemPipeType type) { super(world, pos); this.type = type; @@ -75,14 +75,14 @@ public void sendTransportUpdate() { } @Override - public CompoundNBT writeToNbt(CompoundNBT tag) { + public CompoundTag writeToNbt(CompoundTag tag) { tag = super.writeToNbt(tag); tag.putInt("type", type.ordinal()); - ListNBT transports = new ListNBT(); + ListTag transports = new ListTag(); for (ItemTransport transport : this.transports) { - transports.add(transport.writeToNbt(new CompoundNBT())); + transports.add(transport.writeToNbt(new CompoundTag())); } tag.put("transports", transports); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeFactory.java index 16f01f5..049a68b 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeFactory.java @@ -3,15 +3,15 @@ import com.refinedmods.refinedpipes.network.pipe.Pipe; import com.refinedmods.refinedpipes.network.pipe.PipeFactory; import com.refinedmods.refinedpipes.network.pipe.transport.ItemTransport; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.common.util.Constants; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.Tag; +import net.minecraft.world.level.Level; public class ItemPipeFactory implements PipeFactory { @Override - public Pipe createFromNbt(World world, CompoundNBT tag) { + public Pipe createFromNbt(Level world, CompoundTag tag) { BlockPos pos = BlockPos.of(tag.getLong("pos")); ItemPipeType pipeType = ItemPipeType.values()[tag.getInt("type")]; @@ -20,9 +20,9 @@ public Pipe createFromNbt(World world, CompoundNBT tag) { pipe.getAttachmentManager().readFromNbt(tag); - ListNBT transports = tag.getList("transports", Constants.NBT.TAG_COMPOUND); + ListTag transports = tag.getList("transports", Tag.TAG_COMPOUND); for (int i = 0; i < transports.size(); ++i) { - CompoundNBT transportTag = transports.getCompound(i); + CompoundTag transportTag = transports.getCompound(i); ItemTransport itemTransport = ItemTransport.of(transportTag); if (itemTransport != null) { diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeType.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeType.java index dae8afb..e7c1d71 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeType.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeType.java @@ -3,8 +3,8 @@ import com.refinedmods.refinedpipes.RefinedPipes; import com.refinedmods.refinedpipes.RefinedPipesTileEntities; import com.refinedmods.refinedpipes.tile.ItemPipeTileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.entity.BlockEntityType; public enum ItemPipeType { BASIC(1), @@ -45,7 +45,7 @@ public int getSpeedComparedToBasicTier() { return (int) ((float) mySpeed / (float) speedOfBasicTier * 100F); } - public TileEntityType getTileType() { + public BlockEntityType getTileType() { switch (this) { case BASIC: return RefinedPipesTileEntities.BASIC_ITEM_PIPE; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeCache.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeCache.java index e6a1ec5..d97bb13 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeCache.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeCache.java @@ -4,22 +4,23 @@ import com.refinedmods.refinedpipes.network.pipe.attachment.AttachmentFactory; import com.refinedmods.refinedpipes.tile.PipeTileEntity; import com.refinedmods.refinedpipes.util.Raytracer; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.IBlockReader; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.EntityCollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.apache.commons.lang3.tuple.Pair; import java.util.ArrayList; @@ -31,7 +32,7 @@ public class PipeShapeCache { private static final ResourceLocation[] NO_ATTACHMENT_STATE = new ResourceLocation[Direction.values().length]; private final PipeShapeFactory shapeFactory; - private final List attachmentShapes = new ArrayList<>(); + private final List attachmentShapes = new ArrayList<>(); private final Map cache = new HashMap<>(); public PipeShapeCache(PipeShapeFactory shapeFactory) { @@ -45,14 +46,14 @@ public PipeShapeCache(PipeShapeFactory shapeFactory) { attachmentShapes.add(PipeShapeProps.DOWN_ATTACHMENT_SHAPE.bounds()); } - public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext ctx) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext ctx) { VoxelShape shape = createShapeIfNeeded(state, world, pos); - if (ctx.getEntity() instanceof PlayerEntity) { - Item inHand = ((PlayerEntity) ctx.getEntity()).getMainHandItem().getItem(); + if (ctx instanceof EntityCollisionContext entityCollisionContext && entityCollisionContext.getEntity() instanceof Player player) { + Item inHand = player.getMainHandItem().getItem(); if (inHand instanceof AttachmentItem) { - shape = addFakeAttachmentShape(state.getBlock(), pos, ctx.getEntity(), shape, ((AttachmentItem) inHand).getFactory()); + shape = addFakeAttachmentShape(state.getBlock(), pos, player, shape, ((AttachmentItem) inHand).getFactory()); } } @@ -64,20 +65,20 @@ private VoxelShape addFakeAttachmentShape(Block block, BlockPos pos, Entity enti return shape; } - Pair vec = Raytracer.getVectors(entity); + Pair vec = Raytracer.getVectors(entity); - Raytracer.AdvancedRayTraceResult result = Raytracer.collisionRayTrace(pos, vec.getLeft(), vec.getRight(), attachmentShapes); + Raytracer.AdvancedRayTraceResult result = Raytracer.collisionRayTrace(pos, vec.getLeft(), vec.getRight(), attachmentShapes); if (result != null) { - shape = VoxelShapes.or(shape, VoxelShapes.create(result.bounds)); + shape = Shapes.or(shape, Shapes.create(result.bounds)); } return shape; } - private VoxelShape createShapeIfNeeded(BlockState state, IBlockReader world, BlockPos pos) { + private VoxelShape createShapeIfNeeded(BlockState state, BlockGetter world, BlockPos pos) { ResourceLocation[] attachmentState; - TileEntity tile = world.getBlockEntity(pos); + BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof PipeTileEntity) { attachmentState = ((PipeTileEntity) tile).getAttachmentManager().getState(); } else { diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeCacheEntry.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeCacheEntry.java index 9cacef1..b3f2d47 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeCacheEntry.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeCacheEntry.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedpipes.network.pipe.shape; -import net.minecraft.block.BlockState; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.state.BlockState; import java.util.Arrays; import java.util.Objects; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeFactory.java index b859e30..3792076 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeFactory.java @@ -1,62 +1,62 @@ package com.refinedmods.refinedpipes.network.pipe.shape; import com.refinedmods.refinedpipes.block.PipeBlock; -import net.minecraft.block.BlockState; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; public class PipeShapeFactory { public VoxelShape createShape(BlockState state, ResourceLocation[] attachmentState) { VoxelShape shape = PipeShapeProps.CORE_SHAPE; if (state.getValue(PipeBlock.NORTH)) { - shape = VoxelShapes.or(shape, PipeShapeProps.NORTH_EXTENSION_SHAPE); + shape = Shapes.or(shape, PipeShapeProps.NORTH_EXTENSION_SHAPE); } if (state.getValue(PipeBlock.EAST)) { - shape = VoxelShapes.or(shape, PipeShapeProps.EAST_EXTENSION_SHAPE); + shape = Shapes.or(shape, PipeShapeProps.EAST_EXTENSION_SHAPE); } if (state.getValue(PipeBlock.SOUTH)) { - shape = VoxelShapes.or(shape, PipeShapeProps.SOUTH_EXTENSION_SHAPE); + shape = Shapes.or(shape, PipeShapeProps.SOUTH_EXTENSION_SHAPE); } if (state.getValue(PipeBlock.WEST)) { - shape = VoxelShapes.or(shape, PipeShapeProps.WEST_EXTENSION_SHAPE); + shape = Shapes.or(shape, PipeShapeProps.WEST_EXTENSION_SHAPE); } if (state.getValue(PipeBlock.UP)) { - shape = VoxelShapes.or(shape, PipeShapeProps.UP_EXTENSION_SHAPE); + shape = Shapes.or(shape, PipeShapeProps.UP_EXTENSION_SHAPE); } if (state.getValue(PipeBlock.DOWN)) { - shape = VoxelShapes.or(shape, PipeShapeProps.DOWN_EXTENSION_SHAPE); + shape = Shapes.or(shape, PipeShapeProps.DOWN_EXTENSION_SHAPE); } if (attachmentState[Direction.NORTH.ordinal()] != null || state.getValue(PipeBlock.INV_NORTH)) { - shape = VoxelShapes.or(shape, PipeShapeProps.NORTH_ATTACHMENT_SHAPE); + shape = Shapes.or(shape, PipeShapeProps.NORTH_ATTACHMENT_SHAPE); } if (attachmentState[Direction.EAST.ordinal()] != null || state.getValue(PipeBlock.INV_EAST)) { - shape = VoxelShapes.or(shape, PipeShapeProps.EAST_ATTACHMENT_SHAPE); + shape = Shapes.or(shape, PipeShapeProps.EAST_ATTACHMENT_SHAPE); } if (attachmentState[Direction.SOUTH.ordinal()] != null || state.getValue(PipeBlock.INV_SOUTH)) { - shape = VoxelShapes.or(shape, PipeShapeProps.SOUTH_ATTACHMENT_SHAPE); + shape = Shapes.or(shape, PipeShapeProps.SOUTH_ATTACHMENT_SHAPE); } if (attachmentState[Direction.WEST.ordinal()] != null || state.getValue(PipeBlock.INV_WEST)) { - shape = VoxelShapes.or(shape, PipeShapeProps.WEST_ATTACHMENT_SHAPE); + shape = Shapes.or(shape, PipeShapeProps.WEST_ATTACHMENT_SHAPE); } if (attachmentState[Direction.UP.ordinal()] != null || state.getValue(PipeBlock.INV_UP)) { - shape = VoxelShapes.or(shape, PipeShapeProps.UP_ATTACHMENT_SHAPE); + shape = Shapes.or(shape, PipeShapeProps.UP_ATTACHMENT_SHAPE); } if (attachmentState[Direction.DOWN.ordinal()] != null || state.getValue(PipeBlock.INV_DOWN)) { - shape = VoxelShapes.or(shape, PipeShapeProps.DOWN_ATTACHMENT_SHAPE); + shape = Shapes.or(shape, PipeShapeProps.DOWN_ATTACHMENT_SHAPE); } return shape; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeProps.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeProps.java index 0f2fd7d..e8d2ef2 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeProps.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeProps.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedpipes.network.pipe.shape; -import net.minecraft.block.Block; -import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.phys.shapes.VoxelShape; public class PipeShapeProps { public static final VoxelShape CORE_SHAPE = Block.box(4, 4, 4, 12, 12, 12); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransport.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransport.java index 198454b..0609154 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransport.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransport.java @@ -7,16 +7,15 @@ import com.refinedmods.refinedpipes.network.pipe.transport.callback.TransportCallbackFactory; import com.refinedmods.refinedpipes.network.pipe.transport.callback.TransportCallbackFactoryRegistry; import com.refinedmods.refinedpipes.util.DirectionUtil; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.INBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.nbt.LongNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.common.util.Constants; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.LongTag; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -63,6 +62,106 @@ public ItemTransport(ItemStack value, BlockPos source, BlockPos destination, Deq this.progressInCurrentPipe = progressInCurrentPipe; } + private static Direction getDirection(BlockPos a, BlockPos b) { + if (a.relative(Direction.NORTH).equals(b)) { + return Direction.NORTH; + } + + if (a.relative(Direction.EAST).equals(b)) { + return Direction.EAST; + } + + if (a.relative(Direction.SOUTH).equals(b)) { + return Direction.SOUTH; + } + + if (a.relative(Direction.WEST).equals(b)) { + return Direction.WEST; + } + + if (a.relative(Direction.UP).equals(b)) { + return Direction.UP; + } + + if (a.relative(Direction.DOWN).equals(b)) { + return Direction.DOWN; + } + + return Direction.NORTH; + } + + @Nullable + public static ItemTransport of(CompoundTag tag) { + ItemStack value = ItemStack.of(tag.getCompound("v")); + if (value.isEmpty()) { + LOGGER.warn("Item no longer exists"); + return null; + } + + BlockPos source = BlockPos.of(tag.getLong("src")); + BlockPos destination = BlockPos.of(tag.getLong("dst")); + + ListTag pathTag = tag.getList("pth", Tag.TAG_LONG); + Deque path = new ArrayDeque<>(); + for (Tag pathItem : pathTag) { + path.add(BlockPos.of(((LongTag) pathItem).getAsLong())); + } + + Direction initialDirection = DirectionUtil.safeGet((byte) tag.getInt("initd")); + + ResourceLocation finishedCallbackId = new ResourceLocation(tag.getString("fcid")); + TransportCallbackFactory finishedCallbackFactory = TransportCallbackFactoryRegistry.INSTANCE.getFactory(finishedCallbackId); + if (finishedCallbackFactory == null) { + LOGGER.warn("Finished callback factory " + finishedCallbackId + " no longer exists"); + return null; + } + TransportCallback finishedCallback = finishedCallbackFactory.create(tag.getCompound("fc")); + if (finishedCallback == null) { + LOGGER.warn("Finished callback factory " + finishedCallbackId + " returned null!"); + return null; + } + + ResourceLocation cancelCallbackId = new ResourceLocation(tag.getString("ccid")); + TransportCallbackFactory cancelCallbackFactory = TransportCallbackFactoryRegistry.INSTANCE.getFactory(cancelCallbackId); + if (cancelCallbackFactory == null) { + LOGGER.warn("Cancel callback factory " + cancelCallbackId + " no longer exists"); + return null; + } + TransportCallback cancelCallback = cancelCallbackFactory.create(tag.getCompound("cc")); + if (cancelCallback == null) { + LOGGER.warn("Cancel callback factory " + cancelCallbackId + " returned null!"); + return null; + } + + ResourceLocation pipeGoneCallbackId = new ResourceLocation(tag.getString("pgcid")); + TransportCallbackFactory pipeGoneCallbackFactory = TransportCallbackFactoryRegistry.INSTANCE.getFactory(pipeGoneCallbackId); + if (pipeGoneCallbackFactory == null) { + LOGGER.warn("Pipe gone callback factory " + pipeGoneCallbackId + " no longer exists"); + return null; + } + TransportCallback pipeGoneCallback = pipeGoneCallbackFactory.create(tag.getCompound("pgc")); + if (pipeGoneCallback == null) { + LOGGER.warn("Pipe gone callback factory " + pipeGoneCallbackId + " returned null!"); + return null; + } + + boolean firstPipe = tag.getBoolean("fp"); + int progressInCurrentPipe = tag.getInt("p"); + + return new ItemTransport( + value, + source, + destination, + path, + initialDirection, + finishedCallback, + cancelCallback, + pipeGoneCallback, + firstPipe, + progressInCurrentPipe + ); + } + public ItemStack getValue() { return value; } @@ -77,12 +176,12 @@ public Direction getDirection(ItemPipe currentPipe) { return getDirection(currentPipe.getPos(), nextPipe); } - private boolean onDone(Network network, World world, ItemPipe currentPipe) { + private boolean onDone(Network network, Level world, ItemPipe currentPipe) { finishedCallback.call(network, world, currentPipe.getPos(), cancelCallback); return true; } - private boolean onPipeGone(Network network, World world, BlockPos posWherePipeIsGone) { + private boolean onPipeGone(Network network, Level world, BlockPos posWherePipeIsGone) { LOGGER.warn("Pipe on path is gone"); pipeGoneCallback.call(network, world, posWherePipeIsGone, cancelCallback); return true; @@ -124,34 +223,6 @@ private boolean isLastPipe() { return path.isEmpty(); } - private static Direction getDirection(BlockPos a, BlockPos b) { - if (a.relative(Direction.NORTH).equals(b)) { - return Direction.NORTH; - } - - if (a.relative(Direction.EAST).equals(b)) { - return Direction.EAST; - } - - if (a.relative(Direction.SOUTH).equals(b)) { - return Direction.SOUTH; - } - - if (a.relative(Direction.WEST).equals(b)) { - return Direction.WEST; - } - - if (a.relative(Direction.UP).equals(b)) { - return Direction.UP; - } - - if (a.relative(Direction.DOWN).equals(b)) { - return Direction.DOWN; - } - - return Direction.NORTH; - } - private int getMaxTicksInPipe(ItemPipe currentPipe) { double mt = currentPipe.getMaxTicksInPipe(); @@ -178,24 +249,24 @@ public ItemTransportProps createProps(ItemPipe currentPipe) { ); } - public CompoundNBT writeToNbt(CompoundNBT tag) { - tag.put("v", value.save(new CompoundNBT())); + public CompoundTag writeToNbt(CompoundTag tag) { + tag.put("v", value.save(new CompoundTag())); tag.putLong("src", source.asLong()); tag.putLong("dst", destination.asLong()); - ListNBT path = new ListNBT(); + ListTag path = new ListTag(); for (BlockPos pathItem : this.path) { - path.add(LongNBT.valueOf(pathItem.asLong())); + path.add(LongTag.valueOf(pathItem.asLong())); } tag.put("pth", path); tag.putInt("initiald", initialDirection.ordinal()); - tag.put("fc", finishedCallback.writeToNbt(new CompoundNBT())); + tag.put("fc", finishedCallback.writeToNbt(new CompoundTag())); tag.putString("fcid", finishedCallback.getId().toString()); - tag.put("cc", cancelCallback.writeToNbt(new CompoundNBT())); + tag.put("cc", cancelCallback.writeToNbt(new CompoundTag())); tag.putString("ccid", cancelCallback.getId().toString()); - tag.put("pgc", pipeGoneCallback.writeToNbt(new CompoundNBT())); + tag.put("pgc", pipeGoneCallback.writeToNbt(new CompoundTag())); tag.putString("pgcid", pipeGoneCallback.getId().toString()); tag.putBoolean("fp", firstPipe); @@ -203,76 +274,4 @@ public CompoundNBT writeToNbt(CompoundNBT tag) { return tag; } - - @Nullable - public static ItemTransport of(CompoundNBT tag) { - ItemStack value = ItemStack.of(tag.getCompound("v")); - if (value.isEmpty()) { - LOGGER.warn("Item no longer exists"); - return null; - } - - BlockPos source = BlockPos.of(tag.getLong("src")); - BlockPos destination = BlockPos.of(tag.getLong("dst")); - - ListNBT pathTag = tag.getList("pth", Constants.NBT.TAG_LONG); - Deque path = new ArrayDeque<>(); - for (INBT pathItem : pathTag) { - path.add(BlockPos.of(((LongNBT) pathItem).getAsLong())); - } - - Direction initialDirection = DirectionUtil.safeGet((byte) tag.getInt("initd")); - - ResourceLocation finishedCallbackId = new ResourceLocation(tag.getString("fcid")); - TransportCallbackFactory finishedCallbackFactory = TransportCallbackFactoryRegistry.INSTANCE.getFactory(finishedCallbackId); - if (finishedCallbackFactory == null) { - LOGGER.warn("Finished callback factory " + finishedCallbackId + " no longer exists"); - return null; - } - TransportCallback finishedCallback = finishedCallbackFactory.create(tag.getCompound("fc")); - if (finishedCallback == null) { - LOGGER.warn("Finished callback factory " + finishedCallbackId + " returned null!"); - return null; - } - - ResourceLocation cancelCallbackId = new ResourceLocation(tag.getString("ccid")); - TransportCallbackFactory cancelCallbackFactory = TransportCallbackFactoryRegistry.INSTANCE.getFactory(cancelCallbackId); - if (cancelCallbackFactory == null) { - LOGGER.warn("Cancel callback factory " + cancelCallbackId + " no longer exists"); - return null; - } - TransportCallback cancelCallback = cancelCallbackFactory.create(tag.getCompound("cc")); - if (cancelCallback == null) { - LOGGER.warn("Cancel callback factory " + cancelCallbackId + " returned null!"); - return null; - } - - ResourceLocation pipeGoneCallbackId = new ResourceLocation(tag.getString("pgcid")); - TransportCallbackFactory pipeGoneCallbackFactory = TransportCallbackFactoryRegistry.INSTANCE.getFactory(pipeGoneCallbackId); - if (pipeGoneCallbackFactory == null) { - LOGGER.warn("Pipe gone callback factory " + pipeGoneCallbackId + " no longer exists"); - return null; - } - TransportCallback pipeGoneCallback = pipeGoneCallbackFactory.create(tag.getCompound("pgc")); - if (pipeGoneCallback == null) { - LOGGER.warn("Pipe gone callback factory " + pipeGoneCallbackId + " returned null!"); - return null; - } - - boolean firstPipe = tag.getBoolean("fp"); - int progressInCurrentPipe = tag.getInt("p"); - - return new ItemTransport( - value, - source, - destination, - path, - initialDirection, - finishedCallback, - cancelCallback, - pipeGoneCallback, - firstPipe, - progressInCurrentPipe - ); - } } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransportProps.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransportProps.java index 8df2576..a67bf33 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransportProps.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransportProps.java @@ -1,18 +1,18 @@ package com.refinedmods.refinedpipes.network.pipe.transport; import com.refinedmods.refinedpipes.util.DirectionUtil; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.Direction; +import net.minecraft.core.Direction; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.item.ItemStack; public class ItemTransportProps { private final ItemStack stack; private final int maxTicksInPipe; - private int progress; private final Direction direction; private final Direction initialDirection; private final boolean lastPipe; private final boolean firstPipe; + private int progress; public ItemTransportProps(ItemStack stack, int maxTicksInPipe, int progress, Direction direction, Direction initialDirection, boolean lastPipe, boolean firstPipe) { this.stack = stack; @@ -24,17 +24,7 @@ public ItemTransportProps(ItemStack stack, int maxTicksInPipe, int progress, Dir this.firstPipe = firstPipe; } - public void writeToBuffer(PacketBuffer buf) { - buf.writeItem(stack); - buf.writeInt(maxTicksInPipe); - buf.writeInt(progress); - buf.writeInt(direction.ordinal()); - buf.writeInt(initialDirection.ordinal()); - buf.writeBoolean(lastPipe); - buf.writeBoolean(firstPipe); - } - - public static ItemTransportProps create(PacketBuffer buf) { + public static ItemTransportProps create(FriendlyByteBuf buf) { return new ItemTransportProps( buf.readItem(), buf.readInt(), @@ -46,6 +36,16 @@ public static ItemTransportProps create(PacketBuffer buf) { ); } + public void writeToBuffer(FriendlyByteBuf buf) { + buf.writeItem(stack); + buf.writeInt(maxTicksInPipe); + buf.writeInt(progress); + buf.writeInt(direction.ordinal()); + buf.writeInt(initialDirection.ordinal()); + buf.writeBoolean(lastPipe); + buf.writeBoolean(firstPipe); + } + public void tick() { progress++; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemBounceBackTransportCallback.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemBounceBackTransportCallback.java index 589e771..dc8f4d7 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemBounceBackTransportCallback.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemBounceBackTransportCallback.java @@ -2,22 +2,20 @@ import com.refinedmods.refinedpipes.RefinedPipes; import com.refinedmods.refinedpipes.network.Network; -import net.minecraft.inventory.InventoryHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.Containers; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import javax.annotation.Nullable; public class ItemBounceBackTransportCallback implements TransportCallback { - private static final Logger LOGGER = LogManager.getLogger(ItemBounceBackTransportCallback.class); - public static final ResourceLocation ID = new ResourceLocation(RefinedPipes.ID, "item_bounce_back"); - + private static final Logger LOGGER = LogManager.getLogger(ItemBounceBackTransportCallback.class); private final BlockPos originalItemHandlerPosition; private final BlockPos bounceBackItemHandlerPosition; private final ItemStack toInsert; @@ -28,19 +26,8 @@ public ItemBounceBackTransportCallback(BlockPos originalItemHandlerPosition, Blo this.toInsert = toInsert; } - @Override - public void call(Network network, World world, BlockPos currentPos, TransportCallback cancelCallback) { - // TODO: Actually bounce back... - InventoryHelper.dropItemStack(world, originalItemHandlerPosition.getX(), originalItemHandlerPosition.getY(), originalItemHandlerPosition.getZ(), toInsert); - } - - @Override - public ResourceLocation getId() { - return ID; - } - @Nullable - public static ItemBounceBackTransportCallback of(CompoundNBT tag) { + public static ItemBounceBackTransportCallback of(CompoundTag tag) { BlockPos originalItemHandlerPosition = BlockPos.of(tag.getLong("oihpos")); BlockPos bounceBackItemHandlerPosition = BlockPos.of(tag.getLong("bbihpos")); ItemStack toInsert = ItemStack.of(tag.getCompound("s")); @@ -54,10 +41,21 @@ public static ItemBounceBackTransportCallback of(CompoundNBT tag) { } @Override - public CompoundNBT writeToNbt(CompoundNBT tag) { + public void call(Network network, Level world, BlockPos currentPos, TransportCallback cancelCallback) { + // TODO: Actually bounce back... + Containers.dropItemStack(world, originalItemHandlerPosition.getX(), originalItemHandlerPosition.getY(), originalItemHandlerPosition.getZ(), toInsert); + } + + @Override + public ResourceLocation getId() { + return ID; + } + + @Override + public CompoundTag writeToNbt(CompoundTag tag) { tag.putLong("oihpos", originalItemHandlerPosition.asLong()); tag.putLong("bbihpos", bounceBackItemHandlerPosition.asLong()); - tag.put("s", toInsert.save(new CompoundNBT())); + tag.put("s", toInsert.save(new CompoundTag())); return tag; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemInsertTransportCallback.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemInsertTransportCallback.java index 6a44a0c..e304e77 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemInsertTransportCallback.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemInsertTransportCallback.java @@ -3,13 +3,13 @@ import com.refinedmods.refinedpipes.RefinedPipes; import com.refinedmods.refinedpipes.network.Network; import com.refinedmods.refinedpipes.util.DirectionUtil; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; @@ -19,10 +19,8 @@ import javax.annotation.Nullable; public class ItemInsertTransportCallback implements TransportCallback { - private static final Logger LOGGER = LogManager.getLogger(ItemInsertTransportCallback.class); - public static final ResourceLocation ID = new ResourceLocation(RefinedPipes.ID, "item_insert"); - + private static final Logger LOGGER = LogManager.getLogger(ItemInsertTransportCallback.class); private final BlockPos itemHandlerPosition; private final Direction incomingDirection; private final ItemStack toInsert; @@ -33,9 +31,23 @@ public ItemInsertTransportCallback(BlockPos itemHandlerPosition, Direction incom this.toInsert = toInsert; } + @Nullable + public static ItemInsertTransportCallback of(CompoundTag tag) { + BlockPos itemHandlerPosition = BlockPos.of(tag.getLong("ihpos")); + ItemStack toInsert = ItemStack.of(tag.getCompound("s")); + Direction incomingDirection = DirectionUtil.safeGet((byte) tag.getInt("incdir")); + + if (toInsert.isEmpty()) { + LOGGER.warn("Item no longer exists"); + return null; + } + + return new ItemInsertTransportCallback(itemHandlerPosition, incomingDirection, toInsert); + } + @Override - public void call(Network network, World world, BlockPos currentPos, TransportCallback cancelCallback) { - TileEntity tile = world.getBlockEntity(itemHandlerPosition); + public void call(Network network, Level world, BlockPos currentPos, TransportCallback cancelCallback) { + BlockEntity tile = world.getBlockEntity(itemHandlerPosition); if (tile == null) { LOGGER.warn("Destination item handler is gone at " + itemHandlerPosition); cancelCallback.call(network, world, currentPos, cancelCallback); @@ -61,24 +73,10 @@ public ResourceLocation getId() { return ID; } - @Nullable - public static ItemInsertTransportCallback of(CompoundNBT tag) { - BlockPos itemHandlerPosition = BlockPos.of(tag.getLong("ihpos")); - ItemStack toInsert = ItemStack.of(tag.getCompound("s")); - Direction incomingDirection = DirectionUtil.safeGet((byte) tag.getInt("incdir")); - - if (toInsert.isEmpty()) { - LOGGER.warn("Item no longer exists"); - return null; - } - - return new ItemInsertTransportCallback(itemHandlerPosition, incomingDirection, toInsert); - } - @Override - public CompoundNBT writeToNbt(CompoundNBT tag) { + public CompoundTag writeToNbt(CompoundTag tag) { tag.putLong("ihpos", itemHandlerPosition.asLong()); - tag.put("s", toInsert.save(new CompoundNBT())); + tag.put("s", toInsert.save(new CompoundTag())); tag.putInt("incdir", incomingDirection.ordinal()); return tag; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemPipeGoneTransportCallback.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemPipeGoneTransportCallback.java index 6da02c4..33c5ddf 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemPipeGoneTransportCallback.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemPipeGoneTransportCallback.java @@ -2,40 +2,28 @@ import com.refinedmods.refinedpipes.RefinedPipes; import com.refinedmods.refinedpipes.network.Network; -import net.minecraft.inventory.InventoryHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.Containers; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import javax.annotation.Nullable; public class ItemPipeGoneTransportCallback implements TransportCallback { - private static final Logger LOGGER = LogManager.getLogger(ItemPipeGoneTransportCallback.class); - public static final ResourceLocation ID = new ResourceLocation(RefinedPipes.ID, "item_pipe_gone"); - + private static final Logger LOGGER = LogManager.getLogger(ItemPipeGoneTransportCallback.class); private final ItemStack stack; public ItemPipeGoneTransportCallback(ItemStack stack) { this.stack = stack; } - @Override - public void call(Network network, World world, BlockPos currentPos, TransportCallback cancelCallback) { - InventoryHelper.dropItemStack(world, currentPos.getX(), currentPos.getY(), currentPos.getZ(), stack); - } - - @Override - public ResourceLocation getId() { - return ID; - } - @Nullable - public static ItemPipeGoneTransportCallback of(CompoundNBT tag) { + public static ItemPipeGoneTransportCallback of(CompoundTag tag) { ItemStack stack = ItemStack.of(tag.getCompound("s")); if (stack.isEmpty()) { @@ -47,8 +35,18 @@ public static ItemPipeGoneTransportCallback of(CompoundNBT tag) { } @Override - public CompoundNBT writeToNbt(CompoundNBT tag) { - tag.put("s", stack.save(new CompoundNBT())); + public void call(Network network, Level world, BlockPos currentPos, TransportCallback cancelCallback) { + Containers.dropItemStack(world, currentPos.getX(), currentPos.getY(), currentPos.getZ(), stack); + } + + @Override + public ResourceLocation getId() { + return ID; + } + + @Override + public CompoundTag writeToNbt(CompoundTag tag) { + tag.put("s", stack.save(new CompoundTag())); return tag; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/TransportCallback.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/TransportCallback.java index b8058d2..1b0dbad 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/TransportCallback.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/TransportCallback.java @@ -1,15 +1,15 @@ package com.refinedmods.refinedpipes.network.pipe.transport.callback; import com.refinedmods.refinedpipes.network.Network; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; public interface TransportCallback { - void call(Network network, World world, BlockPos currentPos, TransportCallback cancelCallback); + void call(Network network, Level world, BlockPos currentPos, TransportCallback cancelCallback); ResourceLocation getId(); - CompoundNBT writeToNbt(CompoundNBT tag); + CompoundTag writeToNbt(CompoundTag tag); } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/TransportCallbackFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/TransportCallbackFactory.java index 047b8e9..1544a45 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/TransportCallbackFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/TransportCallbackFactory.java @@ -1,10 +1,10 @@ package com.refinedmods.refinedpipes.network.pipe.transport.callback; -import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.CompoundTag; import javax.annotation.Nullable; public interface TransportCallbackFactory { @Nullable - TransportCallback create(CompoundNBT tag); + TransportCallback create(CompoundTag tag); } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/TransportCallbackFactoryRegistry.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/TransportCallbackFactoryRegistry.java index 361bc15..b70af3e 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/TransportCallbackFactoryRegistry.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/TransportCallbackFactoryRegistry.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedpipes.network.pipe.transport.callback; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; import javax.annotation.Nullable; import java.util.HashMap; diff --git a/src/main/java/com/refinedmods/refinedpipes/render/CubeBuilder.java b/src/main/java/com/refinedmods/refinedpipes/render/CubeBuilder.java index 180e12e..967fe41 100644 --- a/src/main/java/com/refinedmods/refinedpipes/render/CubeBuilder.java +++ b/src/main/java/com/refinedmods/refinedpipes/render/CubeBuilder.java @@ -1,9 +1,9 @@ package com.refinedmods.refinedpipes.render; -import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.Direction; +import net.minecraft.core.Direction; import javax.annotation.Nullable; @@ -15,11 +15,11 @@ public class CubeBuilder { private CubeBuilder() { } - public void putCube(MatrixStack matrixStack, IVertexBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2, int r, int g, int b, int a, int light, TextureAtlasSprite sprite) { + public void putCube(PoseStack matrixStack, VertexConsumer builder, float x1, float y1, float z1, float x2, float y2, float z2, int r, int g, int b, int a, int light, TextureAtlasSprite sprite) { putCube(matrixStack, builder, x1, y1, z1, x2, y2, z2, r, g, b, a, light, sprite, null); } - public void putCube(MatrixStack matrixStack, IVertexBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2, int r, int g, int b, int a, int light, TextureAtlasSprite sprite, @Nullable Direction exclude) { + public void putCube(PoseStack matrixStack, VertexConsumer builder, float x1, float y1, float z1, float x2, float y2, float z2, int r, int g, int b, int a, int light, TextureAtlasSprite sprite, @Nullable Direction exclude) { matrixStack.pushPose(); for (Direction face : Direction.values()) { @@ -31,7 +31,7 @@ public void putCube(MatrixStack matrixStack, IVertexBuilder builder, float x1, f matrixStack.popPose(); } - public void putFace(MatrixStack matrixStack, IVertexBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2, int r, int g, int b, int a, int light, TextureAtlasSprite sprite, Direction face) { + public void putFace(PoseStack matrixStack, VertexConsumer builder, float x1, float y1, float z1, float x2, float y2, float z2, int r, int g, int b, int a, int light, TextureAtlasSprite sprite, Direction face) { UvVector uv = getDefaultUv(face, sprite, x1, y1, z1, x2, y2, z2); switch (face) { @@ -121,7 +121,7 @@ private UvVector getDefaultUv(Direction face, TextureAtlasSprite texture, float } // uv.u1, uv.v1 - private void putVertexTL(IVertexBuilder builder, MatrixStack matrixStack, Direction face, int r, int g, int b, int a, int light, float x, float y, float z, UvVector uv) { + private void putVertexTL(VertexConsumer builder, PoseStack matrixStack, Direction face, int r, int g, int b, int a, int light, float x, float y, float z, UvVector uv) { float u, v; switch (this.uvRotations[face.ordinal()]) { @@ -148,7 +148,7 @@ private void putVertexTL(IVertexBuilder builder, MatrixStack matrixStack, Direct } // uv.u2, uv.v1 - private void putVertexTR(IVertexBuilder builder, MatrixStack matrixStack, Direction face, int r, int g, int b, int a, int light, float x, float y, float z, UvVector uv) { + private void putVertexTR(VertexConsumer builder, PoseStack matrixStack, Direction face, int r, int g, int b, int a, int light, float x, float y, float z, UvVector uv) { float u, v; switch (this.uvRotations[face.ordinal()]) { @@ -175,7 +175,7 @@ private void putVertexTR(IVertexBuilder builder, MatrixStack matrixStack, Direct } // uv.u2, uv.v2 - private void putVertexBR(IVertexBuilder builder, MatrixStack matrixStack, Direction face, int r, int g, int b, int a, int light, float x, float y, float z, UvVector uv) { + private void putVertexBR(VertexConsumer builder, PoseStack matrixStack, Direction face, int r, int g, int b, int a, int light, float x, float y, float z, UvVector uv) { float u; float v; @@ -204,7 +204,7 @@ private void putVertexBR(IVertexBuilder builder, MatrixStack matrixStack, Direct } // uv.u1, uv.v2 - private void putVertexBL(IVertexBuilder builder, MatrixStack matrixStack, Direction face, int r, int g, int b, int a, int light, float x, float y, float z, UvVector uv) { + private void putVertexBL(VertexConsumer builder, PoseStack matrixStack, Direction face, int r, int g, int b, int a, int light, float x, float y, float z, UvVector uv) { float u; float v; @@ -232,7 +232,7 @@ private void putVertexBL(IVertexBuilder builder, MatrixStack matrixStack, Direct this.putVertex(builder, matrixStack, r, g, b, a, light, x, y, z, u, v); } - private void putVertex(IVertexBuilder builder, MatrixStack matrixStack, int r, int g, int b, int a, int light, float x, float y, float z, float u, float v) { + private void putVertex(VertexConsumer builder, PoseStack matrixStack, int r, int g, int b, int a, int light, float x, float y, float z, float u, float v) { builder.vertex(matrixStack.last().pose(), x, y, z) .color(r, g, b, a) .uv(u, v) diff --git a/src/main/java/com/refinedmods/refinedpipes/render/FluidPipeTileEntityRenderer.java b/src/main/java/com/refinedmods/refinedpipes/render/FluidPipeTileEntityRenderer.java index c987c8d..c4e76b6 100644 --- a/src/main/java/com/refinedmods/refinedpipes/render/FluidPipeTileEntityRenderer.java +++ b/src/main/java/com/refinedmods/refinedpipes/render/FluidPipeTileEntityRenderer.java @@ -1,34 +1,29 @@ package com.refinedmods.refinedpipes.render; -import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; import com.refinedmods.refinedpipes.block.FluidPipeBlock; import com.refinedmods.refinedpipes.tile.FluidPipeTileEntity; -import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.inventory.container.PlayerContainer; -import net.minecraft.util.Direction; -import net.minecraft.world.World; +import net.minecraft.core.Direction; +import net.minecraft.world.inventory.InventoryMenu; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidStack; -public class FluidPipeTileEntityRenderer extends TileEntityRenderer { +public class FluidPipeTileEntityRenderer implements BlockEntityRenderer { private static final float INSET = 0.001F; - public FluidPipeTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { - super(dispatcher); - } - @Override @SuppressWarnings("deprecation") - public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer bufferType, int combinedLight, int combinedOverlay) { - World world = tile.getLevel(); + public void render(FluidPipeTileEntity tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferType, int combinedLight, int combinedOverlay) { + Level world = tile.getLevel(); if (world == null) { return; } @@ -44,9 +39,9 @@ public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack mat return; } - int light = WorldRenderer.getLightColor(tile.getLevel(), tile.getBlockPos()); + int light = LevelRenderer.getLightColor(tile.getLevel(), tile.getBlockPos()); FluidAttributes attributes = fluidStack.getFluid().getAttributes(); - TextureAtlasSprite sprite = Minecraft.getInstance().getTextureAtlas(PlayerContainer.BLOCK_ATLAS).apply(attributes.getStillTexture(fluidStack)); + TextureAtlasSprite sprite = Minecraft.getInstance().getTextureAtlas(InventoryMenu.BLOCK_ATLAS).apply(attributes.getStillTexture(fluidStack)); int fluidColor = attributes.getColor(fluidStack); int r = fluidColor >> 16 & 0xFF; @@ -54,7 +49,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, MatrixStack mat int b = fluidColor & 0xFF; int a = fluidColor >> 24 & 0xFF; - IVertexBuilder buffer = bufferType.getBuffer(RenderType.text(sprite.atlas().location())); + VertexConsumer buffer = bufferType.getBuffer(RenderType.text(sprite.atlas().location())); float fullness = tile.updateAndGetRenderFullness(partialTicks); if (fullness == 0) { diff --git a/src/main/java/com/refinedmods/refinedpipes/render/FluidRenderer.java b/src/main/java/com/refinedmods/refinedpipes/render/FluidRenderer.java index 1bd9472..791d902 100644 --- a/src/main/java/com/refinedmods/refinedpipes/render/FluidRenderer.java +++ b/src/main/java/com/refinedmods/refinedpipes/render/FluidRenderer.java @@ -1,14 +1,15 @@ package com.refinedmods.refinedpipes.render; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.fluid.Fluid; -import net.minecraft.inventory.container.PlayerContainer; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.inventory.InventoryMenu; +import net.minecraft.world.level.material.Fluid; import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidStack; @@ -35,15 +36,44 @@ public FluidRenderer(int capacityMb, int width, int height, int minHeight) { this.minHeight = minHeight; } - public void render(final int xPosition, final int yPosition, @Nonnull FluidStack fluidStack) { - RenderSystem.enableBlend(); - RenderSystem.enableAlphaTest(); + private static TextureAtlasSprite getStillFluidSprite(FluidStack fluidStack) { + Fluid fluid = fluidStack.getFluid(); + FluidAttributes attributes = fluid.getAttributes(); + ResourceLocation fluidStill = attributes.getStillTexture(fluidStack); + return Minecraft.getInstance().getTextureAtlas(InventoryMenu.BLOCK_ATLAS).apply(fluidStill); + } - drawFluid(xPosition, yPosition, fluidStack); + private static void setGLColorFromInt(int color) { + float red = (color >> 16 & 0xFF) / 255.0F; + float green = (color >> 8 & 0xFF) / 255.0F; + float blue = (color & 0xFF) / 255.0F; + float alpha = ((color >> 24) & 0xFF) / 255F; + + RenderSystem.setShaderColor(red, green, blue, alpha); + } + + private static void drawTextureWithMasking(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) { + double uMin = textureSprite.getU0(); + double uMax = textureSprite.getU1(); + double vMin = textureSprite.getV0(); + double vMax = textureSprite.getV1(); + uMax = uMax - (maskRight / 16.0 * (uMax - uMin)); + vMax = vMax - (maskTop / 16.0 * (vMax - vMin)); - RenderSystem.color4f(1, 1, 1, 1); + Tesselator tessellator = Tesselator.getInstance(); + BufferBuilder bufferBuilder = tessellator.getBuilder(); + bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + bufferBuilder.vertex(xCoord, yCoord + 16, zLevel).uv((float) uMin, (float) vMax).endVertex(); + bufferBuilder.vertex(xCoord + 16 - maskRight, yCoord + 16, zLevel).uv((float) uMax, (float) vMax).endVertex(); + bufferBuilder.vertex(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).uv((float) uMax, (float) vMin).endVertex(); + bufferBuilder.vertex(xCoord, yCoord + maskTop, zLevel).uv((float) uMin, (float) vMin).endVertex(); + tessellator.end(); + } - RenderSystem.disableAlphaTest(); + public void render(final int xPosition, final int yPosition, @Nonnull FluidStack fluidStack) { + RenderSystem.enableBlend(); + drawFluid(xPosition, yPosition, fluidStack); + RenderSystem.setShaderColor(1, 1, 1, 1); RenderSystem.disableBlend(); } @@ -72,8 +102,8 @@ private void drawFluid(final int xPosition, final int yPosition, @Nonnull FluidS } private void drawTiledSprite(final int xPosition, final int yPosition, final int tiledWidth, final int tiledHeight, int color, int scaledAmount, TextureAtlasSprite sprite) { - Minecraft minecraft = Minecraft.getInstance(); - minecraft.getTextureManager().bind(PlayerContainer.BLOCK_ATLAS); + RenderSystem.setShaderTexture(0, InventoryMenu.BLOCK_ATLAS); + setGLColorFromInt(color); final int xTileCount = tiledWidth / TEX_WIDTH; @@ -98,38 +128,4 @@ private void drawTiledSprite(final int xPosition, final int yPosition, final int } } } - - private static TextureAtlasSprite getStillFluidSprite(FluidStack fluidStack) { - Fluid fluid = fluidStack.getFluid(); - FluidAttributes attributes = fluid.getAttributes(); - ResourceLocation fluidStill = attributes.getStillTexture(fluidStack); - return Minecraft.getInstance().getTextureAtlas(PlayerContainer.BLOCK_ATLAS).apply(fluidStill); - } - - private static void setGLColorFromInt(int color) { - float red = (color >> 16 & 0xFF) / 255.0F; - float green = (color >> 8 & 0xFF) / 255.0F; - float blue = (color & 0xFF) / 255.0F; - float alpha = ((color >> 24) & 0xFF) / 255F; - - RenderSystem.color4f(red, green, blue, alpha); - } - - private static void drawTextureWithMasking(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) { - double uMin = textureSprite.getU0(); - double uMax = textureSprite.getU1(); - double vMin = textureSprite.getV0(); - double vMax = textureSprite.getV1(); - uMax = uMax - (maskRight / 16.0 * (uMax - uMin)); - vMax = vMax - (maskTop / 16.0 * (vMax - vMin)); - - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferBuilder = tessellator.getBuilder(); - bufferBuilder.begin(7, DefaultVertexFormats.POSITION_TEX); - bufferBuilder.vertex(xCoord, yCoord + 16, zLevel).uv((float) uMin, (float) vMax).endVertex(); - bufferBuilder.vertex(xCoord + 16 - maskRight, yCoord + 16, zLevel).uv((float) uMax, (float) vMax).endVertex(); - bufferBuilder.vertex(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).uv((float) uMax, (float) vMin).endVertex(); - bufferBuilder.vertex(xCoord, yCoord + maskTop, zLevel).uv((float) uMin, (float) vMin).endVertex(); - tessellator.end(); - } } diff --git a/src/main/java/com/refinedmods/refinedpipes/render/ItemPipeTileEntityRenderer.java b/src/main/java/com/refinedmods/refinedpipes/render/ItemPipeTileEntityRenderer.java index d2076de..bd45d07 100644 --- a/src/main/java/com/refinedmods/refinedpipes/render/ItemPipeTileEntityRenderer.java +++ b/src/main/java/com/refinedmods/refinedpipes/render/ItemPipeTileEntityRenderer.java @@ -1,24 +1,19 @@ package com.refinedmods.refinedpipes.render; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Quaternion; import com.refinedmods.refinedpipes.network.pipe.transport.ItemTransportProps; import com.refinedmods.refinedpipes.tile.ItemPipeTileEntity; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.model.ItemCameraTransforms; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.util.Direction; -import net.minecraft.util.math.vector.Quaternion; - -public class ItemPipeTileEntityRenderer extends TileEntityRenderer { - public ItemPipeTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { - super(dispatcher); - } +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.block.model.ItemTransforms; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.core.Direction; +public class ItemPipeTileEntityRenderer implements BlockEntityRenderer { @Override @SuppressWarnings("deprecation") - public void render(ItemPipeTileEntity tile, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer bufferType, int combinedLight, int combinedOverlay) { + public void render(ItemPipeTileEntity tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferType, int combinedLight, int combinedOverlay) { for (ItemTransportProps prop : tile.getProps()) { Direction dir = prop.getDirection(); @@ -71,11 +66,12 @@ public void render(ItemPipeTileEntity tile, float partialTicks, MatrixStack matr Minecraft.getInstance().getItemRenderer().renderStatic( prop.getStack(), - ItemCameraTransforms.TransformType.FIXED, + ItemTransforms.TransformType.FIXED, combinedLight, combinedOverlay, matrixStack, - bufferType + bufferType, + 0 ); matrixStack.popPose(); diff --git a/src/main/java/com/refinedmods/refinedpipes/render/PipeBakedModel.java b/src/main/java/com/refinedmods/refinedpipes/render/PipeBakedModel.java index 60d39b0..b3089d5 100644 --- a/src/main/java/com/refinedmods/refinedpipes/render/PipeBakedModel.java +++ b/src/main/java/com/refinedmods/refinedpipes/render/PipeBakedModel.java @@ -1,18 +1,18 @@ package com.refinedmods.refinedpipes.render; import com.google.common.collect.ImmutableList; +import com.mojang.math.Quaternion; +import com.mojang.math.Transformation; +import com.mojang.math.Vector3f; import com.refinedmods.refinedpipes.block.PipeBlock; import com.refinedmods.refinedpipes.tile.PipeTileEntity; -import net.minecraft.block.BlockState; -import net.minecraft.client.renderer.model.BakedQuad; -import net.minecraft.client.renderer.model.IBakedModel; -import net.minecraft.client.renderer.model.ItemOverrideList; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.ItemOverrides; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.vector.Quaternion; -import net.minecraft.util.math.vector.TransformationMatrix; -import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.client.model.data.EmptyModelData; import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.pipeline.BakedQuadBuilder; @@ -24,16 +24,16 @@ import java.util.*; import java.util.concurrent.ConcurrentHashMap; -public class PipeBakedModel implements IBakedModel { - private static final Map SIDE_TRANSFORMS = new EnumMap<>(Direction.class); - private final IBakedModel core; - private final IBakedModel extension; - private final IBakedModel straight; - private final IBakedModel inventoryAttachment; - private final Map attachmentModels; +public class PipeBakedModel implements BakedModel { + private static final Map SIDE_TRANSFORMS = new EnumMap<>(Direction.class); + private final BakedModel core; + private final BakedModel extension; + private final BakedModel straight; + private final BakedModel inventoryAttachment; + private final Map attachmentModels; private final Map> cache = new ConcurrentHashMap<>(); - public PipeBakedModel(IBakedModel core, IBakedModel extension, IBakedModel straight, IBakedModel inventoryAttachment, Map attachmentModels) { + public PipeBakedModel(BakedModel core, BakedModel extension, BakedModel straight, BakedModel inventoryAttachment, Map attachmentModels) { this.core = core; this.extension = extension; this.straight = straight; @@ -41,6 +41,42 @@ public PipeBakedModel(IBakedModel core, IBakedModel extension, IBakedModel strai this.attachmentModels = attachmentModels; } + private static List getTransformedQuads(BakedModel model, Direction facing, PipeState state) { + Transformation transformation = SIDE_TRANSFORMS.computeIfAbsent(facing, face -> { + Quaternion quaternion; + if (face == Direction.UP) { + quaternion = TransformationHelper.quatFromXYZ(new Vector3f(90, 0, 0), true); + } else if (face == Direction.DOWN) { + quaternion = TransformationHelper.quatFromXYZ(new Vector3f(270, 0, 0), true); + } else { + double r = Math.PI * (360 - face.getOpposite().get2DDataValue() * 90) / 180d; + + quaternion = TransformationHelper.quatFromXYZ(new Vector3f(0, (float) r, 0), false); + } + + return new Transformation(null, quaternion, null, null).blockCenterToCorner(); + }); + + ImmutableList.Builder quads = ImmutableList.builder(); + Direction side = state.getSide(); + + if (side != null && side.get2DDataValue() > -1) { + int faceOffset = 4 + Direction.NORTH.get2DDataValue() - facing.get2DDataValue(); + side = Direction.from2DDataValue((side.get2DDataValue() + faceOffset) % 4); + } + + for (BakedQuad quad : model.getQuads(state.getState(), side, state.getRand(), EmptyModelData.INSTANCE)) { + BakedQuadBuilder builder = new BakedQuadBuilder(quad.getSprite()); + TRSRTransformer transformer = new TRSRTransformer(builder, transformation); + + quad.pipe(transformer); + + quads.add(builder.build()); + } + + return quads.build(); + } + @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) { return getQuads(state, side, rand, EmptyModelData.INSTANCE); @@ -148,42 +184,6 @@ private List createQuads(PipeState state) { return quads; } - private static List getTransformedQuads(IBakedModel model, Direction facing, PipeState state) { - TransformationMatrix transformation = SIDE_TRANSFORMS.computeIfAbsent(facing, face -> { - Quaternion quaternion; - if (face == Direction.UP) { - quaternion = TransformationHelper.quatFromXYZ(new Vector3f(90, 0, 0), true); - } else if (face == Direction.DOWN) { - quaternion = TransformationHelper.quatFromXYZ(new Vector3f(270, 0, 0), true); - } else { - double r = Math.PI * (360 - face.getOpposite().get2DDataValue() * 90) / 180d; - - quaternion = TransformationHelper.quatFromXYZ(new Vector3f(0, (float) r, 0), false); - } - - return new TransformationMatrix(null, quaternion, null, null).blockCenterToCorner(); - }); - - ImmutableList.Builder quads = ImmutableList.builder(); - Direction side = state.getSide(); - - if (side != null && side.get2DDataValue() > -1) { - int faceOffset = 4 + Direction.NORTH.get2DDataValue() - facing.get2DDataValue(); - side = Direction.from2DDataValue((side.get2DDataValue() + faceOffset) % 4); - } - - for (BakedQuad quad : model.getQuads(state.getState(), side, state.getRand(), EmptyModelData.INSTANCE)) { - BakedQuadBuilder builder = new BakedQuadBuilder(quad.getSprite()); - TRSRTransformer transformer = new TRSRTransformer(builder, transformation); - - quad.pipe(transformer); - - quads.add(builder.build()); - } - - return quads.build(); - } - @Override public boolean useAmbientOcclusion() { return core.useAmbientOcclusion(); @@ -211,7 +211,7 @@ public TextureAtlasSprite getParticleIcon() { } @Override - public ItemOverrideList getOverrides() { + public ItemOverrides getOverrides() { return core.getOverrides(); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/render/PipeState.java b/src/main/java/com/refinedmods/refinedpipes/render/PipeState.java index ebd6754..8760e5d 100644 --- a/src/main/java/com/refinedmods/refinedpipes/render/PipeState.java +++ b/src/main/java/com/refinedmods/refinedpipes/render/PipeState.java @@ -1,8 +1,8 @@ package com.refinedmods.refinedpipes.render; -import net.minecraft.block.BlockState; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.state.BlockState; import javax.annotation.Nullable; import java.util.Arrays; diff --git a/src/main/java/com/refinedmods/refinedpipes/screen/BaseScreen.java b/src/main/java/com/refinedmods/refinedpipes/screen/BaseScreen.java index 68600fa..0a62774 100644 --- a/src/main/java/com/refinedmods/refinedpipes/screen/BaseScreen.java +++ b/src/main/java/com/refinedmods/refinedpipes/screen/BaseScreen.java @@ -1,33 +1,23 @@ package com.refinedmods.refinedpipes.screen; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import com.refinedmods.refinedpipes.container.BaseContainer; import com.refinedmods.refinedpipes.container.slot.FluidFilterSlot; import com.refinedmods.refinedpipes.render.FluidRenderer; -import net.minecraft.client.gui.screen.inventory.ContainerScreen; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.ITextProperties; -import net.minecraft.util.text.StringTextComponent; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.client.gui.GuiUtils; -import java.util.ArrayList; -import java.util.List; - -public abstract class BaseScreen extends ContainerScreen { - private final List fluidTooltip = new ArrayList<>(1); - - public BaseScreen(T screenContainer, PlayerInventory inv, ITextComponent title) { +public abstract class BaseScreen extends AbstractContainerScreen { + public BaseScreen(T screenContainer, Inventory inv, Component title) { super(screenContainer, inv, title); - - fluidTooltip.add(StringTextComponent.EMPTY); } @Override - protected void renderBg(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + protected void renderBg(PoseStack matrixStack, float partialTicks, int mouseX, int mouseY) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); for (FluidFilterSlot slot : menu.getFluidSlots()) { FluidStack stack = slot.getFluidInventory().getFluid(slot.getSlotIndex()); @@ -40,7 +30,7 @@ protected void renderBg(MatrixStack matrixStack, float partialTicks, int mouseX, } @Override - protected void renderLabels(MatrixStack matrixStack, int mouseX, int mouseY) { + protected void renderLabels(PoseStack matrixStack, int mouseX, int mouseY) { for (FluidFilterSlot slot : menu.getFluidSlots()) { FluidStack stack = slot.getFluidInventory().getFluid(slot.getSlotIndex()); if (stack.isEmpty()) { @@ -51,9 +41,7 @@ protected void renderLabels(MatrixStack matrixStack, int mouseX, int mouseY) { continue; } - fluidTooltip.set(0, stack.getDisplayName()); - - GuiUtils.drawHoveringText(matrixStack, fluidTooltip, mouseX - leftPos, mouseY - topPos, width, height, -1, font); + renderTooltip(matrixStack, stack.getDisplayName(), mouseX - leftPos, mouseY - topPos); } } } diff --git a/src/main/java/com/refinedmods/refinedpipes/screen/ExtractorAttachmentScreen.java b/src/main/java/com/refinedmods/refinedpipes/screen/ExtractorAttachmentScreen.java index dd2596c..dbdac99 100644 --- a/src/main/java/com/refinedmods/refinedpipes/screen/ExtractorAttachmentScreen.java +++ b/src/main/java/com/refinedmods/refinedpipes/screen/ExtractorAttachmentScreen.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedpipes.screen; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import com.refinedmods.refinedpipes.RefinedPipes; import com.refinedmods.refinedpipes.container.ExtractorAttachmentContainer; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.BlacklistWhitelist; @@ -10,13 +10,15 @@ import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.RoutingMode; import com.refinedmods.refinedpipes.screen.widget.IconButton; import com.refinedmods.refinedpipes.screen.widget.IconButtonPreset; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.*; -import net.minecraftforge.fml.client.gui.GuiUtils; +import net.minecraft.ChatFormatting; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import javax.annotation.Nullable; import java.util.ArrayList; @@ -25,7 +27,7 @@ public class ExtractorAttachmentScreen extends BaseScreen { private static final ResourceLocation RESOURCE = new ResourceLocation(RefinedPipes.ID, "textures/gui/extractor_attachment.png"); - private final List tooltip = new ArrayList<>(); + private final List tooltip = new ArrayList<>(); private Button redstoneModeButton; private Button blacklistWhitelistButton; @@ -38,7 +40,7 @@ public class ExtractorAttachmentScreen extends BaseScreen updateStackSize(1) )); - minusButton = addButton(new IconButton( + minusButton = this.addRenderableWidget(new IconButton( this.leftPos + 125, this.topPos + 76 + 14 - 3, IconButtonPreset.SMALL, 198, 34, - new StringTextComponent("-"), + new TextComponent("-"), btn -> updateStackSize(-1) )); @@ -156,8 +158,8 @@ private int getRedstoneModeX(RedstoneMode redstoneMode) { } } - private IFormattableTextComponent getRedstoneModeText(RedstoneMode redstoneMode) { - return new TranslationTextComponent("misc.refinedpipes.redstone_mode." + redstoneMode.toString().toLowerCase()); + private MutableComponent getRedstoneModeText(RedstoneMode redstoneMode) { + return new TranslatableComponent("misc.refinedpipes.redstone_mode." + redstoneMode.toString().toLowerCase()); } private void setRedstoneMode(IconButton button, RedstoneMode redstoneMode) { @@ -178,8 +180,8 @@ private int getBlacklistWhitelistX(BlacklistWhitelist blacklistWhitelist) { } } - private IFormattableTextComponent getBlacklistWhitelistText(BlacklistWhitelist blacklistWhitelist) { - return new TranslationTextComponent("misc.refinedpipes.mode." + blacklistWhitelist.toString().toLowerCase()); + private MutableComponent getBlacklistWhitelistText(BlacklistWhitelist blacklistWhitelist) { + return new TranslatableComponent("misc.refinedpipes.mode." + blacklistWhitelist.toString().toLowerCase()); } private void setBlacklistWhitelist(IconButton button, BlacklistWhitelist blacklistWhitelist) { @@ -204,8 +206,8 @@ private int getRoutingModeX(RoutingMode routingMode) { } } - private IFormattableTextComponent getRoutingModeText(RoutingMode routingMode) { - return new TranslationTextComponent("misc.refinedpipes.routing_mode." + routingMode.toString().toLowerCase()); + private MutableComponent getRoutingModeText(RoutingMode routingMode) { + return new TranslatableComponent("misc.refinedpipes.routing_mode." + routingMode.toString().toLowerCase()); } private void setRoutingMode(IconButton button, RoutingMode routingMode) { @@ -219,8 +221,8 @@ private int getExactModeX(boolean exactMode) { return exactMode ? 177 : 198; } - private IFormattableTextComponent getExactModeText(boolean exactMode) { - return new TranslationTextComponent("misc.refinedpipes.exact_mode." + (exactMode ? "on" : "off")); + private MutableComponent getExactModeText(boolean exactMode) { + return new TranslatableComponent("misc.refinedpipes.exact_mode." + (exactMode ? "on" : "off")); } private void setExactMode(IconButton button, boolean exactMode) { @@ -231,7 +233,7 @@ private void setExactMode(IconButton button, boolean exactMode) { } @Override - protected void renderLabels(MatrixStack matrixStack, int mouseX, int mouseY) { + protected void renderLabels(PoseStack matrixStack, int mouseX, int mouseY) { font.draw(matrixStack, title.getString(), 7, 7, 4210752); font.draw(matrixStack, I18n.get("container.inventory"), 7, 103 - 4, 4210752); @@ -243,33 +245,34 @@ protected void renderLabels(MatrixStack matrixStack, int mouseX, int mouseY) { tooltip.clear(); - if (blacklistWhitelistButton.isHovered()) { - tooltip.add(new TranslationTextComponent("misc.refinedpipes.mode")); - tooltip.add(getBlacklistWhitelistText(menu.getBlacklistWhitelist()).withStyle(TextFormatting.GRAY)); - } else if (redstoneModeButton.isHovered()) { - tooltip.add(new TranslationTextComponent("misc.refinedpipes.redstone_mode")); - tooltip.add(getRedstoneModeText(menu.getRedstoneMode()).withStyle(TextFormatting.GRAY)); - } else if (routingModeButton != null && routingModeButton.isHovered()) { - tooltip.add(new TranslationTextComponent("misc.refinedpipes.routing_mode")); - tooltip.add(getRoutingModeText(menu.getRoutingMode()).withStyle(TextFormatting.GRAY)); - } else if (exactModeButton.isHovered()) { - tooltip.add(new TranslationTextComponent("misc.refinedpipes.exact_mode")); - tooltip.add(getExactModeText(menu.isExactMode()).withStyle(TextFormatting.GRAY)); + if (blacklistWhitelistButton.isHoveredOrFocused()) { + tooltip.add(new TranslatableComponent("misc.refinedpipes.mode")); + tooltip.add(getBlacklistWhitelistText(menu.getBlacklistWhitelist()).withStyle(ChatFormatting.GRAY)); + } else if (redstoneModeButton.isHoveredOrFocused()) { + tooltip.add(new TranslatableComponent("misc.refinedpipes.redstone_mode")); + tooltip.add(getRedstoneModeText(menu.getRedstoneMode()).withStyle(ChatFormatting.GRAY)); + } else if (routingModeButton != null && routingModeButton.isHoveredOrFocused()) { + tooltip.add(new TranslatableComponent("misc.refinedpipes.routing_mode")); + tooltip.add(getRoutingModeText(menu.getRoutingMode()).withStyle(ChatFormatting.GRAY)); + } else if (exactModeButton.isHoveredOrFocused()) { + tooltip.add(new TranslatableComponent("misc.refinedpipes.exact_mode")); + tooltip.add(getExactModeText(menu.isExactMode()).withStyle(ChatFormatting.GRAY)); } if (!tooltip.isEmpty()) { - GuiUtils.drawHoveringText(matrixStack, tooltip, mouseX - leftPos, mouseY - topPos, width, height, -1, Minecraft.getInstance().font); + renderComponentTooltip(matrixStack, tooltip, mouseX - leftPos, mouseY - topPos); } super.renderLabels(matrixStack, mouseX, mouseY); } @Override - protected void renderBg(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(PoseStack matrixStack, float partialTicks, int mouseX, int mouseY) { renderBackground(matrixStack); - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.minecraft.getTextureManager().bind(RESOURCE); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderTexture(0, RESOURCE); + int i = (this.width - this.imageWidth) / 2; int j = (this.height - this.imageHeight) / 2; this.blit(matrixStack, i, j, 0, 0, this.imageWidth, this.imageHeight); diff --git a/src/main/java/com/refinedmods/refinedpipes/screen/widget/IconButton.java b/src/main/java/com/refinedmods/refinedpipes/screen/widget/IconButton.java index 7a94fe6..eee5384 100644 --- a/src/main/java/com/refinedmods/refinedpipes/screen/widget/IconButton.java +++ b/src/main/java/com/refinedmods/refinedpipes/screen/widget/IconButton.java @@ -1,14 +1,11 @@ package com.refinedmods.refinedpipes.screen.widget; -import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import com.refinedmods.refinedpipes.RefinedPipes; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; - -import net.minecraft.client.gui.widget.button.Button.IPressable; +import net.minecraft.client.gui.components.Button; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; public class IconButton extends Button { private static final ResourceLocation RESOURCE = new ResourceLocation(RefinedPipes.ID, "textures/gui/extractor_attachment.png"); @@ -17,7 +14,7 @@ public class IconButton extends Button { private int overlayTexX; private int overlayTexY; - public IconButton(int x, int y, IconButtonPreset preset, int overlayTexX, int overlayTexY, ITextComponent text, IPressable onPress) { + public IconButton(int x, int y, IconButtonPreset preset, int overlayTexX, int overlayTexY, Component text, OnPress onPress) { super(x, y, preset.getWidth(), preset.getHeight(), text, onPress); this.preset = preset; @@ -30,9 +27,8 @@ public void setOverlayTexX(int overlayTexX) { } @Override - public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { - Minecraft minecraft = Minecraft.getInstance(); - minecraft.getTextureManager().bind(RESOURCE); + public void renderButton(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) { + RenderSystem.setShaderTexture(0, RESOURCE); RenderSystem.disableDepthTest(); diff --git a/src/main/java/com/refinedmods/refinedpipes/setup/ClientSetup.java b/src/main/java/com/refinedmods/refinedpipes/setup/ClientSetup.java index eb11d00..fd9d3a3 100644 --- a/src/main/java/com/refinedmods/refinedpipes/setup/ClientSetup.java +++ b/src/main/java/com/refinedmods/refinedpipes/setup/ClientSetup.java @@ -13,18 +13,17 @@ import com.refinedmods.refinedpipes.render.ItemPipeTileEntityRenderer; import com.refinedmods.refinedpipes.render.PipeBakedModel; import com.refinedmods.refinedpipes.screen.ExtractorAttachmentScreen; -import net.minecraft.client.gui.ScreenManager; +import net.minecraft.client.gui.screens.MenuScreens; +import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.RenderTypeLookup; -import net.minecraft.client.renderer.model.IBakedModel; -import net.minecraft.client.renderer.model.ModelResourceLocation; -import net.minecraft.util.ResourceLocation; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.client.event.ModelBakeEvent; -import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.client.model.ForgeModelBakery; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -32,74 +31,72 @@ import java.util.Map; import java.util.Map.Entry; -public class ClientSetup { +public final class ClientSetup { private static final Logger LOGGER = LogManager.getLogger(ClientSetup.class); - public ClientSetup() { + private ClientSetup() { + } + + @SubscribeEvent + public static void onClientSetup(FMLClientSetupEvent e) { for (AttachmentFactory factory : AttachmentRegistry.INSTANCE.all()) { LOGGER.debug("Registering attachment model {}", factory.getModelLocation()); - ModelLoader.addSpecialModel(factory.getModelLocation()); + ForgeModelBakery.addSpecialModel(factory.getModelLocation()); } - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onClientSetup); - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onModelBake); - for (String type : new String[]{"item", "fluid", "energy"}) { - ModelLoader.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/basic/core")); - ModelLoader.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/basic/extension")); - ModelLoader.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/basic/straight")); + ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/basic/core")); + ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/basic/extension")); + ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/basic/straight")); - ModelLoader.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/improved/core")); - ModelLoader.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/improved/extension")); - ModelLoader.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/improved/straight")); + ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/improved/core")); + ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/improved/extension")); + ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/improved/straight")); - ModelLoader.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/advanced/core")); - ModelLoader.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/advanced/extension")); - ModelLoader.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/advanced/straight")); + ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/advanced/core")); + ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/advanced/extension")); + ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/advanced/straight")); if (type.equals("fluid") || type.equals("energy")) { - ModelLoader.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/elite/core")); - ModelLoader.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/elite/extension")); - ModelLoader.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/elite/straight")); + ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/elite/core")); + ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/elite/extension")); + ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/elite/straight")); - ModelLoader.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/ultimate/core")); - ModelLoader.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/ultimate/extension")); - ModelLoader.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/ultimate/straight")); + ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/ultimate/core")); + ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/ultimate/extension")); + ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/" + type + "/ultimate/straight")); } } - ModelLoader.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/attachment/inventory_attachment")); - } + ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/attachment/inventory_attachment")); - @SubscribeEvent - public void onClientSetup(FMLClientSetupEvent e) { - ScreenManager.register(RefinedPipesContainers.EXTRACTOR_ATTACHMENT, ExtractorAttachmentScreen::new); - - RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.BASIC_ITEM_PIPE, RenderType.cutout()); - RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.IMPROVED_ITEM_PIPE, RenderType.cutout()); - RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.ADVANCED_ITEM_PIPE, RenderType.cutout()); - - RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.BASIC_FLUID_PIPE, RenderType.cutout()); - RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.IMPROVED_FLUID_PIPE, RenderType.cutout()); - RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.ADVANCED_FLUID_PIPE, RenderType.cutout()); - RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.ELITE_FLUID_PIPE, RenderType.cutout()); - RenderTypeLookup.setRenderLayer(RefinedPipesBlocks.ULTIMATE_FLUID_PIPE, RenderType.cutout()); - - ClientRegistry.bindTileEntityRenderer(RefinedPipesTileEntities.BASIC_ITEM_PIPE, ItemPipeTileEntityRenderer::new); - ClientRegistry.bindTileEntityRenderer(RefinedPipesTileEntities.IMPROVED_ITEM_PIPE, ItemPipeTileEntityRenderer::new); - ClientRegistry.bindTileEntityRenderer(RefinedPipesTileEntities.ADVANCED_ITEM_PIPE, ItemPipeTileEntityRenderer::new); - - ClientRegistry.bindTileEntityRenderer(RefinedPipesTileEntities.BASIC_FLUID_PIPE, FluidPipeTileEntityRenderer::new); - ClientRegistry.bindTileEntityRenderer(RefinedPipesTileEntities.IMPROVED_FLUID_PIPE, FluidPipeTileEntityRenderer::new); - ClientRegistry.bindTileEntityRenderer(RefinedPipesTileEntities.ADVANCED_FLUID_PIPE, FluidPipeTileEntityRenderer::new); - ClientRegistry.bindTileEntityRenderer(RefinedPipesTileEntities.ELITE_FLUID_PIPE, FluidPipeTileEntityRenderer::new); - ClientRegistry.bindTileEntityRenderer(RefinedPipesTileEntities.ULTIMATE_FLUID_PIPE, FluidPipeTileEntityRenderer::new); + MenuScreens.register(RefinedPipesContainers.EXTRACTOR_ATTACHMENT, ExtractorAttachmentScreen::new); + + ItemBlockRenderTypes.setRenderLayer(RefinedPipesBlocks.BASIC_ITEM_PIPE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(RefinedPipesBlocks.IMPROVED_ITEM_PIPE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(RefinedPipesBlocks.ADVANCED_ITEM_PIPE, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(RefinedPipesBlocks.BASIC_FLUID_PIPE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(RefinedPipesBlocks.IMPROVED_FLUID_PIPE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(RefinedPipesBlocks.ADVANCED_FLUID_PIPE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(RefinedPipesBlocks.ELITE_FLUID_PIPE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(RefinedPipesBlocks.ULTIMATE_FLUID_PIPE, RenderType.cutout()); + + BlockEntityRenderers.register(RefinedPipesTileEntities.BASIC_ITEM_PIPE, ctx -> new ItemPipeTileEntityRenderer()); + BlockEntityRenderers.register(RefinedPipesTileEntities.IMPROVED_ITEM_PIPE, ctx -> new ItemPipeTileEntityRenderer()); + BlockEntityRenderers.register(RefinedPipesTileEntities.ADVANCED_ITEM_PIPE, ctx -> new ItemPipeTileEntityRenderer()); + + BlockEntityRenderers.register(RefinedPipesTileEntities.BASIC_FLUID_PIPE, ctx -> new FluidPipeTileEntityRenderer()); + BlockEntityRenderers.register(RefinedPipesTileEntities.IMPROVED_FLUID_PIPE, ctx -> new FluidPipeTileEntityRenderer()); + BlockEntityRenderers.register(RefinedPipesTileEntities.ADVANCED_FLUID_PIPE, ctx -> new FluidPipeTileEntityRenderer()); + BlockEntityRenderers.register(RefinedPipesTileEntities.ELITE_FLUID_PIPE, ctx -> new FluidPipeTileEntityRenderer()); + BlockEntityRenderers.register(RefinedPipesTileEntities.ULTIMATE_FLUID_PIPE, ctx -> new FluidPipeTileEntityRenderer()); } @SubscribeEvent - public void onModelBake(ModelBakeEvent e) { - Map attachmentModels = new HashMap<>(); + public static void onModelBake(ModelBakeEvent e) { + Map attachmentModels = new HashMap<>(); for (AttachmentFactory factory : AttachmentRegistry.INSTANCE.all()) { attachmentModels.put(factory.getId(), e.getModelRegistry().get(factory.getModelLocation())); @@ -209,7 +206,7 @@ public void onModelBake(ModelBakeEvent e) { } } - private boolean isPipeModel(ResourceLocation modelId, ResourceLocation pipeId) { + private static boolean isPipeModel(ResourceLocation modelId, ResourceLocation pipeId) { return modelId instanceof ModelResourceLocation && modelId.getNamespace().equals(RefinedPipes.ID) && modelId.getPath().equals(pipeId.getPath()) diff --git a/src/main/java/com/refinedmods/refinedpipes/setup/CommonSetup.java b/src/main/java/com/refinedmods/refinedpipes/setup/CommonSetup.java index 98c68a0..afdd1d6 100644 --- a/src/main/java/com/refinedmods/refinedpipes/setup/CommonSetup.java +++ b/src/main/java/com/refinedmods/refinedpipes/setup/CommonSetup.java @@ -39,19 +39,25 @@ import com.refinedmods.refinedpipes.tile.EnergyPipeTileEntity; import com.refinedmods.refinedpipes.tile.FluidPipeTileEntity; import com.refinedmods.refinedpipes.tile.ItemPipeTileEntity; -import net.minecraft.block.Block; -import net.minecraft.inventory.container.ContainerType; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntityType; -import net.minecraftforge.common.extensions.IForgeContainerType; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraftforge.common.extensions.IForgeMenuType; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent; -public class CommonSetup { - private final PipeShapeCache pipeShapeCache = new PipeShapeCache(new PipeShapeFactory()); +public final class CommonSetup { + private static final PipeShapeCache PIPE_SHAPE_CACHE = new PipeShapeCache(new PipeShapeFactory()); - public CommonSetup() { + private CommonSetup() { + } + + @SubscribeEvent + public static void onConstructMod(FMLConstructModEvent e) { NetworkRegistry.INSTANCE.addFactory(ItemNetwork.TYPE, new ItemNetworkFactory()); for (FluidPipeType pipeType : FluidPipeType.values()) { @@ -75,31 +81,34 @@ public CommonSetup() { TransportCallbackFactoryRegistry.INSTANCE.addFactory(ItemInsertTransportCallback.ID, ItemInsertTransportCallback::of); TransportCallbackFactoryRegistry.INSTANCE.addFactory(ItemBounceBackTransportCallback.ID, ItemBounceBackTransportCallback::of); TransportCallbackFactoryRegistry.INSTANCE.addFactory(ItemPipeGoneTransportCallback.ID, ItemPipeGoneTransportCallback::of); + } + @SubscribeEvent + public static void onCommonSetup(FMLCommonSetupEvent e) { RefinedPipes.NETWORK.register(); } @SubscribeEvent - public void onRegisterBlocks(RegistryEvent.Register e) { - e.getRegistry().register(new ItemPipeBlock(pipeShapeCache, ItemPipeType.BASIC)); - e.getRegistry().register(new ItemPipeBlock(pipeShapeCache, ItemPipeType.IMPROVED)); - e.getRegistry().register(new ItemPipeBlock(pipeShapeCache, ItemPipeType.ADVANCED)); - - e.getRegistry().register(new FluidPipeBlock(pipeShapeCache, FluidPipeType.BASIC)); - e.getRegistry().register(new FluidPipeBlock(pipeShapeCache, FluidPipeType.IMPROVED)); - e.getRegistry().register(new FluidPipeBlock(pipeShapeCache, FluidPipeType.ADVANCED)); - e.getRegistry().register(new FluidPipeBlock(pipeShapeCache, FluidPipeType.ELITE)); - e.getRegistry().register(new FluidPipeBlock(pipeShapeCache, FluidPipeType.ULTIMATE)); - - e.getRegistry().register(new EnergyPipeBlock(pipeShapeCache, EnergyPipeType.BASIC)); - e.getRegistry().register(new EnergyPipeBlock(pipeShapeCache, EnergyPipeType.IMPROVED)); - e.getRegistry().register(new EnergyPipeBlock(pipeShapeCache, EnergyPipeType.ADVANCED)); - e.getRegistry().register(new EnergyPipeBlock(pipeShapeCache, EnergyPipeType.ELITE)); - e.getRegistry().register(new EnergyPipeBlock(pipeShapeCache, EnergyPipeType.ULTIMATE)); + public static void onRegisterBlocks(RegistryEvent.Register e) { + e.getRegistry().register(new ItemPipeBlock(PIPE_SHAPE_CACHE, ItemPipeType.BASIC)); + e.getRegistry().register(new ItemPipeBlock(PIPE_SHAPE_CACHE, ItemPipeType.IMPROVED)); + e.getRegistry().register(new ItemPipeBlock(PIPE_SHAPE_CACHE, ItemPipeType.ADVANCED)); + + e.getRegistry().register(new FluidPipeBlock(PIPE_SHAPE_CACHE, FluidPipeType.BASIC)); + e.getRegistry().register(new FluidPipeBlock(PIPE_SHAPE_CACHE, FluidPipeType.IMPROVED)); + e.getRegistry().register(new FluidPipeBlock(PIPE_SHAPE_CACHE, FluidPipeType.ADVANCED)); + e.getRegistry().register(new FluidPipeBlock(PIPE_SHAPE_CACHE, FluidPipeType.ELITE)); + e.getRegistry().register(new FluidPipeBlock(PIPE_SHAPE_CACHE, FluidPipeType.ULTIMATE)); + + e.getRegistry().register(new EnergyPipeBlock(PIPE_SHAPE_CACHE, EnergyPipeType.BASIC)); + e.getRegistry().register(new EnergyPipeBlock(PIPE_SHAPE_CACHE, EnergyPipeType.IMPROVED)); + e.getRegistry().register(new EnergyPipeBlock(PIPE_SHAPE_CACHE, EnergyPipeType.ADVANCED)); + e.getRegistry().register(new EnergyPipeBlock(PIPE_SHAPE_CACHE, EnergyPipeType.ELITE)); + e.getRegistry().register(new EnergyPipeBlock(PIPE_SHAPE_CACHE, EnergyPipeType.ULTIMATE)); } @SubscribeEvent - public void onRegisterItems(RegistryEvent.Register e) { + public static void onRegisterItems(RegistryEvent.Register e) { e.getRegistry().register(new ItemPipeBlockItem(RefinedPipesBlocks.BASIC_ITEM_PIPE)); e.getRegistry().register(new ItemPipeBlockItem(RefinedPipesBlocks.IMPROVED_ITEM_PIPE)); e.getRegistry().register(new ItemPipeBlockItem(RefinedPipesBlocks.ADVANCED_ITEM_PIPE)); @@ -122,31 +131,31 @@ public void onRegisterItems(RegistryEvent.Register e) { } @SubscribeEvent - public void onRegisterTileEntities(RegistryEvent.Register> e) { - e.getRegistry().register(TileEntityType.Builder.of(() -> new ItemPipeTileEntity(ItemPipeType.BASIC), RefinedPipesBlocks.BASIC_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.BASIC.getId())); - e.getRegistry().register(TileEntityType.Builder.of(() -> new ItemPipeTileEntity(ItemPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.IMPROVED.getId())); - e.getRegistry().register(TileEntityType.Builder.of(() -> new ItemPipeTileEntity(ItemPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.ADVANCED.getId())); - - e.getRegistry().register(TileEntityType.Builder.of(() -> new FluidPipeTileEntity(FluidPipeType.BASIC), RefinedPipesBlocks.BASIC_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.BASIC.getId())); - e.getRegistry().register(TileEntityType.Builder.of(() -> new FluidPipeTileEntity(FluidPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.IMPROVED.getId())); - e.getRegistry().register(TileEntityType.Builder.of(() -> new FluidPipeTileEntity(FluidPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ADVANCED.getId())); - e.getRegistry().register(TileEntityType.Builder.of(() -> new FluidPipeTileEntity(FluidPipeType.ELITE), RefinedPipesBlocks.ELITE_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ELITE.getId())); - e.getRegistry().register(TileEntityType.Builder.of(() -> new FluidPipeTileEntity(FluidPipeType.ULTIMATE), RefinedPipesBlocks.ULTIMATE_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ULTIMATE.getId())); - - e.getRegistry().register(TileEntityType.Builder.of(() -> new EnergyPipeTileEntity(EnergyPipeType.BASIC), RefinedPipesBlocks.BASIC_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.BASIC.getId())); - e.getRegistry().register(TileEntityType.Builder.of(() -> new EnergyPipeTileEntity(EnergyPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.IMPROVED.getId())); - e.getRegistry().register(TileEntityType.Builder.of(() -> new EnergyPipeTileEntity(EnergyPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ADVANCED.getId())); - e.getRegistry().register(TileEntityType.Builder.of(() -> new EnergyPipeTileEntity(EnergyPipeType.ELITE), RefinedPipesBlocks.ELITE_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ELITE.getId())); - e.getRegistry().register(TileEntityType.Builder.of(() -> new EnergyPipeTileEntity(EnergyPipeType.ULTIMATE), RefinedPipesBlocks.ULTIMATE_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ULTIMATE.getId())); + public static void onRegisterTileEntities(RegistryEvent.Register> e) { + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new ItemPipeTileEntity(pos, state, ItemPipeType.BASIC), RefinedPipesBlocks.BASIC_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.BASIC.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new ItemPipeTileEntity(pos, state, ItemPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.IMPROVED.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new ItemPipeTileEntity(pos, state, ItemPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.ADVANCED.getId())); + + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new FluidPipeTileEntity(pos, state, FluidPipeType.BASIC), RefinedPipesBlocks.BASIC_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.BASIC.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new FluidPipeTileEntity(pos, state, FluidPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.IMPROVED.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new FluidPipeTileEntity(pos, state, FluidPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ADVANCED.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new FluidPipeTileEntity(pos, state, FluidPipeType.ELITE), RefinedPipesBlocks.ELITE_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ELITE.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new FluidPipeTileEntity(pos, state, FluidPipeType.ULTIMATE), RefinedPipesBlocks.ULTIMATE_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ULTIMATE.getId())); + + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new EnergyPipeTileEntity(pos, state, EnergyPipeType.BASIC), RefinedPipesBlocks.BASIC_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.BASIC.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new EnergyPipeTileEntity(pos, state, EnergyPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.IMPROVED.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new EnergyPipeTileEntity(pos, state, EnergyPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ADVANCED.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new EnergyPipeTileEntity(pos, state, EnergyPipeType.ELITE), RefinedPipesBlocks.ELITE_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ELITE.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new EnergyPipeTileEntity(pos, state, EnergyPipeType.ULTIMATE), RefinedPipesBlocks.ULTIMATE_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ULTIMATE.getId())); } @SubscribeEvent - public void onRegisterContainers(RegistryEvent.Register> e) { - e.getRegistry().register(IForgeContainerType.create(new ExtractorAttachmentContainerFactory()).setRegistryName(RefinedPipes.ID, "extractor_attachment")); + public static void onRegisterContainers(RegistryEvent.Register> e) { + e.getRegistry().register(IForgeMenuType.create(new ExtractorAttachmentContainerFactory()).setRegistryName(RefinedPipes.ID, "extractor_attachment")); } @SubscribeEvent - public void onWorldTick(TickEvent.WorldTickEvent e) { + public static void onWorldTick(TickEvent.WorldTickEvent e) { if (!e.world.isClientSide && e.phase == TickEvent.Phase.END) { NetworkManager.get(e.world).getNetworks().forEach(n -> n.update(e.world)); } diff --git a/src/main/java/com/refinedmods/refinedpipes/tile/BaseTileEntity.java b/src/main/java/com/refinedmods/refinedpipes/tile/BaseTileEntity.java index 523cb5e..115000a 100644 --- a/src/main/java/com/refinedmods/refinedpipes/tile/BaseTileEntity.java +++ b/src/main/java/com/refinedmods/refinedpipes/tile/BaseTileEntity.java @@ -1,42 +1,45 @@ package com.refinedmods.refinedpipes.tile; -import net.minecraft.block.BlockState; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.network.play.server.SUpdateTileEntityPacket; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; - -public abstract class BaseTileEntity extends TileEntity { - public BaseTileEntity(TileEntityType type) { - super(type); +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.Connection; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; + +import javax.annotation.Nullable; + +public abstract class BaseTileEntity extends BlockEntity { + protected BaseTileEntity(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); } @Override - public final CompoundNBT getUpdateTag() { + public final CompoundTag getUpdateTag() { return writeUpdate(super.getUpdateTag()); } @Override - public final SUpdateTileEntityPacket getUpdatePacket() { - return new SUpdateTileEntityPacket(worldPosition, 1, getUpdateTag()); + public final ClientboundBlockEntityDataPacket getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this, BlockEntity::getUpdateTag); } @Override - public final void onDataPacket(net.minecraft.network.NetworkManager net, SUpdateTileEntityPacket packet) { + public final void onDataPacket(Connection net, ClientboundBlockEntityDataPacket packet) { readUpdate(packet.getTag()); } @Override - public final void handleUpdateTag(BlockState state, CompoundNBT tag) { - super.load(state, tag); - + public final void handleUpdateTag(CompoundTag tag) { + super.load(tag); readUpdate(tag); } - public CompoundNBT writeUpdate(CompoundNBT tag) { + public CompoundTag writeUpdate(CompoundTag tag) { return tag; } - public void readUpdate(CompoundNBT tag) { + public void readUpdate(@Nullable CompoundTag tag) { } } diff --git a/src/main/java/com/refinedmods/refinedpipes/tile/EnergyPipeTileEntity.java b/src/main/java/com/refinedmods/refinedpipes/tile/EnergyPipeTileEntity.java index 4ae3a4d..50c7b0d 100644 --- a/src/main/java/com/refinedmods/refinedpipes/tile/EnergyPipeTileEntity.java +++ b/src/main/java/com/refinedmods/refinedpipes/tile/EnergyPipeTileEntity.java @@ -5,9 +5,10 @@ import com.refinedmods.refinedpipes.network.pipe.energy.ClientEnergyPipeEnergyStorage; import com.refinedmods.refinedpipes.network.pipe.energy.EnergyPipe; import com.refinedmods.refinedpipes.network.pipe.energy.EnergyPipeType; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.CapabilityEnergy; @@ -19,8 +20,8 @@ public class EnergyPipeTileEntity extends PipeTileEntity { private final EnergyPipeType type; private final LazyOptional clientEnergyStorage; - public EnergyPipeTileEntity(EnergyPipeType type) { - super(type.getTileType()); + public EnergyPipeTileEntity(BlockPos pos, BlockState state, EnergyPipeType type) { + super(type.getTileType(), pos, state); this.type = type; this.clientEnergyStorage = LazyOptional.of(() -> new ClientEnergyPipeEnergyStorage(type)); @@ -46,7 +47,7 @@ public LazyOptional getCapability(@Nonnull Capability cap, @Nullable D } @Override - protected Pipe createPipe(World world, BlockPos pos) { + protected Pipe createPipe(Level world, BlockPos pos) { return new EnergyPipe(world, pos, type); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/tile/FluidPipeTileEntity.java b/src/main/java/com/refinedmods/refinedpipes/tile/FluidPipeTileEntity.java index 10bd815..705de8c 100644 --- a/src/main/java/com/refinedmods/refinedpipes/tile/FluidPipeTileEntity.java +++ b/src/main/java/com/refinedmods/refinedpipes/tile/FluidPipeTileEntity.java @@ -5,11 +5,14 @@ import com.refinedmods.refinedpipes.network.pipe.Pipe; import com.refinedmods.refinedpipes.network.pipe.fluid.FluidPipe; import com.refinedmods.refinedpipes.network.pipe.fluid.FluidPipeType; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.fluids.FluidStack; +import javax.annotation.Nullable; + public class FluidPipeTileEntity extends PipeTileEntity { private final FluidPipeType type; @@ -17,8 +20,8 @@ public class FluidPipeTileEntity extends PipeTileEntity { private float fullness = 0; private float renderFullness = 0; - public FluidPipeTileEntity(FluidPipeType type) { - super(type.getTileType()); + public FluidPipeTileEntity(BlockPos pos, BlockState state, FluidPipeType type) { + super(type.getTileType(), pos, state); this.type = type; } @@ -52,10 +55,10 @@ public float updateAndGetRenderFullness(float partialTicks) { } @Override - public CompoundNBT writeUpdate(CompoundNBT tag) { + public CompoundTag writeUpdate(CompoundTag tag) { Pipe pipe = NetworkManager.get(level).getPipe(worldPosition); if (pipe instanceof FluidPipe && pipe.getNetwork() != null) { - tag.put("fluid", ((FluidNetwork) pipe.getNetwork()).getFluidTank().getFluid().writeToNBT(new CompoundNBT())); + tag.put("fluid", ((FluidNetwork) pipe.getNetwork()).getFluidTank().getFluid().writeToNBT(new CompoundTag())); tag.putFloat("fullness", ((FluidPipe) pipe).getFullness()); } @@ -63,14 +66,19 @@ public CompoundNBT writeUpdate(CompoundNBT tag) { } @Override - public void readUpdate(CompoundNBT tag) { - if (tag.contains("fluid")) { + public void readUpdate(@Nullable CompoundTag tag) { + if (tag != null && tag.contains("fluid")) { fluid = FluidStack.loadFluidStackFromNBT(tag.getCompound("fluid")); + } else { + fluid = FluidStack.EMPTY; } - if (tag.contains("fullness")) { + if (tag != null && tag.contains("fullness")) { fullness = tag.getFloat("fullness"); renderFullness = fullness; + } else { + fullness = 0; + renderFullness = 0; } super.readUpdate(tag); @@ -81,7 +89,7 @@ public void setFullness(float fullness) { } @Override - protected Pipe createPipe(World world, BlockPos pos) { + protected Pipe createPipe(Level world, BlockPos pos) { return new FluidPipe(world, pos, type); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/tile/ItemPipeTileEntity.java b/src/main/java/com/refinedmods/refinedpipes/tile/ItemPipeTileEntity.java index 4b4ff2f..7efb46b 100644 --- a/src/main/java/com/refinedmods/refinedpipes/tile/ItemPipeTileEntity.java +++ b/src/main/java/com/refinedmods/refinedpipes/tile/ItemPipeTileEntity.java @@ -5,30 +5,25 @@ import com.refinedmods.refinedpipes.network.pipe.item.ItemPipeType; import com.refinedmods.refinedpipes.network.pipe.transport.ItemTransport; import com.refinedmods.refinedpipes.network.pipe.transport.ItemTransportProps; -import net.minecraft.inventory.InventoryHelper; -import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.Containers; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; import java.util.ArrayList; import java.util.List; -public class ItemPipeTileEntity extends PipeTileEntity implements ITickableTileEntity { - private List props = new ArrayList<>(); - +public class ItemPipeTileEntity extends PipeTileEntity { private final ItemPipeType type; + private List props = new ArrayList<>(); - public ItemPipeTileEntity(ItemPipeType type) { - super(type.getTileType()); - + public ItemPipeTileEntity(BlockPos pos, BlockState state, ItemPipeType type) { + super(type.getTileType(), pos, state); this.type = type; } - @Override - public void tick() { - if (level.isClientSide) { - props.forEach(ItemTransportProps::tick); - } + public static void tick(ItemPipeTileEntity blockEntity) { + blockEntity.props.forEach(ItemTransportProps::tick); } public List getProps() { @@ -44,12 +39,12 @@ protected void spawnDrops(Pipe pipe) { super.spawnDrops(pipe); for (ItemTransport transport : ((ItemPipe) pipe).getTransports()) { - InventoryHelper.dropItemStack(level, worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), transport.getValue()); + Containers.dropItemStack(level, worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), transport.getValue()); } } @Override - protected Pipe createPipe(World world, BlockPos pos) { + protected Pipe createPipe(Level world, BlockPos pos) { return new ItemPipe(world, pos, type); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/tile/PipeTileEntity.java b/src/main/java/com/refinedmods/refinedpipes/tile/PipeTileEntity.java index bdd3523..9b33aa8 100644 --- a/src/main/java/com/refinedmods/refinedpipes/tile/PipeTileEntity.java +++ b/src/main/java/com/refinedmods/refinedpipes/tile/PipeTileEntity.java @@ -6,28 +6,28 @@ import com.refinedmods.refinedpipes.network.pipe.attachment.AttachmentManager; import com.refinedmods.refinedpipes.network.pipe.attachment.ClientAttachmentManager; import com.refinedmods.refinedpipes.network.pipe.attachment.DummyAttachmentManager; -import net.minecraft.block.BlockState; -import net.minecraft.inventory.InventoryHelper; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.Containers; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.data.ModelDataMap; import net.minecraftforge.client.model.data.ModelProperty; import javax.annotation.Nonnull; +import javax.annotation.Nullable; public abstract class PipeTileEntity extends BaseTileEntity { public static final ModelProperty ATTACHMENTS_PROPERTY = new ModelProperty<>(); + private final AttachmentManager clientAttachmentManager = new ClientAttachmentManager(); - public PipeTileEntity(TileEntityType type) { - super(type); + protected PipeTileEntity(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); } - private final AttachmentManager clientAttachmentManager = new ClientAttachmentManager(); - public AttachmentManager getAttachmentManager() { if (level.isClientSide) { return clientAttachmentManager; @@ -55,11 +55,20 @@ public void clearRemoved() { } } + // TODO: remove when https://github.com/MinecraftForge/MinecraftForge/pull/8303/files is merged + private boolean unloaded; + + @Override + public void onChunkUnloaded() { + super.onChunkUnloaded(); + unloaded = true; + } + @Override public void setRemoved() { super.setRemoved(); - if (!level.isClientSide) { + if (!level.isClientSide && !unloaded) { NetworkManager mgr = NetworkManager.get(level); Pipe pipe = mgr.getPipe(worldPosition); @@ -67,7 +76,7 @@ public void setRemoved() { spawnDrops(pipe); for (Attachment attachment : pipe.getAttachmentManager().getAttachments()) { - InventoryHelper.dropItemStack(level, worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), attachment.getDrop()); + Containers.dropItemStack(level, worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), attachment.getDrop()); } } @@ -85,14 +94,14 @@ public IModelData getModelData() { } @Override - public CompoundNBT writeUpdate(CompoundNBT tag) { + public CompoundTag writeUpdate(CompoundTag tag) { getAttachmentManager().writeUpdate(tag); return tag; } @Override - public void readUpdate(CompoundNBT tag) { + public void readUpdate(@Nullable CompoundTag tag) { getAttachmentManager().readUpdate(tag); requestModelDataUpdate(); @@ -101,5 +110,5 @@ public void readUpdate(CompoundNBT tag) { level.sendBlockUpdated(worldPosition, state, state, 1 | 2); } - protected abstract Pipe createPipe(World world, BlockPos pos); + protected abstract Pipe createPipe(Level world, BlockPos pos); } diff --git a/src/main/java/com/refinedmods/refinedpipes/util/DirectionUtil.java b/src/main/java/com/refinedmods/refinedpipes/util/DirectionUtil.java index ed437b2..97d057d 100644 --- a/src/main/java/com/refinedmods/refinedpipes/util/DirectionUtil.java +++ b/src/main/java/com/refinedmods/refinedpipes/util/DirectionUtil.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedpipes.util; -import net.minecraft.util.Direction; +import net.minecraft.core.Direction; public class DirectionUtil { public static Direction safeGet(byte d) { diff --git a/src/main/java/com/refinedmods/refinedpipes/util/FluidUtil.java b/src/main/java/com/refinedmods/refinedpipes/util/FluidUtil.java index ad1ac19..1efde22 100644 --- a/src/main/java/com/refinedmods/refinedpipes/util/FluidUtil.java +++ b/src/main/java/com/refinedmods/refinedpipes/util/FluidUtil.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedpipes.util; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; diff --git a/src/main/java/com/refinedmods/refinedpipes/util/Raytracer.java b/src/main/java/com/refinedmods/refinedpipes/util/Raytracer.java index 234e0ad..7f44c5b 100644 --- a/src/main/java/com/refinedmods/refinedpipes/util/Raytracer.java +++ b/src/main/java/com/refinedmods/refinedpipes/util/Raytracer.java @@ -1,9 +1,13 @@ package com.refinedmods.refinedpipes.util; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.util.math.*; -import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.ForgeMod; import org.apache.commons.lang3.tuple.Pair; @@ -12,31 +16,31 @@ // https://github.com/mekanism/Mekanism/blob/9a3fe1a5d78bb38fa963a3bcbc8d3846412315e4/src/main/java/mekanism/common/util/MultipartUtils.java public class Raytracer { - public static Pair getVectors(Entity entity) { - float pitch = entity.xRot; - float yaw = entity.yRot; - Vector3d start = new Vector3d(entity.getX(), entity.getY() + entity.getEyeHeight(), entity.getZ()); - float f1 = MathHelper.cos(-yaw * 0.017453292F - (float) Math.PI); - float f2 = MathHelper.sin(-yaw * 0.017453292F - (float) Math.PI); - float f3 = -MathHelper.cos(-pitch * 0.017453292F); - float f4 = MathHelper.sin(-pitch * 0.017453292F); + public static Pair getVectors(Entity entity) { + float pitch = entity.getXRot(); + float yaw = entity.getYRot(); + Vec3 start = new Vec3(entity.getX(), entity.getY() + entity.getEyeHeight(), entity.getZ()); + float f1 = Mth.cos(-yaw * 0.017453292F - (float) Math.PI); + float f2 = Mth.sin(-yaw * 0.017453292F - (float) Math.PI); + float f3 = -Mth.cos(-pitch * 0.017453292F); + float f4 = Mth.sin(-pitch * 0.017453292F); float f5 = f2 * f3; float f6 = f1 * f3; double d3 = 5.0D; - if (entity instanceof ServerPlayerEntity) { - d3 = ((ServerPlayerEntity) entity).getAttribute(ForgeMod.REACH_DISTANCE.get()).getValue(); + if (entity instanceof ServerPlayer) { + d3 = ((ServerPlayer) entity).getAttribute(ForgeMod.REACH_DISTANCE.get()).getValue(); } - Vector3d end = start.add(f5 * d3, f4 * d3, f6 * d3); + Vec3 end = start.add(f5 * d3, f4 * d3, f6 * d3); return Pair.of(start, end); } - public static AdvancedRayTraceResult collisionRayTrace(BlockPos pos, Vector3d start, Vector3d end, Collection boxes) { + public static AdvancedRayTraceResult collisionRayTrace(BlockPos pos, Vec3 start, Vec3 end, Collection boxes) { double minDistance = Double.POSITIVE_INFINITY; - AdvancedRayTraceResult hit = null; + AdvancedRayTraceResult hit = null; int i = -1; - for (AxisAlignedBB aabb : boxes) { - AdvancedRayTraceResult result = aabb == null ? null : collisionRayTrace(pos, start, end, aabb, i, null); + for (AABB aabb : boxes) { + AdvancedRayTraceResult result = aabb == null ? null : collisionRayTrace(pos, start, end, aabb, i, null); if (result != null) { double d = result.squareDistanceTo(start); if (d < minDistance) { @@ -50,42 +54,34 @@ public static AdvancedRayTraceResult collisionRayTrace(Bloc return hit; } - public static AdvancedRayTraceResult collisionRayTrace(BlockPos pos, Vector3d start, Vector3d end, AxisAlignedBB bounds, int subHit, Object hitInfo) { - BlockRayTraceResult result = AxisAlignedBB.clip(Collections.singleton(bounds), start, end, pos); + public static AdvancedRayTraceResult collisionRayTrace(BlockPos pos, Vec3 start, Vec3 end, AABB bounds, int subHit, Object hitInfo) { + BlockHitResult result = AABB.clip(Collections.singleton(bounds), start, end, pos); if (result == null) { return null; } - - result.subHit = subHit; - result.hitInfo = hitInfo; - return new AdvancedRayTraceResult<>(result, bounds); } - public static class AdvancedRayTraceResult { - public final AxisAlignedBB bounds; + public static boolean inclusiveContains(AABB aabb, Vec3 hit) { + return hit.x >= aabb.minX + && hit.x <= aabb.maxX + && hit.y >= aabb.minY + && hit.y <= aabb.maxY + && hit.z >= aabb.minZ + && hit.z <= aabb.maxZ; + } + + public static class AdvancedRayTraceResult { + public final AABB bounds; public final T hit; - public AdvancedRayTraceResult(T mop, AxisAlignedBB aabb) { + public AdvancedRayTraceResult(T mop, AABB aabb) { hit = mop; bounds = aabb; } - public boolean valid() { - return hit != null && bounds != null; - } - - public double squareDistanceTo(Vector3d vec) { + public double squareDistanceTo(Vec3 vec) { return hit.getLocation().distanceToSqr(vec); } } - - public static boolean inclusiveContains(AxisAlignedBB aabb, Vector3d hit) { - return hit.x >= aabb.minX - && hit.x <= aabb.maxX - && hit.y >= aabb.minY - && hit.y <= aabb.maxY - && hit.z >= aabb.minZ - && hit.z <= aabb.maxZ; - } } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index c052c05..b0c0061 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,5 +1,5 @@ modLoader="javafml" -loaderVersion="[36,)" +loaderVersion="[39,)" issueTrackerURL="https://github.com/refinedmods/refinedpipes" license="MIT" [[mods]] diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index bc8ac4d..57ecf30 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "description": "Refined Pipes resources", - "pack_format": 6 + "pack_format": 8 } } From e7a7ae7975a06c7c3b1d8d8824340bd59f53efeb Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Fri, 17 Dec 2021 23:28:11 +0100 Subject: [PATCH 5/6] Renames --- .../refinedpipes/RefinedPipes.java | 10 +-- .../RefinedPipesBlockEntities.java | 36 ++++++++ ...s.java => RefinedPipesContainerMenus.java} | 6 +- .../refinedpipes/RefinedPipesNetwork.java | 4 +- .../RefinedPipesTileEntities.java | 36 -------- .../refinedpipes/block/EnergyPipeBlock.java | 28 +++---- .../refinedpipes/block/FluidPipeBlock.java | 28 +++---- .../refinedpipes/block/ItemPipeBlock.java | 24 +++--- .../refinedpipes/block/PipeBlock.java | 56 ++++++------- .../BaseBlockEntity.java} | 6 +- .../EnergyPipeBlockEntity.java} | 12 +-- .../FluidPipeBlockEntity.java} | 12 +-- .../ItemPipeBlockEntity.java} | 14 ++-- .../PipeBlockEntity.java} | 8 +- ...eContainer.java => BaseContainerMenu.java} | 4 +- ... => ExtractorAttachmentContainerMenu.java} | 8 +- .../ExtractorAttachmentContainerFactory.java | 8 +- ...a => ExtractorAttachmentMenuProvider.java} | 10 +-- .../refinedpipes/item/AttachmentItem.java | 4 +- .../item/EnergyPipeBlockItem.java | 4 +- .../refinedpipes/item/FluidPipeBlockItem.java | 4 +- .../refinedpipes/item/ItemPipeBlockItem.java | 4 +- .../MainCreativeModeTab.java} | 6 +- .../ChangeBlacklistWhitelistMessage.java | 10 +-- .../message/ChangeExactModeMessage.java | 10 +-- .../message/ChangeRedstoneModeMessage.java | 10 +-- .../message/ChangeRoutingModeMessage.java | 10 +-- .../message/ChangeStackSizeMessage.java | 10 +-- .../message/FluidPipeMessage.java | 10 +-- .../message/ItemTransportMessage.java | 8 +- .../refinedpipes/network/Network.java | 8 +- .../refinedpipes/network/NetworkManager.java | 36 ++++---- .../network/energy/EnergyNetwork.java | 14 ++-- .../network/fluid/FluidNetwork.java | 14 ++-- .../network/graph/NetworkGraphScanner.java | 22 ++--- .../graph/NetworkGraphScannerRequest.java | 10 +-- .../network/item/ItemNetwork.java | 4 +- .../refinedpipes/network/pipe/Pipe.java | 18 ++-- .../network/pipe/PipeFactory.java | 2 +- .../attachment/ServerAttachmentManager.java | 4 +- .../extractor/ExtractorAttachment.java | 20 ++--- .../extractor/ItemDestinationFinder.java | 8 +- .../attachment/extractor/RedstoneMode.java | 6 +- .../network/pipe/energy/EnergyPipe.java | 4 +- .../pipe/energy/EnergyPipeFactory.java | 4 +- .../network/pipe/energy/EnergyPipeType.java | 16 ++-- .../network/pipe/fluid/FluidPipe.java | 6 +- .../network/pipe/fluid/FluidPipeFactory.java | 4 +- .../network/pipe/fluid/FluidPipeType.java | 16 ++-- .../network/pipe/item/ItemPipe.java | 12 +-- .../network/pipe/item/ItemPipeFactory.java | 4 +- .../network/pipe/item/ItemPipeType.java | 12 +-- .../network/pipe/shape/PipeShapeCache.java | 8 +- .../network/pipe/transport/ItemTransport.java | 16 ++-- .../ItemBounceBackTransportCallback.java | 4 +- .../callback/ItemInsertTransportCallback.java | 14 ++-- .../ItemPipeGoneTransportCallback.java | 4 +- .../transport/callback/TransportCallback.java | 2 +- .../refinedpipes/render/CubeBuilder.java | 82 +++++++++---------- ...java => FluidPipeBlockEntityRenderer.java} | 48 +++++------ ....java => ItemPipeBlockEntityRenderer.java} | 22 ++--- .../refinedpipes/render/PipeBakedModel.java | 4 +- .../refinedpipes/screen/BaseScreen.java | 10 +-- .../screen/ExtractorAttachmentScreen.java | 30 +++---- .../screen/widget/IconButton.java | 6 +- .../refinedpipes/setup/ClientSetup.java | 26 +++--- .../refinedpipes/setup/CommonSetup.java | 42 +++++----- 67 files changed, 481 insertions(+), 481 deletions(-) create mode 100644 src/main/java/com/refinedmods/refinedpipes/RefinedPipesBlockEntities.java rename src/main/java/com/refinedmods/refinedpipes/{RefinedPipesContainers.java => RefinedPipesContainerMenus.java} (63%) delete mode 100644 src/main/java/com/refinedmods/refinedpipes/RefinedPipesTileEntities.java rename src/main/java/com/refinedmods/refinedpipes/{tile/BaseTileEntity.java => blockentity/BaseBlockEntity.java} (85%) rename src/main/java/com/refinedmods/refinedpipes/{tile/EnergyPipeTileEntity.java => blockentity/EnergyPipeBlockEntity.java} (81%) rename src/main/java/com/refinedmods/refinedpipes/{tile/FluidPipeTileEntity.java => blockentity/FluidPipeBlockEntity.java} (87%) rename src/main/java/com/refinedmods/refinedpipes/{tile/ItemPipeTileEntity.java => blockentity/ItemPipeBlockEntity.java} (75%) rename src/main/java/com/refinedmods/refinedpipes/{tile/PipeTileEntity.java => blockentity/PipeBlockEntity.java} (92%) rename src/main/java/com/refinedmods/refinedpipes/container/{BaseContainer.java => BaseContainerMenu.java} (96%) rename src/main/java/com/refinedmods/refinedpipes/container/{ExtractorAttachmentContainer.java => ExtractorAttachmentContainerMenu.java} (96%) rename src/main/java/com/refinedmods/refinedpipes/container/provider/{ExtractorAttachmentContainerProvider.java => ExtractorAttachmentMenuProvider.java} (87%) rename src/main/java/com/refinedmods/refinedpipes/item/{group/MainItemGroup.java => creativetab/MainCreativeModeTab.java} (70%) rename src/main/java/com/refinedmods/refinedpipes/render/{FluidPipeTileEntityRenderer.java => FluidPipeBlockEntityRenderer.java} (89%) rename src/main/java/com/refinedmods/refinedpipes/render/{ItemPipeTileEntityRenderer.java => ItemPipeBlockEntityRenderer.java} (74%) diff --git a/src/main/java/com/refinedmods/refinedpipes/RefinedPipes.java b/src/main/java/com/refinedmods/refinedpipes/RefinedPipes.java index 05db198..84a9150 100644 --- a/src/main/java/com/refinedmods/refinedpipes/RefinedPipes.java +++ b/src/main/java/com/refinedmods/refinedpipes/RefinedPipes.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedpipes; import com.refinedmods.refinedpipes.config.ServerConfig; -import com.refinedmods.refinedpipes.item.group.MainItemGroup; +import com.refinedmods.refinedpipes.item.creativetab.MainCreativeModeTab; import com.refinedmods.refinedpipes.setup.ClientSetup; import com.refinedmods.refinedpipes.setup.CommonSetup; import net.minecraft.world.inventory.MenuType; @@ -20,7 +20,7 @@ @Mod(RefinedPipes.ID) public class RefinedPipes { public static final String ID = "refinedpipes"; - public static final CreativeModeTab MAIN_GROUP = new MainItemGroup(); + public static final CreativeModeTab MAIN_GROUP = new MainCreativeModeTab(); public static final RefinedPipesNetwork NETWORK = new RefinedPipesNetwork(); public static final ServerConfig SERVER_CONFIG = new ServerConfig(); @@ -36,9 +36,9 @@ public RefinedPipes() { FMLJavaModLoadingContext.get().getModEventBus().addListener(CommonSetup::onCommonSetup); FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(Block.class, CommonSetup::onRegisterBlocks); FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(Item.class, CommonSetup::onRegisterItems); - FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(BlockEntityType.class, CommonSetup::onRegisterTileEntities); - FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(MenuType.class, CommonSetup::onRegisterContainers); + FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(BlockEntityType.class, CommonSetup::onRegisterBlockEntities); + FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(MenuType.class, CommonSetup::onRegisterContainerMenus); - MinecraftForge.EVENT_BUS.addListener(CommonSetup::onWorldTick); + MinecraftForge.EVENT_BUS.addListener(CommonSetup::onLevelTick); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/RefinedPipesBlockEntities.java b/src/main/java/com/refinedmods/refinedpipes/RefinedPipesBlockEntities.java new file mode 100644 index 0000000..98bd26c --- /dev/null +++ b/src/main/java/com/refinedmods/refinedpipes/RefinedPipesBlockEntities.java @@ -0,0 +1,36 @@ +package com.refinedmods.refinedpipes; + +import com.refinedmods.refinedpipes.blockentity.EnergyPipeBlockEntity; +import com.refinedmods.refinedpipes.blockentity.FluidPipeBlockEntity; +import com.refinedmods.refinedpipes.blockentity.ItemPipeBlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraftforge.registries.ObjectHolder; + +public class RefinedPipesBlockEntities { + @ObjectHolder(RefinedPipes.ID + ":basic_item_pipe") + public static final BlockEntityType BASIC_ITEM_PIPE = null; + @ObjectHolder(RefinedPipes.ID + ":improved_item_pipe") + public static final BlockEntityType IMPROVED_ITEM_PIPE = null; + @ObjectHolder(RefinedPipes.ID + ":advanced_item_pipe") + public static final BlockEntityType ADVANCED_ITEM_PIPE = null; + @ObjectHolder(RefinedPipes.ID + ":basic_fluid_pipe") + public static final BlockEntityType BASIC_FLUID_PIPE = null; + @ObjectHolder(RefinedPipes.ID + ":improved_fluid_pipe") + public static final BlockEntityType IMPROVED_FLUID_PIPE = null; + @ObjectHolder(RefinedPipes.ID + ":advanced_fluid_pipe") + public static final BlockEntityType ADVANCED_FLUID_PIPE = null; + @ObjectHolder(RefinedPipes.ID + ":elite_fluid_pipe") + public static final BlockEntityType ELITE_FLUID_PIPE = null; + @ObjectHolder(RefinedPipes.ID + ":ultimate_fluid_pipe") + public static final BlockEntityType ULTIMATE_FLUID_PIPE = null; + @ObjectHolder(RefinedPipes.ID + ":basic_energy_pipe") + public static final BlockEntityType BASIC_ENERGY_PIPE = null; + @ObjectHolder(RefinedPipes.ID + ":improved_energy_pipe") + public static final BlockEntityType IMPROVED_ENERGY_PIPE = null; + @ObjectHolder(RefinedPipes.ID + ":advanced_energy_pipe") + public static final BlockEntityType ADVANCED_ENERGY_PIPE = null; + @ObjectHolder(RefinedPipes.ID + ":elite_energy_pipe") + public static final BlockEntityType ELITE_ENERGY_PIPE = null; + @ObjectHolder(RefinedPipes.ID + ":ultimate_energy_pipe") + public static final BlockEntityType ULTIMATE_ENERGY_PIPE = null; +} diff --git a/src/main/java/com/refinedmods/refinedpipes/RefinedPipesContainers.java b/src/main/java/com/refinedmods/refinedpipes/RefinedPipesContainerMenus.java similarity index 63% rename from src/main/java/com/refinedmods/refinedpipes/RefinedPipesContainers.java rename to src/main/java/com/refinedmods/refinedpipes/RefinedPipesContainerMenus.java index 29a8aa3..bbba57a 100644 --- a/src/main/java/com/refinedmods/refinedpipes/RefinedPipesContainers.java +++ b/src/main/java/com/refinedmods/refinedpipes/RefinedPipesContainerMenus.java @@ -1,10 +1,10 @@ package com.refinedmods.refinedpipes; -import com.refinedmods.refinedpipes.container.ExtractorAttachmentContainer; +import com.refinedmods.refinedpipes.container.ExtractorAttachmentContainerMenu; import net.minecraft.world.inventory.MenuType; import net.minecraftforge.registries.ObjectHolder; -public class RefinedPipesContainers { +public class RefinedPipesContainerMenus { @ObjectHolder(RefinedPipes.ID + ":extractor_attachment") - public static final MenuType EXTRACTOR_ATTACHMENT = null; + public static final MenuType EXTRACTOR_ATTACHMENT = null; } diff --git a/src/main/java/com/refinedmods/refinedpipes/RefinedPipesNetwork.java b/src/main/java/com/refinedmods/refinedpipes/RefinedPipesNetwork.java index 74a81f4..60153f3 100644 --- a/src/main/java/com/refinedmods/refinedpipes/RefinedPipesNetwork.java +++ b/src/main/java/com/refinedmods/refinedpipes/RefinedPipesNetwork.java @@ -32,13 +32,13 @@ public void register() { handler.registerMessage(id++, FluidFilterSlotUpdateMessage.class, FluidFilterSlotUpdateMessage::encode, FluidFilterSlotUpdateMessage::decode, FluidFilterSlotUpdateMessage::handle); } - public void sendInArea(Level world, BlockPos pos, int radius, Object message) { + public void sendInArea(Level level, BlockPos pos, int radius, Object message) { handler.send(PacketDistributor.NEAR.with(() -> new PacketDistributor.TargetPoint( pos.getX(), pos.getY(), pos.getZ(), radius, - world.dimension() + level.dimension() )), message); } diff --git a/src/main/java/com/refinedmods/refinedpipes/RefinedPipesTileEntities.java b/src/main/java/com/refinedmods/refinedpipes/RefinedPipesTileEntities.java deleted file mode 100644 index 2cd5877..0000000 --- a/src/main/java/com/refinedmods/refinedpipes/RefinedPipesTileEntities.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.refinedmods.refinedpipes; - -import com.refinedmods.refinedpipes.tile.EnergyPipeTileEntity; -import com.refinedmods.refinedpipes.tile.FluidPipeTileEntity; -import com.refinedmods.refinedpipes.tile.ItemPipeTileEntity; -import net.minecraft.world.level.block.entity.BlockEntityType; -import net.minecraftforge.registries.ObjectHolder; - -public class RefinedPipesTileEntities { - @ObjectHolder(RefinedPipes.ID + ":basic_item_pipe") - public static final BlockEntityType BASIC_ITEM_PIPE = null; - @ObjectHolder(RefinedPipes.ID + ":improved_item_pipe") - public static final BlockEntityType IMPROVED_ITEM_PIPE = null; - @ObjectHolder(RefinedPipes.ID + ":advanced_item_pipe") - public static final BlockEntityType ADVANCED_ITEM_PIPE = null; - @ObjectHolder(RefinedPipes.ID + ":basic_fluid_pipe") - public static final BlockEntityType BASIC_FLUID_PIPE = null; - @ObjectHolder(RefinedPipes.ID + ":improved_fluid_pipe") - public static final BlockEntityType IMPROVED_FLUID_PIPE = null; - @ObjectHolder(RefinedPipes.ID + ":advanced_fluid_pipe") - public static final BlockEntityType ADVANCED_FLUID_PIPE = null; - @ObjectHolder(RefinedPipes.ID + ":elite_fluid_pipe") - public static final BlockEntityType ELITE_FLUID_PIPE = null; - @ObjectHolder(RefinedPipes.ID + ":ultimate_fluid_pipe") - public static final BlockEntityType ULTIMATE_FLUID_PIPE = null; - @ObjectHolder(RefinedPipes.ID + ":basic_energy_pipe") - public static final BlockEntityType BASIC_ENERGY_PIPE = null; - @ObjectHolder(RefinedPipes.ID + ":improved_energy_pipe") - public static final BlockEntityType IMPROVED_ENERGY_PIPE = null; - @ObjectHolder(RefinedPipes.ID + ":advanced_energy_pipe") - public static final BlockEntityType ADVANCED_ENERGY_PIPE = null; - @ObjectHolder(RefinedPipes.ID + ":elite_energy_pipe") - public static final BlockEntityType ELITE_ENERGY_PIPE = null; - @ObjectHolder(RefinedPipes.ID + ":ultimate_energy_pipe") - public static final BlockEntityType ULTIMATE_ENERGY_PIPE = null; -} diff --git a/src/main/java/com/refinedmods/refinedpipes/block/EnergyPipeBlock.java b/src/main/java/com/refinedmods/refinedpipes/block/EnergyPipeBlock.java index 94f0685..1574a71 100644 --- a/src/main/java/com/refinedmods/refinedpipes/block/EnergyPipeBlock.java +++ b/src/main/java/com/refinedmods/refinedpipes/block/EnergyPipeBlock.java @@ -1,9 +1,9 @@ package com.refinedmods.refinedpipes.block; +import com.refinedmods.refinedpipes.blockentity.EnergyPipeBlockEntity; import com.refinedmods.refinedpipes.network.pipe.energy.EnergyPipeEnergyStorage; import com.refinedmods.refinedpipes.network.pipe.energy.EnergyPipeType; import com.refinedmods.refinedpipes.network.pipe.shape.PipeShapeCache; -import com.refinedmods.refinedpipes.tile.EnergyPipeTileEntity; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.LevelAccessor; @@ -29,18 +29,18 @@ public EnergyPipeType getType() { } @Override - protected boolean hasConnection(LevelAccessor world, BlockPos pos, Direction direction) { - BlockEntity currentTile = world.getBlockEntity(pos); - if (currentTile instanceof EnergyPipeTileEntity && - ((EnergyPipeTileEntity) currentTile).getAttachmentManager().hasAttachment(direction)) { + protected boolean hasConnection(LevelAccessor level, BlockPos pos, Direction direction) { + BlockEntity currentBlockEntity = level.getBlockEntity(pos); + if (currentBlockEntity instanceof EnergyPipeBlockEntity && + ((EnergyPipeBlockEntity) currentBlockEntity).getAttachmentManager().hasAttachment(direction)) { return false; } - BlockState facingState = world.getBlockState(pos.relative(direction)); - BlockEntity facingTile = world.getBlockEntity(pos.relative(direction)); + BlockState facingState = level.getBlockState(pos.relative(direction)); + BlockEntity facingBlockEntity = level.getBlockEntity(pos.relative(direction)); - if (facingTile instanceof EnergyPipeTileEntity && - ((EnergyPipeTileEntity) facingTile).getAttachmentManager().hasAttachment(direction.getOpposite())) { + if (facingBlockEntity instanceof EnergyPipeBlockEntity && + ((EnergyPipeBlockEntity) facingBlockEntity).getAttachmentManager().hasAttachment(direction.getOpposite())) { return false; } @@ -49,13 +49,13 @@ protected boolean hasConnection(LevelAccessor world, BlockPos pos, Direction dir } @Override - protected boolean hasInvConnection(LevelAccessor world, BlockPos pos, Direction direction) { - BlockEntity facingTile = world.getBlockEntity(pos.relative(direction)); - if (facingTile == null) { + protected boolean hasInvConnection(LevelAccessor level, BlockPos pos, Direction direction) { + BlockEntity facingBlockEntityy = level.getBlockEntity(pos.relative(direction)); + if (facingBlockEntityy == null) { return false; } - IEnergyStorage energyStorage = facingTile.getCapability(CapabilityEnergy.ENERGY, direction.getOpposite()).orElse(null); + IEnergyStorage energyStorage = facingBlockEntityy.getCapability(CapabilityEnergy.ENERGY, direction.getOpposite()).orElse(null); if (energyStorage == null) { return false; } @@ -70,6 +70,6 @@ protected boolean hasInvConnection(LevelAccessor world, BlockPos pos, Direction @Nullable @Override public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { - return new EnergyPipeTileEntity(pos, state, type); + return new EnergyPipeBlockEntity(pos, state, type); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/block/FluidPipeBlock.java b/src/main/java/com/refinedmods/refinedpipes/block/FluidPipeBlock.java index 49ed3c5..dc310d6 100644 --- a/src/main/java/com/refinedmods/refinedpipes/block/FluidPipeBlock.java +++ b/src/main/java/com/refinedmods/refinedpipes/block/FluidPipeBlock.java @@ -1,8 +1,8 @@ package com.refinedmods.refinedpipes.block; +import com.refinedmods.refinedpipes.blockentity.FluidPipeBlockEntity; import com.refinedmods.refinedpipes.network.pipe.fluid.FluidPipeType; import com.refinedmods.refinedpipes.network.pipe.shape.PipeShapeCache; -import com.refinedmods.refinedpipes.tile.FluidPipeTileEntity; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.LevelAccessor; @@ -26,18 +26,18 @@ public FluidPipeType getType() { } @Override - protected boolean hasConnection(LevelAccessor world, BlockPos pos, Direction direction) { - BlockEntity currentTile = world.getBlockEntity(pos); - if (currentTile instanceof FluidPipeTileEntity && - ((FluidPipeTileEntity) currentTile).getAttachmentManager().hasAttachment(direction)) { + protected boolean hasConnection(LevelAccessor level, BlockPos pos, Direction direction) { + BlockEntity currentBlockEntity = level.getBlockEntity(pos); + if (currentBlockEntity instanceof FluidPipeBlockEntity && + ((FluidPipeBlockEntity) currentBlockEntity).getAttachmentManager().hasAttachment(direction)) { return false; } - BlockState facingState = world.getBlockState(pos.relative(direction)); - BlockEntity facingTile = world.getBlockEntity(pos.relative(direction)); + BlockState facingState = level.getBlockState(pos.relative(direction)); + BlockEntity facingBlockEntity = level.getBlockEntity(pos.relative(direction)); - if (facingTile instanceof FluidPipeTileEntity && - ((FluidPipeTileEntity) facingTile).getAttachmentManager().hasAttachment(direction.getOpposite())) { + if (facingBlockEntity instanceof FluidPipeBlockEntity && + ((FluidPipeBlockEntity) facingBlockEntity).getAttachmentManager().hasAttachment(direction.getOpposite())) { return false; } @@ -46,15 +46,15 @@ protected boolean hasConnection(LevelAccessor world, BlockPos pos, Direction dir } @Override - protected boolean hasInvConnection(LevelAccessor world, BlockPos pos, Direction direction) { - BlockEntity facingTile = world.getBlockEntity(pos.relative(direction)); + protected boolean hasInvConnection(LevelAccessor level, BlockPos pos, Direction direction) { + BlockEntity facingBlockEntity = level.getBlockEntity(pos.relative(direction)); - return facingTile != null - && facingTile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, direction.getOpposite()).isPresent(); + return facingBlockEntity != null + && facingBlockEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, direction.getOpposite()).isPresent(); } @Override public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { - return new FluidPipeTileEntity(pos, state, type); + return new FluidPipeBlockEntity(pos, state, type); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/block/ItemPipeBlock.java b/src/main/java/com/refinedmods/refinedpipes/block/ItemPipeBlock.java index 7019326..f6cf705 100644 --- a/src/main/java/com/refinedmods/refinedpipes/block/ItemPipeBlock.java +++ b/src/main/java/com/refinedmods/refinedpipes/block/ItemPipeBlock.java @@ -1,8 +1,8 @@ package com.refinedmods.refinedpipes.block; +import com.refinedmods.refinedpipes.blockentity.ItemPipeBlockEntity; import com.refinedmods.refinedpipes.network.pipe.item.ItemPipeType; import com.refinedmods.refinedpipes.network.pipe.shape.PipeShapeCache; -import com.refinedmods.refinedpipes.tile.ItemPipeTileEntity; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; @@ -31,17 +31,17 @@ public ItemPipeType getType() { @Override protected boolean hasConnection(LevelAccessor world, BlockPos pos, Direction direction) { - BlockEntity currentTile = world.getBlockEntity(pos); - if (currentTile instanceof ItemPipeTileEntity && - ((ItemPipeTileEntity) currentTile).getAttachmentManager().hasAttachment(direction)) { + BlockEntity currentBlockEntity = world.getBlockEntity(pos); + if (currentBlockEntity instanceof ItemPipeBlockEntity && + ((ItemPipeBlockEntity) currentBlockEntity).getAttachmentManager().hasAttachment(direction)) { return false; } BlockState facingState = world.getBlockState(pos.relative(direction)); - BlockEntity facingTile = world.getBlockEntity(pos.relative(direction)); + BlockEntity facingBlockEntity = world.getBlockEntity(pos.relative(direction)); - if (facingTile instanceof ItemPipeTileEntity && - ((ItemPipeTileEntity) facingTile).getAttachmentManager().hasAttachment(direction.getOpposite())) { + if (facingBlockEntity instanceof ItemPipeBlockEntity && + ((ItemPipeBlockEntity) facingBlockEntity).getAttachmentManager().hasAttachment(direction.getOpposite())) { return false; } @@ -50,20 +50,20 @@ protected boolean hasConnection(LevelAccessor world, BlockPos pos, Direction dir @Override protected boolean hasInvConnection(LevelAccessor world, BlockPos pos, Direction direction) { - BlockEntity facingTile = world.getBlockEntity(pos.relative(direction)); + BlockEntity facingBlockEntity = world.getBlockEntity(pos.relative(direction)); - return facingTile != null - && facingTile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, direction.getOpposite()).isPresent(); + return facingBlockEntity != null + && facingBlockEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, direction.getOpposite()).isPresent(); } @Override public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { - return new ItemPipeTileEntity(pos, state, type); + return new ItemPipeBlockEntity(pos, state, type); } @Nullable @Override public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType type) { - return level.isClientSide ? (levelTicker, pos, stateTicker, blockEntity) -> ItemPipeTileEntity.tick((ItemPipeTileEntity) blockEntity) : null; + return level.isClientSide ? (levelTicker, pos, stateTicker, blockEntity) -> ItemPipeBlockEntity.tick((ItemPipeBlockEntity) blockEntity) : null; } } diff --git a/src/main/java/com/refinedmods/refinedpipes/block/PipeBlock.java b/src/main/java/com/refinedmods/refinedpipes/block/PipeBlock.java index b8b748c..141f626 100644 --- a/src/main/java/com/refinedmods/refinedpipes/block/PipeBlock.java +++ b/src/main/java/com/refinedmods/refinedpipes/block/PipeBlock.java @@ -1,5 +1,6 @@ package com.refinedmods.refinedpipes.block; +import com.refinedmods.refinedpipes.blockentity.PipeBlockEntity; import com.refinedmods.refinedpipes.item.AttachmentItem; import com.refinedmods.refinedpipes.network.NetworkManager; import com.refinedmods.refinedpipes.network.pipe.Pipe; @@ -8,7 +9,6 @@ import com.refinedmods.refinedpipes.network.pipe.attachment.AttachmentManager; import com.refinedmods.refinedpipes.network.pipe.shape.PipeShapeCache; import com.refinedmods.refinedpipes.network.pipe.shape.PipeShapeProps; -import com.refinedmods.refinedpipes.tile.PipeTileEntity; import com.refinedmods.refinedpipes.util.Raytracer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -75,42 +75,42 @@ protected void createBlockStateDefinition(StateDefinition.Builder type, BlockPos pos, BlockState state) { +public abstract class BaseBlockEntity extends BlockEntity { + protected BaseBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state); } diff --git a/src/main/java/com/refinedmods/refinedpipes/tile/EnergyPipeTileEntity.java b/src/main/java/com/refinedmods/refinedpipes/blockentity/EnergyPipeBlockEntity.java similarity index 81% rename from src/main/java/com/refinedmods/refinedpipes/tile/EnergyPipeTileEntity.java rename to src/main/java/com/refinedmods/refinedpipes/blockentity/EnergyPipeBlockEntity.java index 50c7b0d..0ca1976 100644 --- a/src/main/java/com/refinedmods/refinedpipes/tile/EnergyPipeTileEntity.java +++ b/src/main/java/com/refinedmods/refinedpipes/blockentity/EnergyPipeBlockEntity.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedpipes.tile; +package com.refinedmods.refinedpipes.blockentity; import com.refinedmods.refinedpipes.network.NetworkManager; import com.refinedmods.refinedpipes.network.pipe.Pipe; @@ -16,12 +16,12 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class EnergyPipeTileEntity extends PipeTileEntity { +public class EnergyPipeBlockEntity extends PipeBlockEntity { private final EnergyPipeType type; private final LazyOptional clientEnergyStorage; - public EnergyPipeTileEntity(BlockPos pos, BlockState state, EnergyPipeType type) { - super(type.getTileType(), pos, state); + public EnergyPipeBlockEntity(BlockPos pos, BlockState state, EnergyPipeType type) { + super(type.getBlockEntityType(), pos, state); this.type = type; this.clientEnergyStorage = LazyOptional.of(() -> new ClientEnergyPipeEnergyStorage(type)); @@ -47,7 +47,7 @@ public LazyOptional getCapability(@Nonnull Capability cap, @Nullable D } @Override - protected Pipe createPipe(Level world, BlockPos pos) { - return new EnergyPipe(world, pos, type); + protected Pipe createPipe(Level level, BlockPos pos) { + return new EnergyPipe(level, pos, type); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/tile/FluidPipeTileEntity.java b/src/main/java/com/refinedmods/refinedpipes/blockentity/FluidPipeBlockEntity.java similarity index 87% rename from src/main/java/com/refinedmods/refinedpipes/tile/FluidPipeTileEntity.java rename to src/main/java/com/refinedmods/refinedpipes/blockentity/FluidPipeBlockEntity.java index 705de8c..3a42bfe 100644 --- a/src/main/java/com/refinedmods/refinedpipes/tile/FluidPipeTileEntity.java +++ b/src/main/java/com/refinedmods/refinedpipes/blockentity/FluidPipeBlockEntity.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedpipes.tile; +package com.refinedmods.refinedpipes.blockentity; import com.refinedmods.refinedpipes.network.NetworkManager; import com.refinedmods.refinedpipes.network.fluid.FluidNetwork; @@ -13,15 +13,15 @@ import javax.annotation.Nullable; -public class FluidPipeTileEntity extends PipeTileEntity { +public class FluidPipeBlockEntity extends PipeBlockEntity { private final FluidPipeType type; private FluidStack fluid = FluidStack.EMPTY; private float fullness = 0; private float renderFullness = 0; - public FluidPipeTileEntity(BlockPos pos, BlockState state, FluidPipeType type) { - super(type.getTileType(), pos, state); + public FluidPipeBlockEntity(BlockPos pos, BlockState state, FluidPipeType type) { + super(type.getBlockEntityType(), pos, state); this.type = type; } @@ -89,7 +89,7 @@ public void setFullness(float fullness) { } @Override - protected Pipe createPipe(Level world, BlockPos pos) { - return new FluidPipe(world, pos, type); + protected Pipe createPipe(Level level, BlockPos pos) { + return new FluidPipe(level, pos, type); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/tile/ItemPipeTileEntity.java b/src/main/java/com/refinedmods/refinedpipes/blockentity/ItemPipeBlockEntity.java similarity index 75% rename from src/main/java/com/refinedmods/refinedpipes/tile/ItemPipeTileEntity.java rename to src/main/java/com/refinedmods/refinedpipes/blockentity/ItemPipeBlockEntity.java index 7efb46b..a003c5d 100644 --- a/src/main/java/com/refinedmods/refinedpipes/tile/ItemPipeTileEntity.java +++ b/src/main/java/com/refinedmods/refinedpipes/blockentity/ItemPipeBlockEntity.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedpipes.tile; +package com.refinedmods.refinedpipes.blockentity; import com.refinedmods.refinedpipes.network.pipe.Pipe; import com.refinedmods.refinedpipes.network.pipe.item.ItemPipe; @@ -13,16 +13,16 @@ import java.util.ArrayList; import java.util.List; -public class ItemPipeTileEntity extends PipeTileEntity { +public class ItemPipeBlockEntity extends PipeBlockEntity { private final ItemPipeType type; private List props = new ArrayList<>(); - public ItemPipeTileEntity(BlockPos pos, BlockState state, ItemPipeType type) { - super(type.getTileType(), pos, state); + public ItemPipeBlockEntity(BlockPos pos, BlockState state, ItemPipeType type) { + super(type.getBlockEntityType(), pos, state); this.type = type; } - public static void tick(ItemPipeTileEntity blockEntity) { + public static void tick(ItemPipeBlockEntity blockEntity) { blockEntity.props.forEach(ItemTransportProps::tick); } @@ -44,7 +44,7 @@ protected void spawnDrops(Pipe pipe) { } @Override - protected Pipe createPipe(Level world, BlockPos pos) { - return new ItemPipe(world, pos, type); + protected Pipe createPipe(Level level, BlockPos pos) { + return new ItemPipe(level, pos, type); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/tile/PipeTileEntity.java b/src/main/java/com/refinedmods/refinedpipes/blockentity/PipeBlockEntity.java similarity index 92% rename from src/main/java/com/refinedmods/refinedpipes/tile/PipeTileEntity.java rename to src/main/java/com/refinedmods/refinedpipes/blockentity/PipeBlockEntity.java index 9b33aa8..c7ae5bb 100644 --- a/src/main/java/com/refinedmods/refinedpipes/tile/PipeTileEntity.java +++ b/src/main/java/com/refinedmods/refinedpipes/blockentity/PipeBlockEntity.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedpipes.tile; +package com.refinedmods.refinedpipes.blockentity; import com.refinedmods.refinedpipes.network.NetworkManager; import com.refinedmods.refinedpipes.network.pipe.Pipe; @@ -20,11 +20,11 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -public abstract class PipeTileEntity extends BaseTileEntity { +public abstract class PipeBlockEntity extends BaseBlockEntity { public static final ModelProperty ATTACHMENTS_PROPERTY = new ModelProperty<>(); private final AttachmentManager clientAttachmentManager = new ClientAttachmentManager(); - protected PipeTileEntity(BlockEntityType type, BlockPos pos, BlockState state) { + protected PipeBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state); } @@ -110,5 +110,5 @@ public void readUpdate(@Nullable CompoundTag tag) { level.sendBlockUpdated(worldPosition, state, state, 1 | 2); } - protected abstract Pipe createPipe(Level world, BlockPos pos); + protected abstract Pipe createPipe(Level level, BlockPos pos); } diff --git a/src/main/java/com/refinedmods/refinedpipes/container/BaseContainer.java b/src/main/java/com/refinedmods/refinedpipes/container/BaseContainerMenu.java similarity index 96% rename from src/main/java/com/refinedmods/refinedpipes/container/BaseContainer.java rename to src/main/java/com/refinedmods/refinedpipes/container/BaseContainerMenu.java index be2f7f9..0c6711c 100644 --- a/src/main/java/com/refinedmods/refinedpipes/container/BaseContainer.java +++ b/src/main/java/com/refinedmods/refinedpipes/container/BaseContainerMenu.java @@ -17,12 +17,12 @@ import java.util.ArrayList; import java.util.List; -public class BaseContainer extends AbstractContainerMenu { +public class BaseContainerMenu extends AbstractContainerMenu { private final List fluidSlots = new ArrayList<>(); private final List fluids = new ArrayList<>(); private final Player player; - protected BaseContainer(@Nullable MenuType type, int windowId, Player player) { + protected BaseContainerMenu(@Nullable MenuType type, int windowId, Player player) { super(type, windowId); this.player = player; diff --git a/src/main/java/com/refinedmods/refinedpipes/container/ExtractorAttachmentContainer.java b/src/main/java/com/refinedmods/refinedpipes/container/ExtractorAttachmentContainerMenu.java similarity index 96% rename from src/main/java/com/refinedmods/refinedpipes/container/ExtractorAttachmentContainer.java rename to src/main/java/com/refinedmods/refinedpipes/container/ExtractorAttachmentContainerMenu.java index 942d75a..6047e8c 100644 --- a/src/main/java/com/refinedmods/refinedpipes/container/ExtractorAttachmentContainer.java +++ b/src/main/java/com/refinedmods/refinedpipes/container/ExtractorAttachmentContainerMenu.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedpipes.container; import com.refinedmods.refinedpipes.RefinedPipes; -import com.refinedmods.refinedpipes.RefinedPipesContainers; +import com.refinedmods.refinedpipes.RefinedPipesContainerMenus; import com.refinedmods.refinedpipes.container.slot.FilterSlot; import com.refinedmods.refinedpipes.container.slot.FluidFilterSlot; import com.refinedmods.refinedpipes.inventory.fluid.FluidInventory; @@ -21,7 +21,7 @@ import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.SlotItemHandler; -public class ExtractorAttachmentContainer extends BaseContainer { +public class ExtractorAttachmentContainerMenu extends BaseContainerMenu { private final BlockPos pos; private final Direction dir; private final ExtractorAttachmentType extractorAttachmentType; @@ -33,7 +33,7 @@ public class ExtractorAttachmentContainer extends BaseContainer { private int stackSize; private boolean exactMode; - public ExtractorAttachmentContainer( + public ExtractorAttachmentContainerMenu( int windowId, Player player, BlockPos pos, @@ -47,7 +47,7 @@ public ExtractorAttachmentContainer( ItemStackHandler itemFilter, FluidInventory fluidFilter, boolean fluidMode) { - super(RefinedPipesContainers.EXTRACTOR_ATTACHMENT, windowId, player); + super(RefinedPipesContainerMenus.EXTRACTOR_ATTACHMENT, windowId, player); addPlayerInventory(8, 111); diff --git a/src/main/java/com/refinedmods/refinedpipes/container/factory/ExtractorAttachmentContainerFactory.java b/src/main/java/com/refinedmods/refinedpipes/container/factory/ExtractorAttachmentContainerFactory.java index 548843a..6cb373b 100644 --- a/src/main/java/com/refinedmods/refinedpipes/container/factory/ExtractorAttachmentContainerFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/container/factory/ExtractorAttachmentContainerFactory.java @@ -1,16 +1,16 @@ package com.refinedmods.refinedpipes.container.factory; -import com.refinedmods.refinedpipes.container.ExtractorAttachmentContainer; +import com.refinedmods.refinedpipes.container.ExtractorAttachmentContainerMenu; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.*; import com.refinedmods.refinedpipes.util.DirectionUtil; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.network.IContainerFactory; -public class ExtractorAttachmentContainerFactory implements IContainerFactory { +public class ExtractorAttachmentContainerFactory implements IContainerFactory { @Override - public ExtractorAttachmentContainer create(int windowId, Inventory inv, FriendlyByteBuf buf) { - return new ExtractorAttachmentContainer( + public ExtractorAttachmentContainerMenu create(int windowId, Inventory inv, FriendlyByteBuf buf) { + return new ExtractorAttachmentContainerMenu( windowId, inv.player, buf.readBlockPos(), diff --git a/src/main/java/com/refinedmods/refinedpipes/container/provider/ExtractorAttachmentContainerProvider.java b/src/main/java/com/refinedmods/refinedpipes/container/provider/ExtractorAttachmentMenuProvider.java similarity index 87% rename from src/main/java/com/refinedmods/refinedpipes/container/provider/ExtractorAttachmentContainerProvider.java rename to src/main/java/com/refinedmods/refinedpipes/container/provider/ExtractorAttachmentMenuProvider.java index c93f941..6e0b0a5 100644 --- a/src/main/java/com/refinedmods/refinedpipes/container/provider/ExtractorAttachmentContainerProvider.java +++ b/src/main/java/com/refinedmods/refinedpipes/container/provider/ExtractorAttachmentMenuProvider.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedpipes.container.provider; import com.refinedmods.refinedpipes.RefinedPipes; -import com.refinedmods.refinedpipes.container.ExtractorAttachmentContainer; +import com.refinedmods.refinedpipes.container.ExtractorAttachmentContainerMenu; import com.refinedmods.refinedpipes.network.pipe.Pipe; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.ExtractorAttachment; import net.minecraft.network.chat.Component; @@ -15,17 +15,17 @@ import javax.annotation.Nullable; -public class ExtractorAttachmentContainerProvider implements MenuProvider { +public class ExtractorAttachmentMenuProvider implements MenuProvider { private final Pipe pipe; private final ExtractorAttachment attachment; - public ExtractorAttachmentContainerProvider(Pipe pipe, ExtractorAttachment attachment) { + public ExtractorAttachmentMenuProvider(Pipe pipe, ExtractorAttachment attachment) { this.pipe = pipe; this.attachment = attachment; } public static void open(Pipe pipe, ExtractorAttachment attachment, ServerPlayer player) { - ExtractorAttachmentContainerProvider provider = new ExtractorAttachmentContainerProvider(pipe, attachment); + ExtractorAttachmentMenuProvider provider = new ExtractorAttachmentMenuProvider(pipe, attachment); NetworkHooks.openGui(player, provider, buf -> { buf.writeBlockPos(pipe.getPos()); @@ -48,7 +48,7 @@ public Component getDisplayName() { @Nullable @Override public AbstractContainerMenu createMenu(int windowId, Inventory inv, Player player) { - return new ExtractorAttachmentContainer( + return new ExtractorAttachmentContainerMenu( windowId, player, pipe.getPos(), diff --git a/src/main/java/com/refinedmods/refinedpipes/item/AttachmentItem.java b/src/main/java/com/refinedmods/refinedpipes/item/AttachmentItem.java index 925e5ec..e49de8f 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/AttachmentItem.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/AttachmentItem.java @@ -23,8 +23,8 @@ public AttachmentItem(AttachmentFactory type) { } @Override - public void appendHoverText(ItemStack stack, @Nullable Level world, List tooltip, TooltipFlag flag) { - super.appendHoverText(stack, world, tooltip, flag); + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltip, TooltipFlag flag) { + super.appendHoverText(stack, level, tooltip, flag); type.addInformation(tooltip); } diff --git a/src/main/java/com/refinedmods/refinedpipes/item/EnergyPipeBlockItem.java b/src/main/java/com/refinedmods/refinedpipes/item/EnergyPipeBlockItem.java index f79bf7e..09afd33 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/EnergyPipeBlockItem.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/EnergyPipeBlockItem.java @@ -24,8 +24,8 @@ public EnergyPipeBlockItem(EnergyPipeBlock block) { } @Override - public void appendHoverText(ItemStack stack, @Nullable Level world, List tooltip, TooltipFlag flag) { - super.appendHoverText(stack, world, tooltip, flag); + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltip, TooltipFlag flag) { + super.appendHoverText(stack, level, tooltip, flag); tooltip.add(new TranslatableComponent("misc.refinedpipes.tier", new TranslatableComponent("enchantment.level." + type.getTier())).withStyle(ChatFormatting.YELLOW)); diff --git a/src/main/java/com/refinedmods/refinedpipes/item/FluidPipeBlockItem.java b/src/main/java/com/refinedmods/refinedpipes/item/FluidPipeBlockItem.java index 2227c9d..062d57b 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/FluidPipeBlockItem.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/FluidPipeBlockItem.java @@ -24,8 +24,8 @@ public FluidPipeBlockItem(FluidPipeBlock block) { } @Override - public void appendHoverText(ItemStack stack, @Nullable Level world, List tooltip, TooltipFlag flag) { - super.appendHoverText(stack, world, tooltip, flag); + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltip, TooltipFlag flag) { + super.appendHoverText(stack, level, tooltip, flag); tooltip.add(new TranslatableComponent("misc.refinedpipes.tier", new TranslatableComponent("enchantment.level." + type.getTier())).withStyle(ChatFormatting.YELLOW)); diff --git a/src/main/java/com/refinedmods/refinedpipes/item/ItemPipeBlockItem.java b/src/main/java/com/refinedmods/refinedpipes/item/ItemPipeBlockItem.java index 4e75583..91fe363 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/ItemPipeBlockItem.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/ItemPipeBlockItem.java @@ -23,8 +23,8 @@ public ItemPipeBlockItem(ItemPipeBlock block) { } @Override - public void appendHoverText(ItemStack stack, @Nullable Level world, List tooltip, TooltipFlag flag) { - super.appendHoverText(stack, world, tooltip, flag); + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltip, TooltipFlag flag) { + super.appendHoverText(stack, level, tooltip, flag); tooltip.add(new TranslatableComponent("misc.refinedpipes.tier", new TranslatableComponent("enchantment.level." + type.getTier())).withStyle(ChatFormatting.YELLOW)); diff --git a/src/main/java/com/refinedmods/refinedpipes/item/group/MainItemGroup.java b/src/main/java/com/refinedmods/refinedpipes/item/creativetab/MainCreativeModeTab.java similarity index 70% rename from src/main/java/com/refinedmods/refinedpipes/item/group/MainItemGroup.java rename to src/main/java/com/refinedmods/refinedpipes/item/creativetab/MainCreativeModeTab.java index aa15029..c762922 100644 --- a/src/main/java/com/refinedmods/refinedpipes/item/group/MainItemGroup.java +++ b/src/main/java/com/refinedmods/refinedpipes/item/creativetab/MainCreativeModeTab.java @@ -1,12 +1,12 @@ -package com.refinedmods.refinedpipes.item.group; +package com.refinedmods.refinedpipes.item.creativetab; import com.refinedmods.refinedpipes.RefinedPipes; import com.refinedmods.refinedpipes.RefinedPipesItems; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; -public class MainItemGroup extends CreativeModeTab { - public MainItemGroup() { +public class MainCreativeModeTab extends CreativeModeTab { + public MainCreativeModeTab() { super(RefinedPipes.ID); } diff --git a/src/main/java/com/refinedmods/refinedpipes/message/ChangeBlacklistWhitelistMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/ChangeBlacklistWhitelistMessage.java index f276e51..8e68f82 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/ChangeBlacklistWhitelistMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/ChangeBlacklistWhitelistMessage.java @@ -1,10 +1,10 @@ package com.refinedmods.refinedpipes.message; +import com.refinedmods.refinedpipes.blockentity.PipeBlockEntity; import com.refinedmods.refinedpipes.network.NetworkManager; import com.refinedmods.refinedpipes.network.pipe.attachment.Attachment; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.BlacklistWhitelist; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.ExtractorAttachment; -import com.refinedmods.refinedpipes.tile.PipeTileEntity; import com.refinedmods.refinedpipes.util.DirectionUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -41,15 +41,15 @@ public static ChangeBlacklistWhitelistMessage decode(FriendlyByteBuf buf) { public static void handle(ChangeBlacklistWhitelistMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - BlockEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); + BlockEntity blockEntity = ctx.get().getSender().level.getBlockEntity(message.pos); - if (tile instanceof PipeTileEntity) { - Attachment attachment = ((PipeTileEntity) tile).getAttachmentManager().getAttachment(message.direction); + if (blockEntity instanceof PipeBlockEntity) { + Attachment attachment = ((PipeBlockEntity) blockEntity).getAttachmentManager().getAttachment(message.direction); if (attachment instanceof ExtractorAttachment) { ((ExtractorAttachment) attachment).setBlacklistWhitelist(message.blacklistWhitelist); - NetworkManager.get(tile.getLevel()).setDirty(); + NetworkManager.get(blockEntity.getLevel()).setDirty(); } } }); diff --git a/src/main/java/com/refinedmods/refinedpipes/message/ChangeExactModeMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/ChangeExactModeMessage.java index d7c84cb..2049a46 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/ChangeExactModeMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/ChangeExactModeMessage.java @@ -1,9 +1,9 @@ package com.refinedmods.refinedpipes.message; +import com.refinedmods.refinedpipes.blockentity.PipeBlockEntity; import com.refinedmods.refinedpipes.network.NetworkManager; import com.refinedmods.refinedpipes.network.pipe.attachment.Attachment; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.ExtractorAttachment; -import com.refinedmods.refinedpipes.tile.PipeTileEntity; import com.refinedmods.refinedpipes.util.DirectionUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -40,15 +40,15 @@ public static ChangeExactModeMessage decode(FriendlyByteBuf buf) { public static void handle(ChangeExactModeMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - BlockEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); + BlockEntity blockEntity = ctx.get().getSender().level.getBlockEntity(message.pos); - if (tile instanceof PipeTileEntity) { - Attachment attachment = ((PipeTileEntity) tile).getAttachmentManager().getAttachment(message.direction); + if (blockEntity instanceof PipeBlockEntity) { + Attachment attachment = ((PipeBlockEntity) blockEntity).getAttachmentManager().getAttachment(message.direction); if (attachment instanceof ExtractorAttachment) { ((ExtractorAttachment) attachment).setExactMode(message.exactMode); - NetworkManager.get(tile.getLevel()).setDirty(); + NetworkManager.get(blockEntity.getLevel()).setDirty(); } } }); diff --git a/src/main/java/com/refinedmods/refinedpipes/message/ChangeRedstoneModeMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/ChangeRedstoneModeMessage.java index 6274a4a..0ae2213 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/ChangeRedstoneModeMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/ChangeRedstoneModeMessage.java @@ -1,10 +1,10 @@ package com.refinedmods.refinedpipes.message; +import com.refinedmods.refinedpipes.blockentity.PipeBlockEntity; import com.refinedmods.refinedpipes.network.NetworkManager; import com.refinedmods.refinedpipes.network.pipe.attachment.Attachment; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.ExtractorAttachment; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.RedstoneMode; -import com.refinedmods.refinedpipes.tile.PipeTileEntity; import com.refinedmods.refinedpipes.util.DirectionUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -41,15 +41,15 @@ public static ChangeRedstoneModeMessage decode(FriendlyByteBuf buf) { public static void handle(ChangeRedstoneModeMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - BlockEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); + BlockEntity blockEntity = ctx.get().getSender().level.getBlockEntity(message.pos); - if (tile instanceof PipeTileEntity) { - Attachment attachment = ((PipeTileEntity) tile).getAttachmentManager().getAttachment(message.direction); + if (blockEntity instanceof PipeBlockEntity) { + Attachment attachment = ((PipeBlockEntity) blockEntity).getAttachmentManager().getAttachment(message.direction); if (attachment instanceof ExtractorAttachment) { ((ExtractorAttachment) attachment).setRedstoneMode(message.redstoneMode); - NetworkManager.get(tile.getLevel()).setDirty(); + NetworkManager.get(blockEntity.getLevel()).setDirty(); } } }); diff --git a/src/main/java/com/refinedmods/refinedpipes/message/ChangeRoutingModeMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/ChangeRoutingModeMessage.java index 08619ea..3b0d627 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/ChangeRoutingModeMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/ChangeRoutingModeMessage.java @@ -1,10 +1,10 @@ package com.refinedmods.refinedpipes.message; +import com.refinedmods.refinedpipes.blockentity.PipeBlockEntity; import com.refinedmods.refinedpipes.network.NetworkManager; import com.refinedmods.refinedpipes.network.pipe.attachment.Attachment; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.ExtractorAttachment; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.RoutingMode; -import com.refinedmods.refinedpipes.tile.PipeTileEntity; import com.refinedmods.refinedpipes.util.DirectionUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -41,15 +41,15 @@ public static ChangeRoutingModeMessage decode(FriendlyByteBuf buf) { public static void handle(ChangeRoutingModeMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - BlockEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); + BlockEntity blockEntity = ctx.get().getSender().level.getBlockEntity(message.pos); - if (tile instanceof PipeTileEntity) { - Attachment attachment = ((PipeTileEntity) tile).getAttachmentManager().getAttachment(message.direction); + if (blockEntity instanceof PipeBlockEntity) { + Attachment attachment = ((PipeBlockEntity) blockEntity).getAttachmentManager().getAttachment(message.direction); if (attachment instanceof ExtractorAttachment) { ((ExtractorAttachment) attachment).setRoutingMode(message.routingMode); - NetworkManager.get(tile.getLevel()).setDirty(); + NetworkManager.get(blockEntity.getLevel()).setDirty(); } } }); diff --git a/src/main/java/com/refinedmods/refinedpipes/message/ChangeStackSizeMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/ChangeStackSizeMessage.java index 67de0bc..851fc36 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/ChangeStackSizeMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/ChangeStackSizeMessage.java @@ -1,9 +1,9 @@ package com.refinedmods.refinedpipes.message; +import com.refinedmods.refinedpipes.blockentity.PipeBlockEntity; import com.refinedmods.refinedpipes.network.NetworkManager; import com.refinedmods.refinedpipes.network.pipe.attachment.Attachment; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.ExtractorAttachment; -import com.refinedmods.refinedpipes.tile.PipeTileEntity; import com.refinedmods.refinedpipes.util.DirectionUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -40,15 +40,15 @@ public static ChangeStackSizeMessage decode(FriendlyByteBuf buf) { public static void handle(ChangeStackSizeMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - BlockEntity tile = ctx.get().getSender().level.getBlockEntity(message.pos); + BlockEntity blockEntity = ctx.get().getSender().level.getBlockEntity(message.pos); - if (tile instanceof PipeTileEntity) { - Attachment attachment = ((PipeTileEntity) tile).getAttachmentManager().getAttachment(message.direction); + if (blockEntity instanceof PipeBlockEntity) { + Attachment attachment = ((PipeBlockEntity) blockEntity).getAttachmentManager().getAttachment(message.direction); if (attachment instanceof ExtractorAttachment) { ((ExtractorAttachment) attachment).setStackSize(message.stackSize); - NetworkManager.get(tile.getLevel()).setDirty(); + NetworkManager.get(blockEntity.getLevel()).setDirty(); } } }); diff --git a/src/main/java/com/refinedmods/refinedpipes/message/FluidPipeMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/FluidPipeMessage.java index e27537e..7ef4ce1 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/FluidPipeMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/FluidPipeMessage.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedpipes.message; -import com.refinedmods.refinedpipes.tile.FluidPipeTileEntity; +import com.refinedmods.refinedpipes.blockentity.FluidPipeBlockEntity; import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.network.FriendlyByteBuf; @@ -40,11 +40,11 @@ public static FluidPipeMessage decode(FriendlyByteBuf buf) { public static void handle(FluidPipeMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - BlockEntity tile = Minecraft.getInstance().level.getBlockEntity(message.pos); + BlockEntity blockEntity = Minecraft.getInstance().level.getBlockEntity(message.pos); - if (tile instanceof FluidPipeTileEntity) { - ((FluidPipeTileEntity) tile).setFluid(message.fluid); - ((FluidPipeTileEntity) tile).setFullness(message.fullness); + if (blockEntity instanceof FluidPipeBlockEntity) { + ((FluidPipeBlockEntity) blockEntity).setFluid(message.fluid); + ((FluidPipeBlockEntity) blockEntity).setFullness(message.fullness); } }); diff --git a/src/main/java/com/refinedmods/refinedpipes/message/ItemTransportMessage.java b/src/main/java/com/refinedmods/refinedpipes/message/ItemTransportMessage.java index c8a2622..ed48c00 100644 --- a/src/main/java/com/refinedmods/refinedpipes/message/ItemTransportMessage.java +++ b/src/main/java/com/refinedmods/refinedpipes/message/ItemTransportMessage.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedpipes.message; +import com.refinedmods.refinedpipes.blockentity.ItemPipeBlockEntity; import com.refinedmods.refinedpipes.network.pipe.transport.ItemTransportProps; -import com.refinedmods.refinedpipes.tile.ItemPipeTileEntity; import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.network.FriendlyByteBuf; @@ -42,10 +42,10 @@ public static ItemTransportMessage decode(FriendlyByteBuf buf) { public static void handle(ItemTransportMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { - BlockEntity tile = Minecraft.getInstance().level.getBlockEntity(message.pos); + BlockEntity blockEntity = Minecraft.getInstance().level.getBlockEntity(message.pos); - if (tile instanceof ItemPipeTileEntity) { - ((ItemPipeTileEntity) tile).setProps(message.props); + if (blockEntity instanceof ItemPipeBlockEntity) { + ((ItemPipeBlockEntity) blockEntity).setProps(message.props); } }); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/Network.java b/src/main/java/com/refinedmods/refinedpipes/network/Network.java index dcdc5b7..8d4484e 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/Network.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/Network.java @@ -32,8 +32,8 @@ public String getId() { return id; } - public NetworkGraphScannerResult scanGraph(Level world, BlockPos pos) { - return graph.scan(world, pos); + public NetworkGraphScannerResult scanGraph(Level level, BlockPos pos) { + return graph.scan(level, pos); } public List getDestinations(DestinationType type) { @@ -47,11 +47,11 @@ public CompoundTag writeToNbt(CompoundTag tag) { return tag; } - public void update(Level world) { + public void update(Level level) { if (!didDoInitialScan) { didDoInitialScan = true; - scanGraph(world, originPos); + scanGraph(level, originPos); } graph.getPipes().forEach(Pipe::update); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/NetworkManager.java b/src/main/java/com/refinedmods/refinedpipes/network/NetworkManager.java index 694d324..3d2c235 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/NetworkManager.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/NetworkManager.java @@ -24,24 +24,24 @@ public class NetworkManager extends SavedData { private static final String NAME = RefinedPipes.ID + "_networks"; private static final Logger LOGGER = LogManager.getLogger(NetworkManager.class); - private final Level world; + private final Level level; private final Map networks = new HashMap<>(); private final Map pipes = new HashMap<>(); - public NetworkManager(Level world) { - this.world = world; + public NetworkManager(Level level) { + this.level = level; } - public static NetworkManager get(Level world) { - return get((ServerLevel) world); + public static NetworkManager get(Level level) { + return get((ServerLevel) level); } - public static NetworkManager get(ServerLevel world) { - return world.getDataStorage().computeIfAbsent((tag) -> { - NetworkManager networkManager = new NetworkManager(world); + public static NetworkManager get(ServerLevel level) { + return level.getDataStorage().computeIfAbsent((tag) -> { + NetworkManager networkManager = new NetworkManager(level); networkManager.load(tag); return networkManager; - }, () -> new NetworkManager(world), NAME); + }, () -> new NetworkManager(level), NAME); } public void addNetwork(Network network) { @@ -68,15 +68,15 @@ public void removeNetwork(String id) { setDirty(); } - private void formNetworkAt(Level world, BlockPos pos, ResourceLocation type) { + private void formNetworkAt(Level level, BlockPos pos, ResourceLocation type) { Network network = NetworkRegistry.INSTANCE.getFactory(type).create(pos); addNetwork(network); - network.scanGraph(world, pos); + network.scanGraph(level, pos); } - private void mergeNetworksIntoOne(Set candidates, Level world, BlockPos pos) { + private void mergeNetworksIntoOne(Set candidates, Level level, BlockPos pos) { if (candidates.isEmpty()) { throw new RuntimeException("Cannot merge networks: no candidates"); } @@ -110,7 +110,7 @@ private void mergeNetworksIntoOne(Set candidates, Level world, BlockPos po } } - mainNetwork.scanGraph(world, pos); + mainNetwork.scanGraph(level, pos); mergedNetworks.forEach(n -> n.onMergedWith(mainNetwork)); } @@ -129,9 +129,9 @@ public void addPipe(Pipe pipe) { Set adjacentPipes = findAdjacentPipes(pipe.getPos(), pipe.getNetworkType()); if (adjacentPipes.isEmpty()) { - formNetworkAt(pipe.getWorld(), pipe.getPos(), pipe.getNetworkType()); + formNetworkAt(pipe.getLevel(), pipe.getPos(), pipe.getNetworkType()); } else { - mergeNetworksIntoOne(adjacentPipes, pipe.getWorld(), pipe.getPos()); + mergeNetworksIntoOne(adjacentPipes, pipe.getLevel(), pipe.getPos()); } } @@ -177,7 +177,7 @@ private void splitNetworks(Pipe originPipe) { setDirty(); NetworkGraphScannerResult result = otherPipeInNetwork.getNetwork().scanGraph( - otherPipeInNetwork.getWorld(), + otherPipeInNetwork.getLevel(), otherPipeInNetwork.getPos() ); @@ -195,7 +195,7 @@ private void splitNetworks(Pipe originPipe) { // The formNetworkAt call below can let these removed pipes join a network again. // We only have to form a new network when necessary, hence the null check. if (removed.getNetwork() == null) { - formNetworkAt(removed.getWorld(), removed.getPos(), removed.getNetworkType()); + formNetworkAt(removed.getLevel(), removed.getPos(), removed.getNetworkType()); } } @@ -259,7 +259,7 @@ public void load(CompoundTag tag) { continue; } - Pipe pipe = factory.createFromNbt(world, pipeTagCompound); + Pipe pipe = factory.createFromNbt(level, pipeTagCompound); this.pipes.put(pipe.getPos(), pipe); } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetwork.java b/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetwork.java index cd549e8..0934340 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetwork.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/energy/EnergyNetwork.java @@ -28,8 +28,8 @@ public EnergyNetwork(BlockPos originPos, String id, EnergyPipeType pipeType) { } @Override - public NetworkGraphScannerResult scanGraph(Level world, BlockPos pos) { - NetworkGraphScannerResult result = super.scanGraph(world, pos); + public NetworkGraphScannerResult scanGraph(Level level, BlockPos pos) { + NetworkGraphScannerResult result = super.scanGraph(level, pos); energyStorage.setCapacityAndMaxExtract( result.getFoundPipes() @@ -51,8 +51,8 @@ public EnergyStorage getEnergyStorage() { } @Override - public void update(Level world) { - super.update(world); + public void update(Level level) { + super.update(level); List destinations = graph.getDestinations(DestinationType.ENERGY_STORAGE); @@ -62,12 +62,12 @@ public void update(Level world) { } for (Destination destination : destinations) { - BlockEntity tile = destination.getConnectedPipe().getWorld().getBlockEntity(destination.getReceiver()); - if (tile == null) { + BlockEntity blockEntity = destination.getConnectedPipe().getLevel().getBlockEntity(destination.getReceiver()); + if (blockEntity == null) { continue; } - IEnergyStorage handler = tile.getCapability(CapabilityEnergy.ENERGY, destination.getIncomingDirection().getOpposite()).orElse(null); + IEnergyStorage handler = blockEntity.getCapability(CapabilityEnergy.ENERGY, destination.getIncomingDirection().getOpposite()).orElse(null); if (handler == null) { continue; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetwork.java b/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetwork.java index f8e8afb..6f4a1d8 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetwork.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/fluid/FluidNetwork.java @@ -35,8 +35,8 @@ public FluidTank getFluidTank() { } @Override - public NetworkGraphScannerResult scanGraph(Level world, BlockPos pos) { - NetworkGraphScannerResult result = super.scanGraph(world, pos); + public NetworkGraphScannerResult scanGraph(Level level, BlockPos pos) { + NetworkGraphScannerResult result = super.scanGraph(level, pos); fluidTank.setCapacity( result.getFoundPipes() @@ -54,8 +54,8 @@ public NetworkGraphScannerResult scanGraph(Level world, BlockPos pos) { } @Override - public void update(Level world) { - super.update(world); + public void update(Level level) { + super.update(level); List destinations = graph.getDestinations(DestinationType.FLUID_HANDLER); @@ -64,12 +64,12 @@ public void update(Level world) { } for (Destination destination : destinations) { - BlockEntity tile = destination.getConnectedPipe().getWorld().getBlockEntity(destination.getReceiver()); - if (tile == null) { + BlockEntity blockEntity = destination.getConnectedPipe().getLevel().getBlockEntity(destination.getReceiver()); + if (blockEntity == null) { continue; } - IFluidHandler handler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, destination.getIncomingDirection().getOpposite()).orElse(null); + IFluidHandler handler = blockEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, destination.getIncomingDirection().getOpposite()).orElse(null); if (handler == null) { continue; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScanner.java b/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScanner.java index 7629409..ea36475 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScanner.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScanner.java @@ -33,8 +33,8 @@ public NetworkGraphScanner(Set currentPipes, ResourceLocation requiredNetw this.requiredNetworkType = requiredNetworkType; } - public NetworkGraphScannerResult scanAt(Level world, BlockPos pos) { - addRequest(new NetworkGraphScannerRequest(world, pos, null, null)); + public NetworkGraphScannerResult scanAt(Level level, BlockPos pos) { + addRequest(new NetworkGraphScannerRequest(level, pos, null, null)); NetworkGraphScannerRequest request; while ((request = requests.poll()) != null) { @@ -51,7 +51,7 @@ public NetworkGraphScannerResult scanAt(Level world, BlockPos pos) { } private void singleScanAt(NetworkGraphScannerRequest request) { - Pipe pipe = NetworkManager.get(request.getWorld()).getPipe(request.getPos()); + Pipe pipe = NetworkManager.get(request.getLevel()).getPipe(request.getPos()); if (pipe != null) { if (!requiredNetworkType.equals(pipe.getNetworkType())) { @@ -69,32 +69,32 @@ private void singleScanAt(NetworkGraphScannerRequest request) { for (Direction dir : Direction.values()) { addRequest(new NetworkGraphScannerRequest( - request.getWorld(), + request.getLevel(), request.getPos().relative(dir), dir, request )); } } - } else if (request.getParent() != null) { // This can NOT be called on pipe positions! (causes problems with tiles getting invalidated/validates when it shouldn't) + } else if (request.getParent() != null) { // This can NOT be called on pipe positions! (causes problems with block entities getting invalidated/validates when it shouldn't) // We can NOT have the TE capability checks always run regardless of whether there was a pipe or not. // Otherwise we have this loop: pipe gets placed -> network gets scanned -> TEs get checked -> it might check the TE we just placed // -> the newly created TE can be created in immediate mode -> TE#validate is called again -> TE#remove is called again! - Pipe connectedPipe = NetworkManager.get(request.getWorld()).getPipe(request.getParent().getPos()); + Pipe connectedPipe = NetworkManager.get(request.getLevel()).getPipe(request.getParent().getPos()); // If this destination is connected to a pipe with an attachment, then this is not a valid destination. if (!connectedPipe.getAttachmentManager().hasAttachment(request.getDirection())) { - BlockEntity tile = request.getWorld().getBlockEntity(request.getPos()); + BlockEntity blockEntity = request.getLevel().getBlockEntity(request.getPos()); - if (tile != null) { - tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, request.getDirection().getOpposite()) + if (blockEntity != null) { + blockEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, request.getDirection().getOpposite()) .ifPresent(itemHandler -> destinations.add(new Destination(DestinationType.ITEM_HANDLER, request.getPos(), request.getDirection(), connectedPipe))); - tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, request.getDirection().getOpposite()) + blockEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, request.getDirection().getOpposite()) .ifPresent(fluidHandler -> destinations.add(new Destination(DestinationType.FLUID_HANDLER, request.getPos(), request.getDirection(), connectedPipe))); - tile.getCapability(CapabilityEnergy.ENERGY, request.getDirection().getOpposite()) + blockEntity.getCapability(CapabilityEnergy.ENERGY, request.getDirection().getOpposite()) .ifPresent(energyStorage -> { if (!(energyStorage instanceof EnergyPipeEnergyStorage)) { destinations.add(new Destination(DestinationType.ENERGY_STORAGE, request.getPos(), request.getDirection(), connectedPipe)); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScannerRequest.java b/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScannerRequest.java index 3e66e08..9c385c2 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScannerRequest.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/graph/NetworkGraphScannerRequest.java @@ -7,7 +7,7 @@ import javax.annotation.Nullable; public class NetworkGraphScannerRequest { - private final Level world; + private final Level level; private final BlockPos pos; @Nullable private final Direction direction; @@ -15,15 +15,15 @@ public class NetworkGraphScannerRequest { private final NetworkGraphScannerRequest parent; private boolean successful; - public NetworkGraphScannerRequest(Level world, BlockPos pos, @Nullable Direction direction, @Nullable NetworkGraphScannerRequest parent) { - this.world = world; + public NetworkGraphScannerRequest(Level level, BlockPos pos, @Nullable Direction direction, @Nullable NetworkGraphScannerRequest parent) { + this.level = level; this.pos = pos; this.direction = direction; this.parent = parent; } - public Level getWorld() { - return world; + public Level getLevel() { + return level; } public BlockPos getPos() { diff --git a/src/main/java/com/refinedmods/refinedpipes/network/item/ItemNetwork.java b/src/main/java/com/refinedmods/refinedpipes/network/item/ItemNetwork.java index 7043845..331dd0a 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/item/ItemNetwork.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/item/ItemNetwork.java @@ -31,8 +31,8 @@ public ItemNetwork(BlockPos originPos, String id) { } @Override - public NetworkGraphScannerResult scanGraph(Level world, BlockPos pos) { - NetworkGraphScannerResult result = super.scanGraph(world, pos); + public NetworkGraphScannerResult scanGraph(Level level, BlockPos pos) { + NetworkGraphScannerResult result = super.scanGraph(level, pos); updateRouting(result, graph.getDestinations(DestinationType.ITEM_HANDLER)); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/Pipe.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/Pipe.java index 8b5bc05..287f887 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/Pipe.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/Pipe.java @@ -14,14 +14,14 @@ import java.util.Objects; public abstract class Pipe { - protected final Level world; + protected final Level level; protected final BlockPos pos; protected final ServerAttachmentManager attachmentManager = new ServerAttachmentManager(this); private final Logger logger = LogManager.getLogger(getClass()); protected Network network; - public Pipe(Level world, BlockPos pos) { - this.world = world; + public Pipe(Level level, BlockPos pos) { + this.level = level; this.pos = pos; } @@ -35,8 +35,8 @@ public ServerAttachmentManager getAttachmentManager() { return attachmentManager; } - public Level getWorld() { - return world; + public Level getLevel() { + return level; } public BlockPos getPos() { @@ -64,8 +64,8 @@ public void leaveNetwork() { } public void sendBlockUpdate() { - BlockState state = world.getBlockState(pos); - world.sendBlockUpdated(pos, state, state, 1 | 2); + BlockState state = level.getBlockState(pos); + level.sendBlockUpdated(pos, state, state, 1 | 2); } public CompoundTag writeToNbt(CompoundTag tag) { @@ -85,12 +85,12 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Pipe pipe = (Pipe) o; - return world.equals(pipe.world) && + return level.equals(pipe.level) && pos.equals(pipe.pos); } @Override public int hashCode() { - return Objects.hash(world, pos); + return Objects.hash(level, pos); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/PipeFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/PipeFactory.java index 0b9e030..b1fc132 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/PipeFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/PipeFactory.java @@ -4,5 +4,5 @@ import net.minecraft.world.level.Level; public interface PipeFactory { - Pipe createFromNbt(Level world, CompoundTag tag); + Pipe createFromNbt(Level level, CompoundTag tag); } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ServerAttachmentManager.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ServerAttachmentManager.java index 5c59b2c..5157063 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ServerAttachmentManager.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/ServerAttachmentManager.java @@ -52,14 +52,14 @@ public void removeAttachmentAndScanGraph(Direction dir) { attachmentState[dir.ordinal()] = null; // Re-scan graph, required to rebuild destinations (chests with an attachment connected are no valid destination, refresh that) - pipe.getNetwork().scanGraph(pipe.getWorld(), pipe.getPos()); + pipe.getNetwork().scanGraph(pipe.getLevel(), pipe.getPos()); } public void setAttachmentAndScanGraph(Direction dir, Attachment attachment) { setAttachment(dir, attachment); // Re-scan graph, required to rebuild destinations (chests with an attachment connected are no valid destination, refresh that) - pipe.getNetwork().scanGraph(pipe.getWorld(), pipe.getPos()); + pipe.getNetwork().scanGraph(pipe.getLevel(), pipe.getPos()); } private void setAttachment(Direction dir, Attachment attachment) { diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachment.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachment.java index d447780..9d2c8cd 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachment.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ExtractorAttachment.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedpipes.network.pipe.attachment.extractor; -import com.refinedmods.refinedpipes.container.provider.ExtractorAttachmentContainerProvider; +import com.refinedmods.refinedpipes.container.provider.ExtractorAttachmentMenuProvider; import com.refinedmods.refinedpipes.inventory.fluid.FluidInventory; import com.refinedmods.refinedpipes.network.Network; import com.refinedmods.refinedpipes.network.NetworkManager; @@ -66,7 +66,7 @@ protected void onContentsChanged(int slot) { super.onContentsChanged(slot); if (attachment != null) { - NetworkManager.get(attachment.pipe.getWorld()).setDirty(); + NetworkManager.get(attachment.pipe.getLevel()).setDirty(); } } }; @@ -79,7 +79,7 @@ protected void onContentsChanged() { super.onContentsChanged(); if (attachment != null) { - NetworkManager.get(attachment.pipe.getWorld()).setDirty(); + NetworkManager.get(attachment.pipe.getLevel()).setDirty(); } } }; @@ -104,22 +104,22 @@ public void update() { return; } - if (!redstoneMode.isEnabled(pipe.getWorld(), pipe.getPos())) { + if (!redstoneMode.isEnabled(pipe.getLevel(), pipe.getPos())) { return; } BlockPos destinationPos = pipe.getPos().relative(getDirection()); - BlockEntity tile = pipe.getWorld().getBlockEntity(destinationPos); - if (tile == null) { + BlockEntity blockEntity = pipe.getLevel().getBlockEntity(destinationPos); + if (blockEntity == null) { return; } if (network instanceof ItemNetwork) { - tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, getDirection().getOpposite()) + blockEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, getDirection().getOpposite()) .ifPresent(itemHandler -> update((ItemNetwork) network, destinationPos, itemHandler)); } else if (network instanceof FluidNetwork) { - tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getDirection().getOpposite()) + blockEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getDirection().getOpposite()) .ifPresent(fluidHandler -> update((FluidNetwork) network, fluidHandler)); } } @@ -211,7 +211,7 @@ private void update(FluidNetwork network, IFluidHandler source) { network.getFluidTank().fill(drained, IFluidHandler.FluidAction.EXECUTE); - NetworkManager.get(pipe.getWorld()).setDirty(); + NetworkManager.get(pipe.getLevel()).setDirty(); } private boolean acceptsItem(ItemStack stack) { @@ -290,7 +290,7 @@ private boolean acceptsFluid(FluidStack stack) { public void openContainer(ServerPlayer player) { super.openContainer(player); - ExtractorAttachmentContainerProvider.open(pipe, this, player); + ExtractorAttachmentMenuProvider.open(pipe, this, player); } @Override diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ItemDestinationFinder.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ItemDestinationFinder.java index db73465..6a0e44c 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ItemDestinationFinder.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/ItemDestinationFinder.java @@ -36,7 +36,7 @@ public Destination find(RoutingMode routingMode, BlockPos sourcePos, ItemStack e List destinations = new ArrayList<>(network.getDestinations(DestinationType.ITEM_HANDLER)); while (!destinations.isEmpty()) { - int randomIndex = attachment.getPipe().getWorld().getRandom().nextInt(destinations.size()); + int randomIndex = attachment.getPipe().getLevel().getRandom().nextInt(destinations.size()); Destination randomDestination = destinations.get(randomIndex); if (isDestinationApplicable(sourcePos, extracted, randomDestination)) { @@ -80,12 +80,12 @@ public Destination find(RoutingMode routingMode, BlockPos sourcePos, ItemStack e } private boolean isDestinationApplicable(BlockPos sourcePos, ItemStack extracted, Destination destination) { - BlockEntity tile = destination.getConnectedPipe().getWorld().getBlockEntity(destination.getReceiver()); - if (tile == null) { + BlockEntity blockEntity = destination.getConnectedPipe().getLevel().getBlockEntity(destination.getReceiver()); + if (blockEntity == null) { return false; } - IItemHandler handler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, destination.getIncomingDirection().getOpposite()).orElse(null); + IItemHandler handler = blockEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, destination.getIncomingDirection().getOpposite()).orElse(null); if (handler == null) { return false; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/RedstoneMode.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/RedstoneMode.java index c62d1ae..efc4c05 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/RedstoneMode.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/attachment/extractor/RedstoneMode.java @@ -18,14 +18,14 @@ public static RedstoneMode get(byte b) { return m[b]; } - public boolean isEnabled(Level world, BlockPos pos) { + public boolean isEnabled(Level level, BlockPos pos) { switch (this) { case IGNORED: return true; case HIGH: - return world.hasNeighborSignal(pos); + return level.hasNeighborSignal(pos); case LOW: - return !world.hasNeighborSignal(pos); + return !level.hasNeighborSignal(pos); default: return false; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipe.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipe.java index 8083cf6..0a1c846 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipe.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipe.java @@ -17,8 +17,8 @@ public class EnergyPipe extends Pipe { private LazyOptional energyStorage = LazyOptional.empty(); - public EnergyPipe(Level world, BlockPos pos, EnergyPipeType type) { - super(world, pos); + public EnergyPipe(Level level, BlockPos pos, EnergyPipeType type) { + super(level, pos); this.type = type; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeFactory.java index 5947eab..b4e255a 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeFactory.java @@ -8,12 +8,12 @@ public class EnergyPipeFactory implements PipeFactory { @Override - public Pipe createFromNbt(Level world, CompoundTag tag) { + public Pipe createFromNbt(Level level, CompoundTag tag) { BlockPos pos = BlockPos.of(tag.getLong("pos")); EnergyPipeType pipeType = EnergyPipeType.values()[tag.getInt("type")]; - EnergyPipe pipe = new EnergyPipe(world, pos, pipeType); + EnergyPipe pipe = new EnergyPipe(level, pos, pipeType); pipe.getAttachmentManager().readFromNbt(tag); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeType.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeType.java index 2246d52..c38b778 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeType.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/energy/EnergyPipeType.java @@ -1,8 +1,8 @@ package com.refinedmods.refinedpipes.network.pipe.energy; import com.refinedmods.refinedpipes.RefinedPipes; -import com.refinedmods.refinedpipes.RefinedPipesTileEntities; -import com.refinedmods.refinedpipes.tile.EnergyPipeTileEntity; +import com.refinedmods.refinedpipes.RefinedPipesBlockEntities; +import com.refinedmods.refinedpipes.blockentity.EnergyPipeBlockEntity; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -91,18 +91,18 @@ public ResourceLocation getNetworkType() { } } - public BlockEntityType getTileType() { + public BlockEntityType getBlockEntityType() { switch (this) { case BASIC: - return RefinedPipesTileEntities.BASIC_ENERGY_PIPE; + return RefinedPipesBlockEntities.BASIC_ENERGY_PIPE; case IMPROVED: - return RefinedPipesTileEntities.IMPROVED_ENERGY_PIPE; + return RefinedPipesBlockEntities.IMPROVED_ENERGY_PIPE; case ADVANCED: - return RefinedPipesTileEntities.ADVANCED_ENERGY_PIPE; + return RefinedPipesBlockEntities.ADVANCED_ENERGY_PIPE; case ELITE: - return RefinedPipesTileEntities.ELITE_ENERGY_PIPE; + return RefinedPipesBlockEntities.ELITE_ENERGY_PIPE; case ULTIMATE: - return RefinedPipesTileEntities.ULTIMATE_ENERGY_PIPE; + return RefinedPipesBlockEntities.ULTIMATE_ENERGY_PIPE; default: throw new RuntimeException("?"); } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipe.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipe.java index c0848c8..971b3a2 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipe.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipe.java @@ -15,8 +15,8 @@ public class FluidPipe extends Pipe { private final FluidPipeType type; private float lastFullness = 0; - public FluidPipe(Level world, BlockPos pos, FluidPipeType type) { - super(world, pos); + public FluidPipe(Level level, BlockPos pos, FluidPipeType type) { + super(level, pos); this.type = type; } @@ -34,7 +34,7 @@ public void update() { } public void sendFluidPipeUpdate() { - RefinedPipes.NETWORK.sendInArea(world, pos, 32, new FluidPipeMessage(pos, ((FluidNetwork) network).getFluidTank().getFluid(), getFullness())); + RefinedPipes.NETWORK.sendInArea(level, pos, 32, new FluidPipeMessage(pos, ((FluidNetwork) network).getFluidTank().getFluid(), getFullness())); } public float getFullness() { diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeFactory.java index 7fee1ea..da7c701 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeFactory.java @@ -8,12 +8,12 @@ public class FluidPipeFactory implements PipeFactory { @Override - public Pipe createFromNbt(Level world, CompoundTag tag) { + public Pipe createFromNbt(Level level, CompoundTag tag) { BlockPos pos = BlockPos.of(tag.getLong("pos")); FluidPipeType pipeType = FluidPipeType.values()[tag.getInt("type")]; - FluidPipe pipe = new FluidPipe(world, pos, pipeType); + FluidPipe pipe = new FluidPipe(level, pos, pipeType); pipe.getAttachmentManager().readFromNbt(tag); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeType.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeType.java index 621d80e..4b9cbc7 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeType.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/fluid/FluidPipeType.java @@ -1,8 +1,8 @@ package com.refinedmods.refinedpipes.network.pipe.fluid; import com.refinedmods.refinedpipes.RefinedPipes; -import com.refinedmods.refinedpipes.RefinedPipesTileEntities; -import com.refinedmods.refinedpipes.tile.FluidPipeTileEntity; +import com.refinedmods.refinedpipes.RefinedPipesBlockEntities; +import com.refinedmods.refinedpipes.blockentity.FluidPipeBlockEntity; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -23,18 +23,18 @@ public int getTier() { return tier; } - public BlockEntityType getTileType() { + public BlockEntityType getBlockEntityType() { switch (this) { case BASIC: - return RefinedPipesTileEntities.BASIC_FLUID_PIPE; + return RefinedPipesBlockEntities.BASIC_FLUID_PIPE; case IMPROVED: - return RefinedPipesTileEntities.IMPROVED_FLUID_PIPE; + return RefinedPipesBlockEntities.IMPROVED_FLUID_PIPE; case ADVANCED: - return RefinedPipesTileEntities.ADVANCED_FLUID_PIPE; + return RefinedPipesBlockEntities.ADVANCED_FLUID_PIPE; case ELITE: - return RefinedPipesTileEntities.ELITE_FLUID_PIPE; + return RefinedPipesBlockEntities.ELITE_FLUID_PIPE; case ULTIMATE: - return RefinedPipesTileEntities.ULTIMATE_FLUID_PIPE; + return RefinedPipesBlockEntities.ULTIMATE_FLUID_PIPE; default: throw new RuntimeException("?"); } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipe.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipe.java index 8c3c826..88646b3 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipe.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipe.java @@ -24,8 +24,8 @@ public class ItemPipe extends Pipe { private final List transportsToRemove = new ArrayList<>(); private final ItemPipeType type; - public ItemPipe(Level world, BlockPos pos, ItemPipeType type) { - super(world, pos); + public ItemPipe(Level level, BlockPos pos, ItemPipeType type) { + super(level, pos); this.type = type; } @@ -37,19 +37,19 @@ public void update() { transports.removeAll(transportsToRemove); if (!transportsToAdd.isEmpty() || !transportsToRemove.isEmpty()) { - NetworkManager.get(world).setDirty(); + NetworkManager.get(level).setDirty(); sendTransportUpdate(); } if (!transports.isEmpty()) { - NetworkManager.get(world).setDirty(); + NetworkManager.get(level).setDirty(); } transportsToAdd.clear(); transportsToRemove.clear(); if (transports.removeIf(t -> t.update(network, this))) { - NetworkManager.get(world).setDirty(); + NetworkManager.get(level).setDirty(); } } @@ -71,7 +71,7 @@ public void sendTransportUpdate() { props.add(transport.createProps(this)); } - RefinedPipes.NETWORK.sendInArea(world, pos, 32, new ItemTransportMessage(pos, props)); + RefinedPipes.NETWORK.sendInArea(level, pos, 32, new ItemTransportMessage(pos, props)); } @Override diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeFactory.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeFactory.java index 049a68b..07b56b2 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeFactory.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeFactory.java @@ -11,12 +11,12 @@ public class ItemPipeFactory implements PipeFactory { @Override - public Pipe createFromNbt(Level world, CompoundTag tag) { + public Pipe createFromNbt(Level level, CompoundTag tag) { BlockPos pos = BlockPos.of(tag.getLong("pos")); ItemPipeType pipeType = ItemPipeType.values()[tag.getInt("type")]; - ItemPipe pipe = new ItemPipe(world, pos, pipeType); + ItemPipe pipe = new ItemPipe(level, pos, pipeType); pipe.getAttachmentManager().readFromNbt(tag); diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeType.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeType.java index e7c1d71..788d473 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeType.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/item/ItemPipeType.java @@ -1,8 +1,8 @@ package com.refinedmods.refinedpipes.network.pipe.item; import com.refinedmods.refinedpipes.RefinedPipes; -import com.refinedmods.refinedpipes.RefinedPipesTileEntities; -import com.refinedmods.refinedpipes.tile.ItemPipeTileEntity; +import com.refinedmods.refinedpipes.RefinedPipesBlockEntities; +import com.refinedmods.refinedpipes.blockentity.ItemPipeBlockEntity; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -45,14 +45,14 @@ public int getSpeedComparedToBasicTier() { return (int) ((float) mySpeed / (float) speedOfBasicTier * 100F); } - public BlockEntityType getTileType() { + public BlockEntityType getBlockEntityType() { switch (this) { case BASIC: - return RefinedPipesTileEntities.BASIC_ITEM_PIPE; + return RefinedPipesBlockEntities.BASIC_ITEM_PIPE; case IMPROVED: - return RefinedPipesTileEntities.IMPROVED_ITEM_PIPE; + return RefinedPipesBlockEntities.IMPROVED_ITEM_PIPE; case ADVANCED: - return RefinedPipesTileEntities.ADVANCED_ITEM_PIPE; + return RefinedPipesBlockEntities.ADVANCED_ITEM_PIPE; default: throw new RuntimeException("?"); } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeCache.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeCache.java index d97bb13..650b238 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeCache.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/shape/PipeShapeCache.java @@ -1,8 +1,8 @@ package com.refinedmods.refinedpipes.network.pipe.shape; +import com.refinedmods.refinedpipes.blockentity.PipeBlockEntity; import com.refinedmods.refinedpipes.item.AttachmentItem; import com.refinedmods.refinedpipes.network.pipe.attachment.AttachmentFactory; -import com.refinedmods.refinedpipes.tile.PipeTileEntity; import com.refinedmods.refinedpipes.util.Raytracer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -78,9 +78,9 @@ private VoxelShape addFakeAttachmentShape(Block block, BlockPos pos, Entity enti private VoxelShape createShapeIfNeeded(BlockState state, BlockGetter world, BlockPos pos) { ResourceLocation[] attachmentState; - BlockEntity tile = world.getBlockEntity(pos); - if (tile instanceof PipeTileEntity) { - attachmentState = ((PipeTileEntity) tile).getAttachmentManager().getState(); + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity instanceof PipeBlockEntity) { + attachmentState = ((PipeBlockEntity) blockEntity).getAttachmentManager().getState(); } else { attachmentState = NO_ATTACHMENT_STATE; } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransport.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransport.java index 0609154..502cd5f 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransport.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/ItemTransport.java @@ -176,14 +176,14 @@ public Direction getDirection(ItemPipe currentPipe) { return getDirection(currentPipe.getPos(), nextPipe); } - private boolean onDone(Network network, Level world, ItemPipe currentPipe) { - finishedCallback.call(network, world, currentPipe.getPos(), cancelCallback); + private boolean onDone(Network network, Level level, ItemPipe currentPipe) { + finishedCallback.call(network, level, currentPipe.getPos(), cancelCallback); return true; } - private boolean onPipeGone(Network network, Level world, BlockPos posWherePipeIsGone) { + private boolean onPipeGone(Network network, Level level, BlockPos posWherePipeIsGone) { LOGGER.warn("Pipe on path is gone"); - pipeGoneCallback.call(network, world, posWherePipeIsGone, cancelCallback); + pipeGoneCallback.call(network, level, posWherePipeIsGone, cancelCallback); return true; } @@ -193,9 +193,9 @@ public boolean update(Network network, ItemPipe currentPipe) { double progress = (double) progressInCurrentPipe / (double) getMaxTicksInPipe(currentPipe); BlockPos nextPos = currentPipe.getPos().relative(getDirection(currentPipe)); - if (progress > 0.25 && currentPipe.getWorld().isEmptyBlock(nextPos)) { + if (progress > 0.25 && currentPipe.getLevel().isEmptyBlock(nextPos)) { currentPipe.removeTransport(this); - return onPipeGone(network, currentPipe.getWorld(), nextPos); + return onPipeGone(network, currentPipe.getLevel(), nextPos); } if (progressInCurrentPipe >= getMaxTicksInPipe(currentPipe)) { @@ -204,12 +204,12 @@ public boolean update(Network network, ItemPipe currentPipe) { BlockPos nextPipePos = path.poll(); if (nextPipePos == null) { - return onDone(network, currentPipe.getWorld(), currentPipe); + return onDone(network, currentPipe.getLevel(), currentPipe); } Pipe nextPipe = network.getPipe(nextPipePos); if (nextPipe == null) { - return onPipeGone(network, currentPipe.getWorld(), nextPipePos); + return onPipeGone(network, currentPipe.getLevel(), nextPipePos); } progressInCurrentPipe = 0; diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemBounceBackTransportCallback.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemBounceBackTransportCallback.java index dc8f4d7..cacce57 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemBounceBackTransportCallback.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemBounceBackTransportCallback.java @@ -41,9 +41,9 @@ public static ItemBounceBackTransportCallback of(CompoundTag tag) { } @Override - public void call(Network network, Level world, BlockPos currentPos, TransportCallback cancelCallback) { + public void call(Network network, Level level, BlockPos currentPos, TransportCallback cancelCallback) { // TODO: Actually bounce back... - Containers.dropItemStack(world, originalItemHandlerPosition.getX(), originalItemHandlerPosition.getY(), originalItemHandlerPosition.getZ(), toInsert); + Containers.dropItemStack(level, originalItemHandlerPosition.getX(), originalItemHandlerPosition.getY(), originalItemHandlerPosition.getZ(), toInsert); } @Override diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemInsertTransportCallback.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemInsertTransportCallback.java index e304e77..a39eb1c 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemInsertTransportCallback.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemInsertTransportCallback.java @@ -46,25 +46,25 @@ public static ItemInsertTransportCallback of(CompoundTag tag) { } @Override - public void call(Network network, Level world, BlockPos currentPos, TransportCallback cancelCallback) { - BlockEntity tile = world.getBlockEntity(itemHandlerPosition); - if (tile == null) { + public void call(Network network, Level level, BlockPos currentPos, TransportCallback cancelCallback) { + BlockEntity blockEntity = level.getBlockEntity(itemHandlerPosition); + if (blockEntity == null) { LOGGER.warn("Destination item handler is gone at " + itemHandlerPosition); - cancelCallback.call(network, world, currentPos, cancelCallback); + cancelCallback.call(network, level, currentPos, cancelCallback); return; } - IItemHandler itemHandler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, incomingDirection.getOpposite()).orElse(null); + IItemHandler itemHandler = blockEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, incomingDirection.getOpposite()).orElse(null); if (itemHandler == null) { LOGGER.warn("Destination item handler is no longer exposing a capability at " + itemHandlerPosition); - cancelCallback.call(network, world, currentPos, cancelCallback); + cancelCallback.call(network, level, currentPos, cancelCallback); return; } if (ItemHandlerHelper.insertItem(itemHandler, toInsert, true).isEmpty()) { ItemHandlerHelper.insertItem(itemHandler, toInsert, false); } else { - cancelCallback.call(network, world, currentPos, cancelCallback); + cancelCallback.call(network, level, currentPos, cancelCallback); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemPipeGoneTransportCallback.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemPipeGoneTransportCallback.java index 33c5ddf..8acce73 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemPipeGoneTransportCallback.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/ItemPipeGoneTransportCallback.java @@ -35,8 +35,8 @@ public static ItemPipeGoneTransportCallback of(CompoundTag tag) { } @Override - public void call(Network network, Level world, BlockPos currentPos, TransportCallback cancelCallback) { - Containers.dropItemStack(world, currentPos.getX(), currentPos.getY(), currentPos.getZ(), stack); + public void call(Network network, Level level, BlockPos currentPos, TransportCallback cancelCallback) { + Containers.dropItemStack(level, currentPos.getX(), currentPos.getY(), currentPos.getZ(), stack); } @Override diff --git a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/TransportCallback.java b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/TransportCallback.java index 1b0dbad..5f63cb5 100644 --- a/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/TransportCallback.java +++ b/src/main/java/com/refinedmods/refinedpipes/network/pipe/transport/callback/TransportCallback.java @@ -7,7 +7,7 @@ import net.minecraft.world.level.Level; public interface TransportCallback { - void call(Network network, Level world, BlockPos currentPos, TransportCallback cancelCallback); + void call(Network network, Level level, BlockPos currentPos, TransportCallback cancelCallback); ResourceLocation getId(); diff --git a/src/main/java/com/refinedmods/refinedpipes/render/CubeBuilder.java b/src/main/java/com/refinedmods/refinedpipes/render/CubeBuilder.java index 967fe41..8124d33 100644 --- a/src/main/java/com/refinedmods/refinedpipes/render/CubeBuilder.java +++ b/src/main/java/com/refinedmods/refinedpipes/render/CubeBuilder.java @@ -15,61 +15,61 @@ public class CubeBuilder { private CubeBuilder() { } - public void putCube(PoseStack matrixStack, VertexConsumer builder, float x1, float y1, float z1, float x2, float y2, float z2, int r, int g, int b, int a, int light, TextureAtlasSprite sprite) { - putCube(matrixStack, builder, x1, y1, z1, x2, y2, z2, r, g, b, a, light, sprite, null); + public void putCube(PoseStack poseStack, VertexConsumer builder, float x1, float y1, float z1, float x2, float y2, float z2, int r, int g, int b, int a, int light, TextureAtlasSprite sprite) { + putCube(poseStack, builder, x1, y1, z1, x2, y2, z2, r, g, b, a, light, sprite, null); } - public void putCube(PoseStack matrixStack, VertexConsumer builder, float x1, float y1, float z1, float x2, float y2, float z2, int r, int g, int b, int a, int light, TextureAtlasSprite sprite, @Nullable Direction exclude) { - matrixStack.pushPose(); + public void putCube(PoseStack poseStack, VertexConsumer builder, float x1, float y1, float z1, float x2, float y2, float z2, int r, int g, int b, int a, int light, TextureAtlasSprite sprite, @Nullable Direction exclude) { + poseStack.pushPose(); for (Direction face : Direction.values()) { if (face != exclude) { - putFace(matrixStack, builder, x1, y1, z1, x2, y2, z2, r, g, b, a, light, sprite, face); + putFace(poseStack, builder, x1, y1, z1, x2, y2, z2, r, g, b, a, light, sprite, face); } } - matrixStack.popPose(); + poseStack.popPose(); } - public void putFace(PoseStack matrixStack, VertexConsumer builder, float x1, float y1, float z1, float x2, float y2, float z2, int r, int g, int b, int a, int light, TextureAtlasSprite sprite, Direction face) { + public void putFace(PoseStack poseStack, VertexConsumer builder, float x1, float y1, float z1, float x2, float y2, float z2, int r, int g, int b, int a, int light, TextureAtlasSprite sprite, Direction face) { UvVector uv = getDefaultUv(face, sprite, x1, y1, z1, x2, y2, z2); switch (face) { case DOWN: - this.putVertexTR(builder, matrixStack, face, r, g, b, a, light, x2, y1, z1, uv); - this.putVertexBR(builder, matrixStack, face, r, g, b, a, light, x2, y1, z2, uv); - this.putVertexBL(builder, matrixStack, face, r, g, b, a, light, x1, y1, z2, uv); - this.putVertexTL(builder, matrixStack, face, r, g, b, a, light, x1, y1, z1, uv); + this.putVertexTR(builder, poseStack, face, r, g, b, a, light, x2, y1, z1, uv); + this.putVertexBR(builder, poseStack, face, r, g, b, a, light, x2, y1, z2, uv); + this.putVertexBL(builder, poseStack, face, r, g, b, a, light, x1, y1, z2, uv); + this.putVertexTL(builder, poseStack, face, r, g, b, a, light, x1, y1, z1, uv); break; case UP: - this.putVertexTL(builder, matrixStack, face, r, g, b, a, light, x1, y2, z1, uv); - this.putVertexBL(builder, matrixStack, face, r, g, b, a, light, x1, y2, z2, uv); - this.putVertexBR(builder, matrixStack, face, r, g, b, a, light, x2, y2, z2, uv); - this.putVertexTR(builder, matrixStack, face, r, g, b, a, light, x2, y2, z1, uv); + this.putVertexTL(builder, poseStack, face, r, g, b, a, light, x1, y2, z1, uv); + this.putVertexBL(builder, poseStack, face, r, g, b, a, light, x1, y2, z2, uv); + this.putVertexBR(builder, poseStack, face, r, g, b, a, light, x2, y2, z2, uv); + this.putVertexTR(builder, poseStack, face, r, g, b, a, light, x2, y2, z1, uv); break; case NORTH: - this.putVertexBR(builder, matrixStack, face, r, g, b, a, light, x2, y2, z1, uv); - this.putVertexTR(builder, matrixStack, face, r, g, b, a, light, x2, y1, z1, uv); - this.putVertexTL(builder, matrixStack, face, r, g, b, a, light, x1, y1, z1, uv); - this.putVertexBL(builder, matrixStack, face, r, g, b, a, light, x1, y2, z1, uv); + this.putVertexBR(builder, poseStack, face, r, g, b, a, light, x2, y2, z1, uv); + this.putVertexTR(builder, poseStack, face, r, g, b, a, light, x2, y1, z1, uv); + this.putVertexTL(builder, poseStack, face, r, g, b, a, light, x1, y1, z1, uv); + this.putVertexBL(builder, poseStack, face, r, g, b, a, light, x1, y2, z1, uv); break; case SOUTH: - this.putVertexBL(builder, matrixStack, face, r, g, b, a, light, x1, y2, z2, uv); - this.putVertexTL(builder, matrixStack, face, r, g, b, a, light, x1, y1, z2, uv); - this.putVertexTR(builder, matrixStack, face, r, g, b, a, light, x2, y1, z2, uv); - this.putVertexBR(builder, matrixStack, face, r, g, b, a, light, x2, y2, z2, uv); + this.putVertexBL(builder, poseStack, face, r, g, b, a, light, x1, y2, z2, uv); + this.putVertexTL(builder, poseStack, face, r, g, b, a, light, x1, y1, z2, uv); + this.putVertexTR(builder, poseStack, face, r, g, b, a, light, x2, y1, z2, uv); + this.putVertexBR(builder, poseStack, face, r, g, b, a, light, x2, y2, z2, uv); break; case WEST: - this.putVertexTL(builder, matrixStack, face, r, g, b, a, light, x1, y1, z1, uv); - this.putVertexTR(builder, matrixStack, face, r, g, b, a, light, x1, y1, z2, uv); - this.putVertexBR(builder, matrixStack, face, r, g, b, a, light, x1, y2, z2, uv); - this.putVertexBL(builder, matrixStack, face, r, g, b, a, light, x1, y2, z1, uv); + this.putVertexTL(builder, poseStack, face, r, g, b, a, light, x1, y1, z1, uv); + this.putVertexTR(builder, poseStack, face, r, g, b, a, light, x1, y1, z2, uv); + this.putVertexBR(builder, poseStack, face, r, g, b, a, light, x1, y2, z2, uv); + this.putVertexBL(builder, poseStack, face, r, g, b, a, light, x1, y2, z1, uv); break; case EAST: - this.putVertexBR(builder, matrixStack, face, r, g, b, a, light, x2, y2, z1, uv); - this.putVertexBL(builder, matrixStack, face, r, g, b, a, light, x2, y2, z2, uv); - this.putVertexTL(builder, matrixStack, face, r, g, b, a, light, x2, y1, z2, uv); - this.putVertexTR(builder, matrixStack, face, r, g, b, a, light, x2, y1, z1, uv); + this.putVertexBR(builder, poseStack, face, r, g, b, a, light, x2, y2, z1, uv); + this.putVertexBL(builder, poseStack, face, r, g, b, a, light, x2, y2, z2, uv); + this.putVertexTL(builder, poseStack, face, r, g, b, a, light, x2, y1, z2, uv); + this.putVertexTR(builder, poseStack, face, r, g, b, a, light, x2, y1, z1, uv); break; } @@ -121,7 +121,7 @@ private UvVector getDefaultUv(Direction face, TextureAtlasSprite texture, float } // uv.u1, uv.v1 - private void putVertexTL(VertexConsumer builder, PoseStack matrixStack, Direction face, int r, int g, int b, int a, int light, float x, float y, float z, UvVector uv) { + private void putVertexTL(VertexConsumer builder, PoseStack poseStack, Direction face, int r, int g, int b, int a, int light, float x, float y, float z, UvVector uv) { float u, v; switch (this.uvRotations[face.ordinal()]) { @@ -144,11 +144,11 @@ private void putVertexTL(VertexConsumer builder, PoseStack matrixStack, Directio break; } - this.putVertex(builder, matrixStack, r, g, b, a, light, x, y, z, u, v); + this.putVertex(builder, poseStack, r, g, b, a, light, x, y, z, u, v); } // uv.u2, uv.v1 - private void putVertexTR(VertexConsumer builder, PoseStack matrixStack, Direction face, int r, int g, int b, int a, int light, float x, float y, float z, UvVector uv) { + private void putVertexTR(VertexConsumer builder, PoseStack poseStack, Direction face, int r, int g, int b, int a, int light, float x, float y, float z, UvVector uv) { float u, v; switch (this.uvRotations[face.ordinal()]) { @@ -171,11 +171,11 @@ private void putVertexTR(VertexConsumer builder, PoseStack matrixStack, Directio break; } - this.putVertex(builder, matrixStack, r, g, b, a, light, x, y, z, u, v); + this.putVertex(builder, poseStack, r, g, b, a, light, x, y, z, u, v); } // uv.u2, uv.v2 - private void putVertexBR(VertexConsumer builder, PoseStack matrixStack, Direction face, int r, int g, int b, int a, int light, float x, float y, float z, UvVector uv) { + private void putVertexBR(VertexConsumer builder, PoseStack poseStack, Direction face, int r, int g, int b, int a, int light, float x, float y, float z, UvVector uv) { float u; float v; @@ -200,11 +200,11 @@ private void putVertexBR(VertexConsumer builder, PoseStack matrixStack, Directio break; } - this.putVertex(builder, matrixStack, r, g, b, a, light, x, y, z, u, v); + this.putVertex(builder, poseStack, r, g, b, a, light, x, y, z, u, v); } // uv.u1, uv.v2 - private void putVertexBL(VertexConsumer builder, PoseStack matrixStack, Direction face, int r, int g, int b, int a, int light, float x, float y, float z, UvVector uv) { + private void putVertexBL(VertexConsumer builder, PoseStack poseStack, Direction face, int r, int g, int b, int a, int light, float x, float y, float z, UvVector uv) { float u; float v; @@ -229,11 +229,11 @@ private void putVertexBL(VertexConsumer builder, PoseStack matrixStack, Directio break; } - this.putVertex(builder, matrixStack, r, g, b, a, light, x, y, z, u, v); + this.putVertex(builder, poseStack, r, g, b, a, light, x, y, z, u, v); } - private void putVertex(VertexConsumer builder, PoseStack matrixStack, int r, int g, int b, int a, int light, float x, float y, float z, float u, float v) { - builder.vertex(matrixStack.last().pose(), x, y, z) + private void putVertex(VertexConsumer builder, PoseStack poseStack, int r, int g, int b, int a, int light, float x, float y, float z, float u, float v) { + builder.vertex(poseStack.last().pose(), x, y, z) .color(r, g, b, a) .uv(u, v) .uv2(light) diff --git a/src/main/java/com/refinedmods/refinedpipes/render/FluidPipeTileEntityRenderer.java b/src/main/java/com/refinedmods/refinedpipes/render/FluidPipeBlockEntityRenderer.java similarity index 89% rename from src/main/java/com/refinedmods/refinedpipes/render/FluidPipeTileEntityRenderer.java rename to src/main/java/com/refinedmods/refinedpipes/render/FluidPipeBlockEntityRenderer.java index c4e76b6..c71b4a5 100644 --- a/src/main/java/com/refinedmods/refinedpipes/render/FluidPipeTileEntityRenderer.java +++ b/src/main/java/com/refinedmods/refinedpipes/render/FluidPipeBlockEntityRenderer.java @@ -3,7 +3,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.refinedmods.refinedpipes.block.FluidPipeBlock; -import com.refinedmods.refinedpipes.tile.FluidPipeTileEntity; +import com.refinedmods.refinedpipes.blockentity.FluidPipeBlockEntity; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; @@ -17,29 +17,29 @@ import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidStack; -public class FluidPipeTileEntityRenderer implements BlockEntityRenderer { +public class FluidPipeBlockEntityRenderer implements BlockEntityRenderer { private static final float INSET = 0.001F; @Override @SuppressWarnings("deprecation") - public void render(FluidPipeTileEntity tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferType, int combinedLight, int combinedOverlay) { - Level world = tile.getLevel(); - if (world == null) { + public void render(FluidPipeBlockEntity blockEntity, float partialTicks, PoseStack poseStack, MultiBufferSource bufferType, int combinedLight, int combinedOverlay) { + Level level = blockEntity.getLevel(); + if (level == null) { return; } - BlockState state = world.getBlockState(tile.getBlockPos()); + BlockState state = level.getBlockState(blockEntity.getBlockPos()); if (!(state.getBlock() instanceof FluidPipeBlock)) { return; } - FluidStack fluidStack = tile.getFluid(); + FluidStack fluidStack = blockEntity.getFluid(); if (fluidStack.isEmpty()) { - tile.updateAndGetRenderFullness(partialTicks); + blockEntity.updateAndGetRenderFullness(partialTicks); return; } - int light = LevelRenderer.getLightColor(tile.getLevel(), tile.getBlockPos()); + int light = LevelRenderer.getLightColor(blockEntity.getLevel(), blockEntity.getBlockPos()); FluidAttributes attributes = fluidStack.getFluid().getAttributes(); TextureAtlasSprite sprite = Minecraft.getInstance().getTextureAtlas(InventoryMenu.BLOCK_ATLAS).apply(attributes.getStillTexture(fluidStack)); int fluidColor = attributes.getColor(fluidStack); @@ -51,7 +51,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, PoseStack matri VertexConsumer buffer = bufferType.getBuffer(RenderType.text(sprite.atlas().location())); - float fullness = tile.updateAndGetRenderFullness(partialTicks); + float fullness = blockEntity.updateAndGetRenderFullness(partialTicks); if (fullness == 0) { return; } @@ -65,7 +65,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, PoseStack matri float z2 = 4; CubeBuilder.INSTANCE.putCube( - matrixStack, + poseStack, buffer, (x1 / 16F) + INSET, (y1 / 16F) + INSET, @@ -92,7 +92,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, PoseStack matri float z2 = 12; CubeBuilder.INSTANCE.putCube( - matrixStack, + poseStack, buffer, (x1 / 16F) + INSET, (y1 / 16F) + INSET, @@ -119,7 +119,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, PoseStack matri float z2 = 16; CubeBuilder.INSTANCE.putCube( - matrixStack, + poseStack, buffer, (x1 / 16F) + INSET, (y1 / 16F) + INSET, @@ -146,7 +146,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, PoseStack matri float z2 = 12; CubeBuilder.INSTANCE.putCube( - matrixStack, + poseStack, buffer, (x1 / 16F) + INSET, (y1 / 16F) + INSET, @@ -187,7 +187,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, PoseStack matri y1 -= (1F - fullness) * (12F - 4F); CubeBuilder.INSTANCE.putCube( - matrixStack, + poseStack, buffer, (x1 / 16F) + INSET, (y1 / 16F) + INSET, @@ -222,7 +222,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, PoseStack matri z2 -= shrinkage; CubeBuilder.INSTANCE.putCube( - matrixStack, + poseStack, buffer, (x1 / 16F) + INSET, (y1 / 16F) + INSET, @@ -248,10 +248,10 @@ public void render(FluidPipeTileEntity tile, float partialTicks, PoseStack matri float y2 = 4 + (fullness * (12 - 4)); float z2 = 12; - matrixStack.pushPose(); + poseStack.pushPose(); CubeBuilder.INSTANCE.putFace( - matrixStack, + poseStack, buffer, (x1 / 16F) + INSET, (y1 / 16F) + INSET, @@ -269,7 +269,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, PoseStack matri ); CubeBuilder.INSTANCE.putFace( - matrixStack, + poseStack, buffer, (x1 / 16F) + INSET, (y1 / 16F) + INSET, @@ -288,7 +288,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, PoseStack matri if (!state.getValue(FluidPipeBlock.NORTH)) { CubeBuilder.INSTANCE.putFace( - matrixStack, + poseStack, buffer, (x1 / 16F) + INSET, (y1 / 16F) + INSET, @@ -308,7 +308,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, PoseStack matri if (!state.getValue(FluidPipeBlock.EAST)) { CubeBuilder.INSTANCE.putFace( - matrixStack, + poseStack, buffer, (x1 / 16F) + INSET, (y1 / 16F) + INSET, @@ -328,7 +328,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, PoseStack matri if (!state.getValue(FluidPipeBlock.SOUTH)) { CubeBuilder.INSTANCE.putFace( - matrixStack, + poseStack, buffer, (x1 / 16F) + INSET, (y1 / 16F) + INSET, @@ -348,7 +348,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, PoseStack matri if (!state.getValue(FluidPipeBlock.WEST)) { CubeBuilder.INSTANCE.putFace( - matrixStack, + poseStack, buffer, (x1 / 16F) + INSET, (y1 / 16F) + INSET, @@ -366,7 +366,7 @@ public void render(FluidPipeTileEntity tile, float partialTicks, PoseStack matri ); } - matrixStack.popPose(); + poseStack.popPose(); } } } diff --git a/src/main/java/com/refinedmods/refinedpipes/render/ItemPipeTileEntityRenderer.java b/src/main/java/com/refinedmods/refinedpipes/render/ItemPipeBlockEntityRenderer.java similarity index 74% rename from src/main/java/com/refinedmods/refinedpipes/render/ItemPipeTileEntityRenderer.java rename to src/main/java/com/refinedmods/refinedpipes/render/ItemPipeBlockEntityRenderer.java index bd45d07..ed36c3b 100644 --- a/src/main/java/com/refinedmods/refinedpipes/render/ItemPipeTileEntityRenderer.java +++ b/src/main/java/com/refinedmods/refinedpipes/render/ItemPipeBlockEntityRenderer.java @@ -2,19 +2,19 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Quaternion; +import com.refinedmods.refinedpipes.blockentity.ItemPipeBlockEntity; import com.refinedmods.refinedpipes.network.pipe.transport.ItemTransportProps; -import com.refinedmods.refinedpipes.tile.ItemPipeTileEntity; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.core.Direction; -public class ItemPipeTileEntityRenderer implements BlockEntityRenderer { +public class ItemPipeBlockEntityRenderer implements BlockEntityRenderer { @Override @SuppressWarnings("deprecation") - public void render(ItemPipeTileEntity tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferType, int combinedLight, int combinedOverlay) { - for (ItemTransportProps prop : tile.getProps()) { + public void render(ItemPipeBlockEntity blockEntity, float partialTicks, PoseStack poseStack, MultiBufferSource bufferType, int combinedLight, int combinedOverlay) { + for (ItemTransportProps prop : blockEntity.getProps()) { Direction dir = prop.getDirection(); double pipeLength = 1D; @@ -48,33 +48,33 @@ public void render(ItemPipeTileEntity tile, float partialTicks, PoseStack matrix } // If the next pipe is gone.. - if (v > 0.25 && tile.getLevel().isEmptyBlock(tile.getBlockPos().relative(prop.getDirection()))) { + if (v > 0.25 && blockEntity.getLevel().isEmptyBlock(blockEntity.getBlockPos().relative(prop.getDirection()))) { continue; } v = Math.min(1F, v); - matrixStack.pushPose(); + poseStack.pushPose(); - matrixStack.translate( + poseStack.translate( 0.5 + (dir.getStepX() * v), 0.5 + (dir.getStepY() * v), 0.5 + (dir.getStepZ() * v) ); - matrixStack.mulPose(new Quaternion(0, (float) ((Minecraft.getInstance().level.getGameTime() / 25D) % (Math.PI * 2) + (partialTicks / 25D)), 0, false)); - matrixStack.scale(0.5F, 0.5F, 0.5F); + poseStack.mulPose(new Quaternion(0, (float) ((Minecraft.getInstance().level.getGameTime() / 25D) % (Math.PI * 2) + (partialTicks / 25D)), 0, false)); + poseStack.scale(0.5F, 0.5F, 0.5F); Minecraft.getInstance().getItemRenderer().renderStatic( prop.getStack(), ItemTransforms.TransformType.FIXED, combinedLight, combinedOverlay, - matrixStack, + poseStack, bufferType, 0 ); - matrixStack.popPose(); + poseStack.popPose(); } } } diff --git a/src/main/java/com/refinedmods/refinedpipes/render/PipeBakedModel.java b/src/main/java/com/refinedmods/refinedpipes/render/PipeBakedModel.java index b3089d5..a3cf781 100644 --- a/src/main/java/com/refinedmods/refinedpipes/render/PipeBakedModel.java +++ b/src/main/java/com/refinedmods/refinedpipes/render/PipeBakedModel.java @@ -5,7 +5,7 @@ import com.mojang.math.Transformation; import com.mojang.math.Vector3f; import com.refinedmods.refinedpipes.block.PipeBlock; -import com.refinedmods.refinedpipes.tile.PipeTileEntity; +import com.refinedmods.refinedpipes.blockentity.PipeBlockEntity; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.ItemOverrides; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -85,7 +85,7 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction @Nonnull @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) { - PipeState pipeState = new PipeState(state, extraData.getData(PipeTileEntity.ATTACHMENTS_PROPERTY), side, rand); + PipeState pipeState = new PipeState(state, extraData.getData(PipeBlockEntity.ATTACHMENTS_PROPERTY), side, rand); return cache.computeIfAbsent(pipeState, this::createQuads); } diff --git a/src/main/java/com/refinedmods/refinedpipes/screen/BaseScreen.java b/src/main/java/com/refinedmods/refinedpipes/screen/BaseScreen.java index 0a62774..b2603f7 100644 --- a/src/main/java/com/refinedmods/refinedpipes/screen/BaseScreen.java +++ b/src/main/java/com/refinedmods/refinedpipes/screen/BaseScreen.java @@ -2,7 +2,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; -import com.refinedmods.refinedpipes.container.BaseContainer; +import com.refinedmods.refinedpipes.container.BaseContainerMenu; import com.refinedmods.refinedpipes.container.slot.FluidFilterSlot; import com.refinedmods.refinedpipes.render.FluidRenderer; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; @@ -10,13 +10,13 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraftforge.fluids.FluidStack; -public abstract class BaseScreen extends AbstractContainerScreen { +public abstract class BaseScreen extends AbstractContainerScreen { public BaseScreen(T screenContainer, Inventory inv, Component title) { super(screenContainer, inv, title); } @Override - protected void renderBg(PoseStack matrixStack, float partialTicks, int mouseX, int mouseY) { + protected void renderBg(PoseStack poseStack, float partialTicks, int mouseX, int mouseY) { RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); for (FluidFilterSlot slot : menu.getFluidSlots()) { @@ -30,7 +30,7 @@ protected void renderBg(PoseStack matrixStack, float partialTicks, int mouseX, i } @Override - protected void renderLabels(PoseStack matrixStack, int mouseX, int mouseY) { + protected void renderLabels(PoseStack poseStack, int mouseX, int mouseY) { for (FluidFilterSlot slot : menu.getFluidSlots()) { FluidStack stack = slot.getFluidInventory().getFluid(slot.getSlotIndex()); if (stack.isEmpty()) { @@ -41,7 +41,7 @@ protected void renderLabels(PoseStack matrixStack, int mouseX, int mouseY) { continue; } - renderTooltip(matrixStack, stack.getDisplayName(), mouseX - leftPos, mouseY - topPos); + renderTooltip(poseStack, stack.getDisplayName(), mouseX - leftPos, mouseY - topPos); } } } diff --git a/src/main/java/com/refinedmods/refinedpipes/screen/ExtractorAttachmentScreen.java b/src/main/java/com/refinedmods/refinedpipes/screen/ExtractorAttachmentScreen.java index dbdac99..df4e8d8 100644 --- a/src/main/java/com/refinedmods/refinedpipes/screen/ExtractorAttachmentScreen.java +++ b/src/main/java/com/refinedmods/refinedpipes/screen/ExtractorAttachmentScreen.java @@ -3,7 +3,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.refinedmods.refinedpipes.RefinedPipes; -import com.refinedmods.refinedpipes.container.ExtractorAttachmentContainer; +import com.refinedmods.refinedpipes.container.ExtractorAttachmentContainerMenu; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.BlacklistWhitelist; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.ExtractorAttachment; import com.refinedmods.refinedpipes.network.pipe.attachment.extractor.RedstoneMode; @@ -24,7 +24,7 @@ import java.util.ArrayList; import java.util.List; -public class ExtractorAttachmentScreen extends BaseScreen { +public class ExtractorAttachmentScreen extends BaseScreen { private static final ResourceLocation RESOURCE = new ResourceLocation(RefinedPipes.ID, "textures/gui/extractor_attachment.png"); private final List tooltip = new ArrayList<>(); @@ -40,7 +40,7 @@ public class ExtractorAttachmentScreen extends BaseScreen menu.getExtractorAttachmentType().getFilterSlots()) { - this.blit(matrixStack, i + x, j + y, 198, 0, 18, 18); + this.blit(poseStack, i + x, j + y, 198, 0, 18, 18); } if (filterSlotId % 5 == 0) { @@ -292,6 +292,6 @@ protected void renderBg(PoseStack matrixStack, float partialTicks, int mouseX, i } } - super.renderBg(matrixStack, partialTicks, mouseX, mouseY); + super.renderBg(poseStack, partialTicks, mouseX, mouseY); } } diff --git a/src/main/java/com/refinedmods/refinedpipes/screen/widget/IconButton.java b/src/main/java/com/refinedmods/refinedpipes/screen/widget/IconButton.java index eee5384..0b7a550 100644 --- a/src/main/java/com/refinedmods/refinedpipes/screen/widget/IconButton.java +++ b/src/main/java/com/refinedmods/refinedpipes/screen/widget/IconButton.java @@ -27,7 +27,7 @@ public void setOverlayTexX(int overlayTexX) { } @Override - public void renderButton(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) { + public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTicks) { RenderSystem.setShaderTexture(0, RESOURCE); RenderSystem.disableDepthTest(); @@ -39,10 +39,10 @@ public void renderButton(PoseStack matrixStack, int mouseX, int mouseY, float pa y = preset.getYTexHover(); } - blit(matrixStack, this.x, this.y, preset.getXTex(), y, this.width, this.height, 256, 256); + blit(poseStack, this.x, this.y, preset.getXTex(), y, this.width, this.height, 256, 256); // Fiddling with -1 to remove the blue border - blit(matrixStack, this.x + 1, this.y + 1, overlayTexX + 1, overlayTexY + 1, this.width - 2, this.height - 2, 256, 256); + blit(poseStack, this.x + 1, this.y + 1, overlayTexX + 1, overlayTexY + 1, this.width - 2, this.height - 2, 256, 256); RenderSystem.enableDepthTest(); } diff --git a/src/main/java/com/refinedmods/refinedpipes/setup/ClientSetup.java b/src/main/java/com/refinedmods/refinedpipes/setup/ClientSetup.java index fd9d3a3..5e40b0b 100644 --- a/src/main/java/com/refinedmods/refinedpipes/setup/ClientSetup.java +++ b/src/main/java/com/refinedmods/refinedpipes/setup/ClientSetup.java @@ -1,16 +1,16 @@ package com.refinedmods.refinedpipes.setup; import com.refinedmods.refinedpipes.RefinedPipes; +import com.refinedmods.refinedpipes.RefinedPipesBlockEntities; import com.refinedmods.refinedpipes.RefinedPipesBlocks; -import com.refinedmods.refinedpipes.RefinedPipesContainers; -import com.refinedmods.refinedpipes.RefinedPipesTileEntities; +import com.refinedmods.refinedpipes.RefinedPipesContainerMenus; import com.refinedmods.refinedpipes.network.pipe.attachment.AttachmentFactory; import com.refinedmods.refinedpipes.network.pipe.attachment.AttachmentRegistry; import com.refinedmods.refinedpipes.network.pipe.energy.EnergyPipeType; import com.refinedmods.refinedpipes.network.pipe.fluid.FluidPipeType; import com.refinedmods.refinedpipes.network.pipe.item.ItemPipeType; -import com.refinedmods.refinedpipes.render.FluidPipeTileEntityRenderer; -import com.refinedmods.refinedpipes.render.ItemPipeTileEntityRenderer; +import com.refinedmods.refinedpipes.render.FluidPipeBlockEntityRenderer; +import com.refinedmods.refinedpipes.render.ItemPipeBlockEntityRenderer; import com.refinedmods.refinedpipes.render.PipeBakedModel; import com.refinedmods.refinedpipes.screen.ExtractorAttachmentScreen; import net.minecraft.client.gui.screens.MenuScreens; @@ -71,7 +71,7 @@ public static void onClientSetup(FMLClientSetupEvent e) { ForgeModelBakery.addSpecialModel(new ResourceLocation(RefinedPipes.ID + ":block/pipe/attachment/inventory_attachment")); - MenuScreens.register(RefinedPipesContainers.EXTRACTOR_ATTACHMENT, ExtractorAttachmentScreen::new); + MenuScreens.register(RefinedPipesContainerMenus.EXTRACTOR_ATTACHMENT, ExtractorAttachmentScreen::new); ItemBlockRenderTypes.setRenderLayer(RefinedPipesBlocks.BASIC_ITEM_PIPE, RenderType.cutout()); ItemBlockRenderTypes.setRenderLayer(RefinedPipesBlocks.IMPROVED_ITEM_PIPE, RenderType.cutout()); @@ -83,15 +83,15 @@ public static void onClientSetup(FMLClientSetupEvent e) { ItemBlockRenderTypes.setRenderLayer(RefinedPipesBlocks.ELITE_FLUID_PIPE, RenderType.cutout()); ItemBlockRenderTypes.setRenderLayer(RefinedPipesBlocks.ULTIMATE_FLUID_PIPE, RenderType.cutout()); - BlockEntityRenderers.register(RefinedPipesTileEntities.BASIC_ITEM_PIPE, ctx -> new ItemPipeTileEntityRenderer()); - BlockEntityRenderers.register(RefinedPipesTileEntities.IMPROVED_ITEM_PIPE, ctx -> new ItemPipeTileEntityRenderer()); - BlockEntityRenderers.register(RefinedPipesTileEntities.ADVANCED_ITEM_PIPE, ctx -> new ItemPipeTileEntityRenderer()); + BlockEntityRenderers.register(RefinedPipesBlockEntities.BASIC_ITEM_PIPE, ctx -> new ItemPipeBlockEntityRenderer()); + BlockEntityRenderers.register(RefinedPipesBlockEntities.IMPROVED_ITEM_PIPE, ctx -> new ItemPipeBlockEntityRenderer()); + BlockEntityRenderers.register(RefinedPipesBlockEntities.ADVANCED_ITEM_PIPE, ctx -> new ItemPipeBlockEntityRenderer()); - BlockEntityRenderers.register(RefinedPipesTileEntities.BASIC_FLUID_PIPE, ctx -> new FluidPipeTileEntityRenderer()); - BlockEntityRenderers.register(RefinedPipesTileEntities.IMPROVED_FLUID_PIPE, ctx -> new FluidPipeTileEntityRenderer()); - BlockEntityRenderers.register(RefinedPipesTileEntities.ADVANCED_FLUID_PIPE, ctx -> new FluidPipeTileEntityRenderer()); - BlockEntityRenderers.register(RefinedPipesTileEntities.ELITE_FLUID_PIPE, ctx -> new FluidPipeTileEntityRenderer()); - BlockEntityRenderers.register(RefinedPipesTileEntities.ULTIMATE_FLUID_PIPE, ctx -> new FluidPipeTileEntityRenderer()); + BlockEntityRenderers.register(RefinedPipesBlockEntities.BASIC_FLUID_PIPE, ctx -> new FluidPipeBlockEntityRenderer()); + BlockEntityRenderers.register(RefinedPipesBlockEntities.IMPROVED_FLUID_PIPE, ctx -> new FluidPipeBlockEntityRenderer()); + BlockEntityRenderers.register(RefinedPipesBlockEntities.ADVANCED_FLUID_PIPE, ctx -> new FluidPipeBlockEntityRenderer()); + BlockEntityRenderers.register(RefinedPipesBlockEntities.ELITE_FLUID_PIPE, ctx -> new FluidPipeBlockEntityRenderer()); + BlockEntityRenderers.register(RefinedPipesBlockEntities.ULTIMATE_FLUID_PIPE, ctx -> new FluidPipeBlockEntityRenderer()); } @SubscribeEvent diff --git a/src/main/java/com/refinedmods/refinedpipes/setup/CommonSetup.java b/src/main/java/com/refinedmods/refinedpipes/setup/CommonSetup.java index afdd1d6..8aa7839 100644 --- a/src/main/java/com/refinedmods/refinedpipes/setup/CommonSetup.java +++ b/src/main/java/com/refinedmods/refinedpipes/setup/CommonSetup.java @@ -5,6 +5,9 @@ import com.refinedmods.refinedpipes.block.EnergyPipeBlock; import com.refinedmods.refinedpipes.block.FluidPipeBlock; import com.refinedmods.refinedpipes.block.ItemPipeBlock; +import com.refinedmods.refinedpipes.blockentity.EnergyPipeBlockEntity; +import com.refinedmods.refinedpipes.blockentity.FluidPipeBlockEntity; +import com.refinedmods.refinedpipes.blockentity.ItemPipeBlockEntity; import com.refinedmods.refinedpipes.container.factory.ExtractorAttachmentContainerFactory; import com.refinedmods.refinedpipes.item.AttachmentItem; import com.refinedmods.refinedpipes.item.EnergyPipeBlockItem; @@ -36,9 +39,6 @@ import com.refinedmods.refinedpipes.network.pipe.transport.callback.ItemInsertTransportCallback; import com.refinedmods.refinedpipes.network.pipe.transport.callback.ItemPipeGoneTransportCallback; import com.refinedmods.refinedpipes.network.pipe.transport.callback.TransportCallbackFactoryRegistry; -import com.refinedmods.refinedpipes.tile.EnergyPipeTileEntity; -import com.refinedmods.refinedpipes.tile.FluidPipeTileEntity; -import com.refinedmods.refinedpipes.tile.ItemPipeTileEntity; import net.minecraft.world.inventory.MenuType; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; @@ -131,31 +131,31 @@ public static void onRegisterItems(RegistryEvent.Register e) { } @SubscribeEvent - public static void onRegisterTileEntities(RegistryEvent.Register> e) { - e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new ItemPipeTileEntity(pos, state, ItemPipeType.BASIC), RefinedPipesBlocks.BASIC_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.BASIC.getId())); - e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new ItemPipeTileEntity(pos, state, ItemPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.IMPROVED.getId())); - e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new ItemPipeTileEntity(pos, state, ItemPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.ADVANCED.getId())); - - e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new FluidPipeTileEntity(pos, state, FluidPipeType.BASIC), RefinedPipesBlocks.BASIC_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.BASIC.getId())); - e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new FluidPipeTileEntity(pos, state, FluidPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.IMPROVED.getId())); - e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new FluidPipeTileEntity(pos, state, FluidPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ADVANCED.getId())); - e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new FluidPipeTileEntity(pos, state, FluidPipeType.ELITE), RefinedPipesBlocks.ELITE_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ELITE.getId())); - e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new FluidPipeTileEntity(pos, state, FluidPipeType.ULTIMATE), RefinedPipesBlocks.ULTIMATE_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ULTIMATE.getId())); - - e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new EnergyPipeTileEntity(pos, state, EnergyPipeType.BASIC), RefinedPipesBlocks.BASIC_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.BASIC.getId())); - e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new EnergyPipeTileEntity(pos, state, EnergyPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.IMPROVED.getId())); - e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new EnergyPipeTileEntity(pos, state, EnergyPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ADVANCED.getId())); - e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new EnergyPipeTileEntity(pos, state, EnergyPipeType.ELITE), RefinedPipesBlocks.ELITE_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ELITE.getId())); - e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new EnergyPipeTileEntity(pos, state, EnergyPipeType.ULTIMATE), RefinedPipesBlocks.ULTIMATE_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ULTIMATE.getId())); + public static void onRegisterBlockEntities(RegistryEvent.Register> e) { + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new ItemPipeBlockEntity(pos, state, ItemPipeType.BASIC), RefinedPipesBlocks.BASIC_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.BASIC.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new ItemPipeBlockEntity(pos, state, ItemPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.IMPROVED.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new ItemPipeBlockEntity(pos, state, ItemPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_ITEM_PIPE).build(null).setRegistryName(ItemPipeType.ADVANCED.getId())); + + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new FluidPipeBlockEntity(pos, state, FluidPipeType.BASIC), RefinedPipesBlocks.BASIC_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.BASIC.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new FluidPipeBlockEntity(pos, state, FluidPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.IMPROVED.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new FluidPipeBlockEntity(pos, state, FluidPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ADVANCED.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new FluidPipeBlockEntity(pos, state, FluidPipeType.ELITE), RefinedPipesBlocks.ELITE_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ELITE.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new FluidPipeBlockEntity(pos, state, FluidPipeType.ULTIMATE), RefinedPipesBlocks.ULTIMATE_FLUID_PIPE).build(null).setRegistryName(FluidPipeType.ULTIMATE.getId())); + + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new EnergyPipeBlockEntity(pos, state, EnergyPipeType.BASIC), RefinedPipesBlocks.BASIC_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.BASIC.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new EnergyPipeBlockEntity(pos, state, EnergyPipeType.IMPROVED), RefinedPipesBlocks.IMPROVED_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.IMPROVED.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new EnergyPipeBlockEntity(pos, state, EnergyPipeType.ADVANCED), RefinedPipesBlocks.ADVANCED_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ADVANCED.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new EnergyPipeBlockEntity(pos, state, EnergyPipeType.ELITE), RefinedPipesBlocks.ELITE_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ELITE.getId())); + e.getRegistry().register(BlockEntityType.Builder.of((pos, state) -> new EnergyPipeBlockEntity(pos, state, EnergyPipeType.ULTIMATE), RefinedPipesBlocks.ULTIMATE_ENERGY_PIPE).build(null).setRegistryName(EnergyPipeType.ULTIMATE.getId())); } @SubscribeEvent - public static void onRegisterContainers(RegistryEvent.Register> e) { + public static void onRegisterContainerMenus(RegistryEvent.Register> e) { e.getRegistry().register(IForgeMenuType.create(new ExtractorAttachmentContainerFactory()).setRegistryName(RefinedPipes.ID, "extractor_attachment")); } @SubscribeEvent - public static void onWorldTick(TickEvent.WorldTickEvent e) { + public static void onLevelTick(TickEvent.WorldTickEvent e) { if (!e.world.isClientSide && e.phase == TickEvent.Phase.END) { NetworkManager.get(e.world).getNetworks().forEach(n -> n.update(e.world)); } From 16ef98db70e3c2718e58ad1f26120236198c7ae3 Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Fri, 17 Dec 2021 23:34:03 +0100 Subject: [PATCH 6/6] Upgrade Gradle --- gradle/wrapper/gradle-wrapper.jar | Bin 59203 -> 59536 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 257 ++++++++++++++--------- 3 files changed, 154 insertions(+), 105 deletions(-) mode change 100755 => 100644 gradlew diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c023ec8b20f512888fe07c5bd3ff77bb8f..7454180f2ae8848c63b8b4dea2cb829da983f2fa 100644 GIT binary patch delta 18435 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 B8dv}T delta 17845 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 X49Luk)baa85H9$5YCsTPT`SVRWMtMW diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 05679dc..e750102 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew old mode 100755 new mode 100644 index 4f906e0..c53aefa --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@"