diff --git a/build.gradle b/build.gradle index 1354b69..b6e1bf7 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,7 @@ if (System.getenv('BUILD_NUMBER') != null) { java.toolchain.languageVersion = JavaLanguageVersion.of(17) minecraft { - mappings channel: 'official', version: '1.18.2' + mappings channel: 'official', version: '1.19' runs { client { @@ -105,11 +105,11 @@ configurations { } dependencies { - minecraft 'net.minecraftforge:forge:1.18.2-40.0.32' + minecraft 'net.minecraftforge:forge:1.19-41.0.45' embed 'org.jgrapht:jgrapht-core:1.5.1' - compileOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.5.174:api") - runtimeOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.5.174") + compileOnly fg.deobf("mezz.jei:jei-1.19-forge-api:11.0.0.206") + runtimeOnly fg.deobf("mezz.jei:jei-1.19-forge:11.0.0.206") // to test the rf requiring and crafting stuff /* runtimeOnly fg.deobf("curse.maven:powah-352656:3057732") diff --git a/src/main/java/de/ellpeck/prettypipes/Registry.java b/src/main/java/de/ellpeck/prettypipes/Registry.java index 6c36e3e..8ba202f 100644 --- a/src/main/java/de/ellpeck/prettypipes/Registry.java +++ b/src/main/java/de/ellpeck/prettypipes/Registry.java @@ -52,6 +52,7 @@ import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; import net.minecraft.client.renderer.entity.EntityRenderers; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.inventory.MenuType; @@ -65,18 +66,14 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.capabilities.CapabilityToken; import net.minecraftforge.common.extensions.IForgeMenuType; -import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.IForgeRegistry; +import net.minecraftforge.registries.RegisterEvent; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; import java.util.Locale; import java.util.function.BiFunction; @@ -86,7 +83,7 @@ public final class Registry { public static final CreativeModeTab TAB = new CreativeModeTab(PrettyPipes.ID) { @Override public ItemStack makeIcon() { - return new ItemStack(wrenchItem); + return new ItemStack(Registry.wrenchItem); } }; @@ -125,89 +122,84 @@ public final class Registry { public static MenuType filterModifierModuleContainer; @SubscribeEvent - public static void registerBlocks(RegistryEvent.Register event) { - event.getRegistry().registerAll( - pipeBlock = new PipeBlock().setRegistryName("pipe"), - itemTerminalBlock = new ItemTerminalBlock().setRegistryName("item_terminal"), - craftingTerminalBlock = new CraftingTerminalBlock().setRegistryName("crafting_terminal"), - pressurizerBlock = new PressurizerBlock().setRegistryName("pressurizer") - ); + public static void register(RegisterEvent event) { + event.register(ForgeRegistries.Keys.BLOCKS, h -> { + h.register(new ResourceLocation(PrettyPipes.ID, "pipe"), Registry.pipeBlock = new PipeBlock()); + h.register(new ResourceLocation(PrettyPipes.ID, "item_terminal"), Registry.itemTerminalBlock = new ItemTerminalBlock()); + h.register(new ResourceLocation(PrettyPipes.ID, "crafting_terminal"), Registry.craftingTerminalBlock = new CraftingTerminalBlock()); + h.register(new ResourceLocation(PrettyPipes.ID, "pressurizer"), Registry.pressurizerBlock = new PressurizerBlock()); + }); + + event.register(ForgeRegistries.Keys.ITEMS, h -> { + h.register(new ResourceLocation(PrettyPipes.ID, "wrench"), Registry.wrenchItem = new WrenchItem()); + h.register(new ResourceLocation(PrettyPipes.ID, "blank_module"), new Item(new Item.Properties().tab(Registry.TAB))); + h.register(new ResourceLocation(PrettyPipes.ID, "pipe_frame"), Registry.pipeFrameItem = new PipeFrameItem()); + h.register(new ResourceLocation(PrettyPipes.ID, "stack_size_module"), new StackSizeModuleItem()); + h.register(new ResourceLocation(PrettyPipes.ID, "redstone_module"), new RedstoneModuleItem()); + h.register(new ResourceLocation(PrettyPipes.ID, "filter_increase_modifier"), new FilterIncreaseModuleItem()); + + Registry.registerTieredModule(h, "extraction_module", ExtractionModuleItem::new); + Registry.registerTieredModule(h, "filter_module", FilterModuleItem::new); + Registry.registerTieredModule(h, "speed_module", SpeedModuleItem::new); + Registry.registerTieredModule(h, "low_priority_module", LowPriorityModuleItem::new); + Registry.registerTieredModule(h, "high_priority_module", HighPriorityModuleItem::new); + Registry.registerTieredModule(h, "retrieval_module", RetrievalModuleItem::new); + Registry.registerTieredModule(h, "crafting_module", CraftingModuleItem::new); + + for (var type : ItemEquality.Type.values()) { + var name = type.name().toLowerCase(Locale.ROOT) + "_filter_modifier"; + h.register(new ResourceLocation(PrettyPipes.ID, name), new FilterModifierModuleItem(name, type)); + } + for (var type : SortingModuleItem.Type.values()) { + var name = type.name().toLowerCase(Locale.ROOT) + "_sorting_modifier"; + h.register(new ResourceLocation(PrettyPipes.ID, name), new SortingModuleItem(name, type)); + } + + ForgeRegistries.BLOCKS.getEntries().stream() + .filter(b -> b.getKey().location().getNamespace().equals(PrettyPipes.ID)) + .forEach(b -> h.register(b.getKey().location(), new BlockItem(b.getValue(), new Item.Properties().tab(Registry.TAB)))); + }); + + event.register(ForgeRegistries.Keys.BLOCK_ENTITY_TYPES, h -> { + h.register(new ResourceLocation(PrettyPipes.ID, "pipe"), Registry.pipeBlockEntity = BlockEntityType.Builder.of(PipeBlockEntity::new, Registry.pipeBlock).build(null)); + h.register(new ResourceLocation(PrettyPipes.ID, "item_terminal"), Registry.itemTerminalBlockEntity = BlockEntityType.Builder.of(ItemTerminalBlockEntity::new, Registry.itemTerminalBlock).build(null)); + h.register(new ResourceLocation(PrettyPipes.ID, "crafting_terminal"), Registry.craftingTerminalBlockEntity = BlockEntityType.Builder.of(CraftingTerminalBlockEntity::new, Registry.craftingTerminalBlock).build(null)); + h.register(new ResourceLocation(PrettyPipes.ID, "pressurizer"), Registry.pressurizerBlockEntity = BlockEntityType.Builder.of(PressurizerBlockEntity::new, Registry.pressurizerBlock).build(null)); + }); + + event.register(ForgeRegistries.Keys.ENTITY_TYPES, h -> + h.register(new ResourceLocation(PrettyPipes.ID, "pipe_frame"), Registry.pipeFrameEntity = EntityType.Builder.of(PipeFrameEntity::new, MobCategory.MISC).build("pipe_frame"))); + + event.register(ForgeRegistries.Keys.CONTAINER_TYPES, h -> { + h.register(new ResourceLocation(PrettyPipes.ID, "pipe"), Registry.pipeContainer = IForgeMenuType.create((windowId, inv, data) -> new MainPipeContainer(Registry.pipeContainer, windowId, inv.player, data.readBlockPos()))); + h.register(new ResourceLocation(PrettyPipes.ID, "item_terminal"), Registry.itemTerminalContainer = IForgeMenuType.create((windowId, inv, data) -> new ItemTerminalContainer(Registry.itemTerminalContainer, windowId, inv.player, data.readBlockPos()))); + h.register(new ResourceLocation(PrettyPipes.ID, "crafting_terminal"), Registry.craftingTerminalContainer = IForgeMenuType.create((windowId, inv, data) -> new CraftingTerminalContainer(Registry.craftingTerminalContainer, windowId, inv.player, data.readBlockPos()))); + h.register(new ResourceLocation(PrettyPipes.ID, "pressurizer"), Registry.pressurizerContainer = IForgeMenuType.create((windowId, inv, data) -> new PressurizerContainer(Registry.pressurizerContainer, windowId, inv.player, data.readBlockPos()))); + + Registry.extractionModuleContainer = Registry.registerPipeContainer(h, "extraction_module"); + Registry.filterModuleContainer = Registry.registerPipeContainer(h, "filter_module"); + Registry.retrievalModuleContainer = Registry.registerPipeContainer(h, "retrieval_module"); + Registry.stackSizeModuleContainer = Registry.registerPipeContainer(h, "stack_size_module"); + Registry.filterIncreaseModuleContainer = Registry.registerPipeContainer(h, "filter_increase_module"); + Registry.craftingModuleContainer = Registry.registerPipeContainer(h, "crafting_module"); + Registry.filterModifierModuleContainer = Registry.registerPipeContainer(h, "filter_modifier_module"); + }); } - @SubscribeEvent - public static void registerItems(RegistryEvent.Register event) { - var registry = event.getRegistry(); - registry.registerAll( - wrenchItem = new WrenchItem().setRegistryName("wrench"), - new Item(new Item.Properties().tab(TAB)).setRegistryName("blank_module"), - pipeFrameItem = new PipeFrameItem().setRegistryName("pipe_frame") - ); - registry.registerAll(createTieredModule("extraction_module", ExtractionModuleItem::new)); - registry.registerAll(createTieredModule("filter_module", FilterModuleItem::new)); - registry.registerAll(createTieredModule("speed_module", SpeedModuleItem::new)); - registry.registerAll(createTieredModule("low_priority_module", LowPriorityModuleItem::new)); - registry.registerAll(createTieredModule("high_priority_module", HighPriorityModuleItem::new)); - registry.registerAll(createTieredModule("retrieval_module", RetrievalModuleItem::new)); - registry.register(new StackSizeModuleItem("stack_size_module")); - registry.registerAll(Arrays.stream(ItemEquality.Type.values()).map(t -> new FilterModifierModuleItem(t.name().toLowerCase(Locale.ROOT) + "_filter_modifier", t)).toArray(Item[]::new)); - registry.register(new RedstoneModuleItem("redstone_module")); - registry.register(new FilterIncreaseModuleItem("filter_increase_modifier")); - registry.registerAll(createTieredModule("crafting_module", CraftingModuleItem::new)); - registry.registerAll(Arrays.stream(SortingModuleItem.Type.values()).map(t -> new SortingModuleItem(t.name().toLowerCase(Locale.ROOT) + "_sorting_modifier", t)).toArray(Item[]::new)); - - ForgeRegistries.BLOCKS.getValues().stream() - .filter(b -> b.getRegistryName().getNamespace().equals(PrettyPipes.ID)) - .forEach(b -> registry.register(new BlockItem(b, new Item.Properties().tab(TAB)).setRegistryName(b.getRegistryName()))); - } - - @SubscribeEvent - public static void registerBlockEntities(RegistryEvent.Register> event) { - event.getRegistry().registerAll( - pipeBlockEntity = (BlockEntityType) BlockEntityType.Builder.of(PipeBlockEntity::new, pipeBlock).build(null).setRegistryName("pipe"), - itemTerminalBlockEntity = (BlockEntityType) BlockEntityType.Builder.of(ItemTerminalBlockEntity::new, itemTerminalBlock).build(null).setRegistryName("item_terminal"), - craftingTerminalBlockEntity = (BlockEntityType) BlockEntityType.Builder.of(CraftingTerminalBlockEntity::new, craftingTerminalBlock).build(null).setRegistryName("crafting_terminal"), - pressurizerBlockEntity = (BlockEntityType) BlockEntityType.Builder.of(PressurizerBlockEntity::new, pressurizerBlock).build(null).setRegistryName("pressurizer") - ); - } - - @SubscribeEvent - public static void registerEntities(RegistryEvent.Register> event) { - event.getRegistry().registerAll( - pipeFrameEntity = (EntityType) EntityType.Builder.of(PipeFrameEntity::new, MobCategory.MISC).build("pipe_frame").setRegistryName("pipe_frame") - ); - } - - @SubscribeEvent - public static void registerContainers(RegistryEvent.Register> event) { - event.getRegistry().registerAll( - pipeContainer = (MenuType) IForgeMenuType.create((windowId, inv, data) -> new MainPipeContainer(pipeContainer, windowId, inv.player, data.readBlockPos())).setRegistryName("pipe"), - itemTerminalContainer = (MenuType) IForgeMenuType.create((windowId, inv, data) -> new ItemTerminalContainer(itemTerminalContainer, windowId, inv.player, data.readBlockPos())).setRegistryName("item_terminal"), - craftingTerminalContainer = (MenuType) IForgeMenuType.create((windowId, inv, data) -> new CraftingTerminalContainer(craftingTerminalContainer, windowId, inv.player, data.readBlockPos())).setRegistryName("crafting_terminal"), - pressurizerContainer = (MenuType) IForgeMenuType.create((windowId, inv, data) -> new PressurizerContainer(pressurizerContainer, windowId, inv.player, data.readBlockPos())).setRegistryName("pressurizer"), - extractionModuleContainer = createPipeContainer("extraction_module"), - filterModuleContainer = createPipeContainer("filter_module"), - retrievalModuleContainer = createPipeContainer("retrieval_module"), - stackSizeModuleContainer = createPipeContainer("stack_size_module"), - filterIncreaseModuleContainer = createPipeContainer("filter_increase_module"), - craftingModuleContainer = createPipeContainer("crafting_module"), - filterModifierModuleContainer = createPipeContainer("filter_modifier_module") - ); - } - - private static > MenuType createPipeContainer(String name) { - return (MenuType) IForgeMenuType.create((windowId, inv, data) -> { + private static > MenuType registerPipeContainer(RegisterEvent.RegisterHelper> helper, String name) { + var type = (MenuType) IForgeMenuType.create((windowId, inv, data) -> { var tile = Utility.getBlockEntity(PipeBlockEntity.class, inv.player.level, data.readBlockPos()); var moduleIndex = data.readInt(); var moduleStack = tile.modules.getStackInSlot(moduleIndex); return ((IModule) moduleStack.getItem()).getContainer(moduleStack, tile, windowId, inv, inv.player, moduleIndex); - }).setRegistryName(name); + }); + helper.register(new ResourceLocation(PrettyPipes.ID, name), type); + return type; } - private static Item[] createTieredModule(String name, BiFunction item) { - List items = new ArrayList<>(); + private static void registerTieredModule(RegisterEvent.RegisterHelper helper, String name, BiFunction item) { for (var tier : ModuleTier.values()) - items.add(item.apply(name, tier).setRegistryName(tier.name().toLowerCase(Locale.ROOT) + "_" + name)); - return items.toArray(new Item[0]); + helper.register(new ResourceLocation(PrettyPipes.ID, tier.name().toLowerCase(Locale.ROOT) + "_" + name), item.apply(name, tier)); } public static void setup(FMLCommonSetupEvent event) { @@ -217,21 +209,21 @@ public final class Registry { public static final class Client { public static void setup(FMLClientSetupEvent event) { - ItemBlockRenderTypes.setRenderLayer(pipeBlock, RenderType.cutout()); - BlockEntityRenderers.register(pipeBlockEntity, PipeRenderer::new); - EntityRenderers.register(pipeFrameEntity, PipeFrameRenderer::new); + ItemBlockRenderTypes.setRenderLayer(Registry.pipeBlock, RenderType.cutout()); + BlockEntityRenderers.register(Registry.pipeBlockEntity, PipeRenderer::new); + EntityRenderers.register(Registry.pipeFrameEntity, PipeFrameRenderer::new); - MenuScreens.register(pipeContainer, MainPipeGui::new); - MenuScreens.register(itemTerminalContainer, ItemTerminalGui::new); - MenuScreens.register(pressurizerContainer, PressurizerGui::new); - MenuScreens.register(craftingTerminalContainer, CraftingTerminalGui::new); - MenuScreens.register(extractionModuleContainer, ExtractionModuleGui::new); - MenuScreens.register(filterModuleContainer, FilterModuleGui::new); - MenuScreens.register(retrievalModuleContainer, RetrievalModuleGui::new); - MenuScreens.register(stackSizeModuleContainer, StackSizeModuleGui::new); - MenuScreens.register(filterIncreaseModuleContainer, FilterIncreaseModuleGui::new); - MenuScreens.register(craftingModuleContainer, CraftingModuleGui::new); - MenuScreens.register(filterModifierModuleContainer, FilterModifierModuleGui::new); + MenuScreens.register(Registry.pipeContainer, MainPipeGui::new); + MenuScreens.register(Registry.itemTerminalContainer, ItemTerminalGui::new); + MenuScreens.register(Registry.pressurizerContainer, PressurizerGui::new); + MenuScreens.register(Registry.craftingTerminalContainer, CraftingTerminalGui::new); + MenuScreens.register(Registry.extractionModuleContainer, ExtractionModuleGui::new); + MenuScreens.register(Registry.filterModuleContainer, FilterModuleGui::new); + MenuScreens.register(Registry.retrievalModuleContainer, RetrievalModuleGui::new); + MenuScreens.register(Registry.stackSizeModuleContainer, StackSizeModuleGui::new); + MenuScreens.register(Registry.filterIncreaseModuleContainer, FilterIncreaseModuleGui::new); + MenuScreens.register(Registry.craftingModuleContainer, CraftingModuleGui::new); + MenuScreens.register(Registry.filterModifierModuleContainer, FilterModifierModuleGui::new); } } } diff --git a/src/main/java/de/ellpeck/prettypipes/Utility.java b/src/main/java/de/ellpeck/prettypipes/Utility.java index f851dac..c030cf0 100644 --- a/src/main/java/de/ellpeck/prettypipes/Utility.java +++ b/src/main/java/de/ellpeck/prettypipes/Utility.java @@ -7,7 +7,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; -import net.minecraft.network.chat.*; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.Style; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.Containers; @@ -54,9 +55,9 @@ public final class Utility { if (Screen.hasShiftDown()) { var content = I18n.get("info." + PrettyPipes.ID + "." + name).split("\n"); for (var s : content) - tooltip.add(new TextComponent(s).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GRAY))); + tooltip.add(Component.literal(s).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GRAY))); } else { - tooltip.add(new TranslatableComponent("info." + PrettyPipes.ID + ".shift").setStyle(Style.EMPTY.applyFormat(ChatFormatting.DARK_GRAY))); + tooltip.add(Component.translatable("info." + PrettyPipes.ID + ".shift").setStyle(Style.EMPTY.applyFormat(ChatFormatting.DARK_GRAY))); } } diff --git a/src/main/java/de/ellpeck/prettypipes/compat/jei/CraftingModuleTransferHandler.java b/src/main/java/de/ellpeck/prettypipes/compat/jei/CraftingModuleTransferHandler.java index 201b373..49766c7 100644 --- a/src/main/java/de/ellpeck/prettypipes/compat/jei/CraftingModuleTransferHandler.java +++ b/src/main/java/de/ellpeck/prettypipes/compat/jei/CraftingModuleTransferHandler.java @@ -1,18 +1,7 @@ package de.ellpeck.prettypipes.compat.jei; -import de.ellpeck.prettypipes.misc.ItemEquality; -import de.ellpeck.prettypipes.packets.PacketCraftingModuleTransfer; -import de.ellpeck.prettypipes.packets.PacketHandler; -import de.ellpeck.prettypipes.pipe.modules.craft.CraftingModuleContainer; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.recipe.transfer.IRecipeTransferError; -import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.CraftingRecipe; - -import java.util.ArrayList; - +// TODO JEI +/* public class CraftingModuleTransferHandler implements IRecipeTransferHandler { @Override @@ -54,3 +43,4 @@ public class CraftingModuleTransferHandler implements IRecipeTransferHandler { @Override @@ -40,3 +29,4 @@ public class CraftingTerminalTransferHandler implements IRecipeTransferHandler i.getItemAmount(this.level, stack)).sum(); - this.entityData.set(AMOUNT, amount); + this.entityData.set(PipeFrameEntity.AMOUNT, amount); return; } } } - this.entityData.set(AMOUNT, -1); + this.entityData.set(PipeFrameEntity.AMOUNT, -1); } @Override public boolean survives() { - return super.survives() && canPlace(this.level, this.pos, this.direction); + return super.survives() && PipeFrameEntity.canPlace(this.level, this.pos, this.direction); } private static BlockPos getAttachedPipe(Level world, BlockPos pos, Direction direction) { @@ -85,11 +85,11 @@ public class PipeFrameEntity extends ItemFrame implements IEntityAdditionalSpawn } public static boolean canPlace(Level world, BlockPos pos, Direction direction) { - return getAttachedPipe(world, pos, direction) != null; + return PipeFrameEntity.getAttachedPipe(world, pos, direction) != null; } public int getAmount() { - return this.entityData.get(AMOUNT); + return this.entityData.get(PipeFrameEntity.AMOUNT); } @Override diff --git a/src/main/java/de/ellpeck/prettypipes/items/PipeFrameItem.java b/src/main/java/de/ellpeck/prettypipes/items/PipeFrameItem.java index 76b705f..7ec9bec 100644 --- a/src/main/java/de/ellpeck/prettypipes/items/PipeFrameItem.java +++ b/src/main/java/de/ellpeck/prettypipes/items/PipeFrameItem.java @@ -15,6 +15,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; +import net.minecraftforge.registries.ForgeRegistries; import javax.annotation.Nullable; import java.util.List; @@ -65,6 +66,6 @@ public class PipeFrameItem extends Item { @Override public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { super.appendHoverText(stack, worldIn, tooltip, flagIn); - Utility.addTooltip(this.getRegistryName().getPath(), tooltip); + Utility.addTooltip(ForgeRegistries.ITEMS.getKey(this).getPath(), tooltip); } } diff --git a/src/main/java/de/ellpeck/prettypipes/items/WrenchItem.java b/src/main/java/de/ellpeck/prettypipes/items/WrenchItem.java index 22b7fe2..2c50351 100644 --- a/src/main/java/de/ellpeck/prettypipes/items/WrenchItem.java +++ b/src/main/java/de/ellpeck/prettypipes/items/WrenchItem.java @@ -20,6 +20,7 @@ import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; +import net.minecraftforge.registries.ForgeRegistries; import java.util.List; @@ -108,7 +109,7 @@ public class WrenchItem extends Item { @Override public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { - Utility.addTooltip(this.getRegistryName().getPath(), tooltip); + Utility.addTooltip(ForgeRegistries.ITEMS.getKey(this).getPath(), tooltip); } @Override diff --git a/src/main/java/de/ellpeck/prettypipes/misc/Events.java b/src/main/java/de/ellpeck/prettypipes/misc/Events.java index 3fbe9c1..404e930 100644 --- a/src/main/java/de/ellpeck/prettypipes/misc/Events.java +++ b/src/main/java/de/ellpeck/prettypipes/misc/Events.java @@ -3,7 +3,7 @@ package de.ellpeck.prettypipes.misc; import de.ellpeck.prettypipes.PrettyPipes; import de.ellpeck.prettypipes.network.PipeNetwork; import net.minecraft.commands.Commands; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.Level; import net.minecraftforge.event.AttachCapabilitiesEvent; @@ -33,9 +33,9 @@ public final class Events { var dump = PipeNetwork.get(source.getLevel()).toString(); try { Files.writeString(file, dump, StandardCharsets.UTF_8); - source.sendSuccess(new TextComponent("Wrote network dump to file " + file.toAbsolutePath()), true); + source.sendSuccess(Component.literal("Wrote network dump to file " + file.toAbsolutePath()), true); } catch (IOException e) { - source.sendFailure(new TextComponent("Failed to write network dump to file " + file.toAbsolutePath())); + source.sendFailure(Component.literal("Failed to write network dump to file " + file.toAbsolutePath())); return -1; } return 0; @@ -43,13 +43,13 @@ public final class Events { .then(Commands.literal("uncache").executes(c -> { var source = c.getSource(); PipeNetwork.get(source.getLevel()).clearCaches(); - source.sendSuccess(new TextComponent("Cleared all pipe caches in the world"), true); + source.sendSuccess(Component.literal("Cleared all pipe caches in the world"), true); return 0; })) .then(Commands.literal("unlock").executes(c -> { var source = c.getSource(); PipeNetwork.get(source.getLevel()).unlock(); - source.sendSuccess(new TextComponent("Resolved all network locks in the world"), true); + source.sendSuccess(Component.literal("Resolved all network locks in the world"), true); return 0; }))); } diff --git a/src/main/java/de/ellpeck/prettypipes/misc/ItemFilter.java b/src/main/java/de/ellpeck/prettypipes/misc/ItemFilter.java index ee5f585..dbdf725 100644 --- a/src/main/java/de/ellpeck/prettypipes/misc/ItemFilter.java +++ b/src/main/java/de/ellpeck/prettypipes/misc/ItemFilter.java @@ -11,7 +11,7 @@ import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.network.chat.Component; import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; @@ -51,17 +51,17 @@ public class ItemFilter extends ItemStackHandler { public List getButtons(Screen gui, int x, int y) { List buttons = new ArrayList<>(); if (this.canModifyWhitelist) { - var whitelistText = (Supplier) () -> new TranslatableComponent("info." + PrettyPipes.ID + "." + (this.isWhitelist ? "whitelist" : "blacklist")); + Supplier whitelistText = () -> Component.translatable("info." + PrettyPipes.ID + "." + (this.isWhitelist ? "whitelist" : "blacklist")); buttons.add(new Button(x, y, 70, 20, whitelistText.get(), button -> { PacketButton.sendAndExecute(this.pipe.getBlockPos(), PacketButton.ButtonResult.FILTER_CHANGE, 0); button.setMessage(whitelistText.get()); })); } if (this.canPopulateFromInventories) { - buttons.add(new Button(x + 72, y, 70, 20, new TranslatableComponent("info." + PrettyPipes.ID + ".populate"), button -> PacketButton.sendAndExecute(this.pipe.getBlockPos(), PacketButton.ButtonResult.FILTER_CHANGE, 1)) { + buttons.add(new Button(x + 72, y, 70, 20, Component.translatable("info." + PrettyPipes.ID + ".populate"), button -> PacketButton.sendAndExecute(this.pipe.getBlockPos(), PacketButton.ButtonResult.FILTER_CHANGE, 1)) { @Override public void renderToolTip(PoseStack matrix, int x, int y) { - gui.renderTooltip(matrix, new TranslatableComponent("info." + PrettyPipes.ID + ".populate.description").withStyle(ChatFormatting.GRAY), x, y); + gui.renderTooltip(matrix, Component.translatable("info." + PrettyPipes.ID + ".populate.description").withStyle(ChatFormatting.GRAY), x, y); } }); } @@ -107,7 +107,7 @@ public class ItemFilter extends ItemStackHandler { } private boolean isFiltered(ItemStack stack) { - var types = getEqualityTypes(this.pipe); + var types = ItemFilter.getEqualityTypes(this.pipe); // also check if any filter increase modules have the item we need for (ItemStackHandler handler : this.pipe.getFilters()) { for (var i = 0; i < handler.getSlots(); i++) { @@ -164,6 +164,7 @@ public class ItemFilter extends ItemStackHandler { ItemFilter getFilter(); - default void onFilterPopulated() {} + default void onFilterPopulated() { + } } } diff --git a/src/main/java/de/ellpeck/prettypipes/misc/ItemOrder.java b/src/main/java/de/ellpeck/prettypipes/misc/ItemOrder.java index bf40ba1..8da32ce 100644 --- a/src/main/java/de/ellpeck/prettypipes/misc/ItemOrder.java +++ b/src/main/java/de/ellpeck/prettypipes/misc/ItemOrder.java @@ -16,6 +16,6 @@ public enum ItemOrder { } public ItemOrder next() { - return values()[(this.ordinal() + 1) % values().length]; + return ItemOrder.values()[(this.ordinal() + 1) % ItemOrder.values().length]; } } diff --git a/src/main/java/de/ellpeck/prettypipes/misc/ItemTerminalWidget.java b/src/main/java/de/ellpeck/prettypipes/misc/ItemTerminalWidget.java index 890c5d8..5b703c1 100644 --- a/src/main/java/de/ellpeck/prettypipes/misc/ItemTerminalWidget.java +++ b/src/main/java/de/ellpeck/prettypipes/misc/ItemTerminalWidget.java @@ -4,9 +4,11 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import de.ellpeck.prettypipes.terminal.containers.ItemTerminalGui; import net.minecraft.ChatFormatting; +import net.minecraft.client.gui.GuiComponent; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.narration.NarrationElementOutput; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.item.ItemStack; import java.util.Optional; @@ -21,7 +23,7 @@ public class ItemTerminalWidget extends AbstractWidget { public boolean craftable; public ItemTerminalWidget(int xIn, int yIn, int gridX, int gridY, ItemTerminalGui screen) { - super(xIn, yIn, 16, 16, new TextComponent("")); + super(xIn, yIn, 16, 16, Component.literal("")); this.gridX = gridX; this.gridY = gridY; this.screen = screen; @@ -41,7 +43,7 @@ public class ItemTerminalWidget extends AbstractWidget { this.setBlitOffset(100); renderer.blitOffset = 100; if (this.selected) - fill(matrix, this.x, this.y, this.x + 16, this.y + 16, -2130706433); + GuiComponent.fill(matrix, this.x, this.y, this.x + 16, this.y + 16, -2130706433); RenderSystem.enableDepthTest(); renderer.renderGuiItem(this.stack, this.x, this.y); var amount = !this.craftable ? this.stack.getCount() : 0; @@ -65,8 +67,8 @@ public class ItemTerminalWidget extends AbstractWidget { var tooltip = this.screen.getTooltipFromItem(this.stack); if (this.stack.getCount() >= 1000) { var comp = tooltip.get(0); - if (comp instanceof TextComponent text) { - tooltip.set(0, text.append(new TextComponent(" (" + this.stack.getCount() + ')').withStyle(ChatFormatting.BOLD))); + if (comp instanceof MutableComponent m) { + tooltip.set(0, m.append(Component.literal(" (" + this.stack.getCount() + ')').withStyle(ChatFormatting.BOLD))); } } this.screen.renderTooltip(matrix, tooltip, Optional.empty(), mouseX, mouseY); diff --git a/src/main/java/de/ellpeck/prettypipes/misc/PlayerPrefs.java b/src/main/java/de/ellpeck/prettypipes/misc/PlayerPrefs.java index 202140b..6181a7a 100644 --- a/src/main/java/de/ellpeck/prettypipes/misc/PlayerPrefs.java +++ b/src/main/java/de/ellpeck/prettypipes/misc/PlayerPrefs.java @@ -20,30 +20,30 @@ public class PlayerPrefs { public boolean syncJei = true; public void save() { - var file = getFile(); + var file = PlayerPrefs.getFile(); if (file.exists()) file.delete(); try (var writer = new FileWriter(file)) { - GSON.toJson(this, writer); + PlayerPrefs.GSON.toJson(this, writer); } catch (IOException e) { e.printStackTrace(); } } public static PlayerPrefs get() { - if (instance == null) { - var file = getFile(); + if (PlayerPrefs.instance == null) { + var file = PlayerPrefs.getFile(); if (file.exists()) { try (var reader = new FileReader(file)) { - instance = GSON.fromJson(reader, PlayerPrefs.class); - return instance; + PlayerPrefs.instance = PlayerPrefs.GSON.fromJson(reader, PlayerPrefs.class); + return PlayerPrefs.instance; } catch (IOException e) { e.printStackTrace(); } } - instance = new PlayerPrefs(); + PlayerPrefs.instance = new PlayerPrefs(); } - return instance; + return PlayerPrefs.instance; } private static File getFile() { diff --git a/src/main/java/de/ellpeck/prettypipes/network/NetworkItem.java b/src/main/java/de/ellpeck/prettypipes/network/NetworkItem.java index 331d228..291c381 100644 --- a/src/main/java/de/ellpeck/prettypipes/network/NetworkItem.java +++ b/src/main/java/de/ellpeck/prettypipes/network/NetworkItem.java @@ -3,7 +3,9 @@ package de.ellpeck.prettypipes.network; import de.ellpeck.prettypipes.misc.EquatableItemStack; import net.minecraft.world.item.ItemStack; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; public class NetworkItem { diff --git a/src/main/java/de/ellpeck/prettypipes/network/NetworkLocation.java b/src/main/java/de/ellpeck/prettypipes/network/NetworkLocation.java index c0caae2..1546107 100644 --- a/src/main/java/de/ellpeck/prettypipes/network/NetworkLocation.java +++ b/src/main/java/de/ellpeck/prettypipes/network/NetworkLocation.java @@ -1,12 +1,11 @@ package de.ellpeck.prettypipes.network; import de.ellpeck.prettypipes.misc.ItemEquality; -import de.ellpeck.prettypipes.pipe.PipeBlockEntity; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtUtils; import net.minecraft.world.item.ItemStack; -import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.Level; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.items.IItemHandler; @@ -102,6 +101,6 @@ public class NetworkLocation implements INBTSerializable { @Override public void deserializeNBT(CompoundTag nbt) { this.pipePos = NbtUtils.readBlockPos(nbt.getCompound("pipe_pos")); - this.direction = Direction.values()[(nbt.getInt("direction"))]; + this.direction = Direction.values()[nbt.getInt("direction")]; } } diff --git a/src/main/java/de/ellpeck/prettypipes/network/PipeItem.java b/src/main/java/de/ellpeck/prettypipes/network/PipeItem.java index c15b38f..5ee484f 100644 --- a/src/main/java/de/ellpeck/prettypipes/network/PipeItem.java +++ b/src/main/java/de/ellpeck/prettypipes/network/PipeItem.java @@ -60,7 +60,7 @@ public class PipeItem implements IPipeItem { } public PipeItem(ItemStack stack, float speed) { - this(TYPE, stack, speed); + this(PipeItem.TYPE, stack, speed); } public PipeItem(ResourceLocation type, CompoundTag nbt) { @@ -78,7 +78,7 @@ public class PipeItem implements IPipeItem { public void setDestination(BlockPos startInventory, BlockPos destInventory, GraphPath path) { this.startInventory = startInventory; this.destInventory = destInventory; - this.path = compilePath(path); + this.path = PipeItem.compilePath(path); this.currGoalPos = this.getStartPipe(); this.currentTile = 0; @@ -126,7 +126,7 @@ public class PipeItem implements IPipeItem { currPipe = next; } } else { - var dist = (this.currGoalPos).distToLowCornerSqr(this.x - 0.5F, this.y - 0.5F, this.z - 0.5F); + var dist = this.currGoalPos.distToLowCornerSqr(this.x - 0.5F, this.y - 0.5F, this.z - 0.5F); if (dist < currSpeed * currSpeed) { // we're past the start of the pipe, so move to the center of the next pipe BlockPos nextPos; diff --git a/src/main/java/de/ellpeck/prettypipes/packets/PacketCraftingModuleTransfer.java b/src/main/java/de/ellpeck/prettypipes/packets/PacketCraftingModuleTransfer.java index a055d2e..9b32538 100644 --- a/src/main/java/de/ellpeck/prettypipes/packets/PacketCraftingModuleTransfer.java +++ b/src/main/java/de/ellpeck/prettypipes/packets/PacketCraftingModuleTransfer.java @@ -53,8 +53,8 @@ public class PacketCraftingModuleTransfer { public void run() { Player player = ctx.get().getSender(); if (player.containerMenu instanceof CraftingModuleContainer container) { - copy(container.input, message.inputs); - copy(container.output, message.outputs); + PacketCraftingModuleTransfer.copy(container.input, message.inputs); + PacketCraftingModuleTransfer.copy(container.output, message.outputs); container.modified = true; container.broadcastChanges(); } diff --git a/src/main/java/de/ellpeck/prettypipes/packets/PacketGhostSlot.java b/src/main/java/de/ellpeck/prettypipes/packets/PacketGhostSlot.java index 38ad98e..2411b72 100644 --- a/src/main/java/de/ellpeck/prettypipes/packets/PacketGhostSlot.java +++ b/src/main/java/de/ellpeck/prettypipes/packets/PacketGhostSlot.java @@ -93,7 +93,7 @@ public class PacketGhostSlot { private final TagKey tag; public Entry(List stacks) { - var tag = getTagForStacks(stacks); + var tag = Entry.getTagForStacks(stacks); if (tag != null) { this.stacks = null; this.tag = tag; diff --git a/src/main/java/de/ellpeck/prettypipes/packets/PacketHandler.java b/src/main/java/de/ellpeck/prettypipes/packets/PacketHandler.java index 35d3ed4..733f0cc 100644 --- a/src/main/java/de/ellpeck/prettypipes/packets/PacketHandler.java +++ b/src/main/java/de/ellpeck/prettypipes/packets/PacketHandler.java @@ -16,24 +16,24 @@ public final class PacketHandler { private static SimpleChannel network; public static void setup() { - network = NetworkRegistry.newSimpleChannel(new ResourceLocation(PrettyPipes.ID, "network"), () -> VERSION, VERSION::equals, VERSION::equals); - network.registerMessage(0, PacketItemEnterPipe.class, PacketItemEnterPipe::toBytes, PacketItemEnterPipe::fromBytes, PacketItemEnterPipe::onMessage); - network.registerMessage(1, PacketButton.class, PacketButton::toBytes, PacketButton::fromBytes, PacketButton::onMessage); - network.registerMessage(2, PacketNetworkItems.class, PacketNetworkItems::toBytes, PacketNetworkItems::fromBytes, PacketNetworkItems::onMessage); - network.registerMessage(3, PacketRequest.class, PacketRequest::toBytes, PacketRequest::fromBytes, PacketRequest::onMessage); - network.registerMessage(4, PacketGhostSlot.class, PacketGhostSlot::toBytes, PacketGhostSlot::fromBytes, PacketGhostSlot::onMessage); - network.registerMessage(5, PacketCraftingModuleTransfer.class, PacketCraftingModuleTransfer::toBytes, PacketCraftingModuleTransfer::fromBytes, PacketCraftingModuleTransfer::onMessage); + PacketHandler.network = NetworkRegistry.newSimpleChannel(new ResourceLocation(PrettyPipes.ID, "network"), () -> PacketHandler.VERSION, PacketHandler.VERSION::equals, PacketHandler.VERSION::equals); + PacketHandler.network.registerMessage(0, PacketItemEnterPipe.class, PacketItemEnterPipe::toBytes, PacketItemEnterPipe::fromBytes, PacketItemEnterPipe::onMessage); + PacketHandler.network.registerMessage(1, PacketButton.class, PacketButton::toBytes, PacketButton::fromBytes, PacketButton::onMessage); + PacketHandler.network.registerMessage(2, PacketNetworkItems.class, PacketNetworkItems::toBytes, PacketNetworkItems::fromBytes, PacketNetworkItems::onMessage); + PacketHandler.network.registerMessage(3, PacketRequest.class, PacketRequest::toBytes, PacketRequest::fromBytes, PacketRequest::onMessage); + PacketHandler.network.registerMessage(4, PacketGhostSlot.class, PacketGhostSlot::toBytes, PacketGhostSlot::fromBytes, PacketGhostSlot::onMessage); + PacketHandler.network.registerMessage(5, PacketCraftingModuleTransfer.class, PacketCraftingModuleTransfer::toBytes, PacketCraftingModuleTransfer::fromBytes, PacketCraftingModuleTransfer::onMessage); } public static void sendToAllLoaded(Level world, BlockPos pos, Object message) { - network.send(PacketDistributor.TRACKING_CHUNK.with(() -> world.getChunkAt(pos)), message); + PacketHandler.network.send(PacketDistributor.TRACKING_CHUNK.with(() -> world.getChunkAt(pos)), message); } public static void sendTo(Player player, Object message) { - network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), message); + PacketHandler.network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), message); } public static void sendToServer(Object message) { - network.send(PacketDistributor.SERVER.noArg(), message); + PacketHandler.network.send(PacketDistributor.SERVER.noArg(), message); } } diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/IPipeItem.java b/src/main/java/de/ellpeck/prettypipes/pipe/IPipeItem.java index a64b8ab..567d294 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/IPipeItem.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/IPipeItem.java @@ -5,9 +5,9 @@ import de.ellpeck.prettypipes.network.NetworkEdge; import de.ellpeck.prettypipes.network.PipeItem; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.core.BlockPos; -import net.minecraft.world.item.ItemStack; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -46,7 +46,7 @@ public interface IPipeItem extends INBTSerializable { static IPipeItem load(CompoundTag nbt) { var type = new ResourceLocation(nbt.getString("type")); - var func = TYPES.get(type); + var func = IPipeItem.TYPES.get(type); return func != null ? func.apply(type, nbt) : null; } } diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlock.java b/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlock.java index bd5b2a2..14b9373 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlock.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlock.java @@ -50,26 +50,26 @@ public class PipeBlock extends BaseEntityBlock { public static final Map> DIRECTIONS = new HashMap<>(); private static final Map, VoxelShape> SHAPE_CACHE = new HashMap<>(); private static final Map, VoxelShape> COLL_SHAPE_CACHE = new HashMap<>(); - private static final VoxelShape CENTER_SHAPE = box(5, 5, 5, 11, 11, 11); + private static final VoxelShape CENTER_SHAPE = Block.box(5, 5, 5, 11, 11, 11); public static final Map DIR_SHAPES = ImmutableMap.builder() - .put(Direction.UP, box(5, 10, 5, 11, 16, 11)) - .put(Direction.DOWN, box(5, 0, 5, 11, 6, 11)) - .put(Direction.NORTH, box(5, 5, 0, 11, 11, 6)) - .put(Direction.SOUTH, box(5, 5, 10, 11, 11, 16)) - .put(Direction.EAST, box(10, 5, 5, 16, 11, 11)) - .put(Direction.WEST, box(0, 5, 5, 6, 11, 11)) + .put(Direction.UP, Block.box(5, 10, 5, 11, 16, 11)) + .put(Direction.DOWN, Block.box(5, 0, 5, 11, 6, 11)) + .put(Direction.NORTH, Block.box(5, 5, 0, 11, 11, 6)) + .put(Direction.SOUTH, Block.box(5, 5, 10, 11, 11, 16)) + .put(Direction.EAST, Block.box(10, 5, 5, 16, 11, 11)) + .put(Direction.WEST, Block.box(0, 5, 5, 6, 11, 11)) .build(); static { for (var dir : Direction.values()) - DIRECTIONS.put(dir, EnumProperty.create(dir.getName(), ConnectionType.class)); + PipeBlock.DIRECTIONS.put(dir, EnumProperty.create(dir.getName(), ConnectionType.class)); } public PipeBlock() { super(Block.Properties.of(Material.STONE).strength(2).sound(SoundType.STONE).noOcclusion()); var state = this.defaultBlockState().setValue(BlockStateProperties.WATERLOGGED, false); - for (var prop : DIRECTIONS.values()) + for (var prop : PipeBlock.DIRECTIONS.values()) state = state.setValue(prop, ConnectionType.DISCONNECTED); this.registerDefaultState(state); } @@ -100,7 +100,7 @@ public class PipeBlock extends BaseEntityBlock { @Override protected void createBlockStateDefinition(StateDefinition.Builder builder) { - builder.add(DIRECTIONS.values().toArray(new EnumProperty[0])); + builder.add(PipeBlock.DIRECTIONS.values().toArray(new EnumProperty[0])); builder.add(BlockStateProperties.WATERLOGGED); } @@ -114,7 +114,7 @@ public class PipeBlock extends BaseEntityBlock { var newState = this.createState(worldIn, pos, state); if (newState != state) { worldIn.setBlockAndUpdate(pos, newState); - onStateChanged(worldIn, pos, newState); + PipeBlock.onStateChanged(worldIn, pos, newState); } } @@ -133,17 +133,17 @@ public class PipeBlock extends BaseEntityBlock { @Override public void setPlacedBy(Level worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { - onStateChanged(worldIn, pos, state); + PipeBlock.onStateChanged(worldIn, pos, state); } @Override public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { - return this.cacheAndGetShape(state, worldIn, pos, s -> s.getShape(worldIn, pos, context), SHAPE_CACHE, null); + return this.cacheAndGetShape(state, worldIn, pos, s -> s.getShape(worldIn, pos, context), PipeBlock.SHAPE_CACHE, null); } @Override public VoxelShape getCollisionShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { - return this.cacheAndGetShape(state, worldIn, pos, s -> s.getCollisionShape(worldIn, pos, context), COLL_SHAPE_CACHE, s -> { + return this.cacheAndGetShape(state, worldIn, pos, s -> s.getCollisionShape(worldIn, pos, context), PipeBlock.COLL_SHAPE_CACHE, s -> { // make the shape a bit higher so we can jump up onto a higher block var newShape = new MutableObject(Shapes.empty()); s.forAllBoxes((x1, y1, z1, x2, y2, z2) -> newShape.setValue(Shapes.join(Shapes.create(x1, y1, z1, x2, y2 + 3 / 16F, z2), newShape.getValue(), BooleanOp.OR))); @@ -166,10 +166,10 @@ public class PipeBlock extends BaseEntityBlock { var key = Pair.of(state, cover); var shape = cache.get(key); if (shape == null) { - shape = CENTER_SHAPE; - for (var entry : DIRECTIONS.entrySet()) { + shape = PipeBlock.CENTER_SHAPE; + for (var entry : PipeBlock.DIRECTIONS.entrySet()) { if (state.getValue(entry.getValue()).isConnected()) - shape = Shapes.or(shape, DIR_SHAPES.get(entry.getKey())); + shape = Shapes.or(shape, PipeBlock.DIR_SHAPES.get(entry.getKey())); } if (shapeModifier != null) shape = shapeModifier.apply(shape); @@ -187,7 +187,7 @@ public class PipeBlock extends BaseEntityBlock { state = state.setValue(BlockStateProperties.WATERLOGGED, true); for (var dir : Direction.values()) { - var prop = DIRECTIONS.get(dir); + var prop = PipeBlock.DIRECTIONS.get(dir); var type = this.getConnectionType(world, pos, dir, state); // don't reconnect on blocked faces if (type.isConnected() && curr.getValue(prop) == ConnectionType.BLOCKED) @@ -215,8 +215,8 @@ public class PipeBlock extends BaseEntityBlock { if (blockHandler != null) return ConnectionType.CONNECTED; var offState = world.getBlockState(offset); - if (hasLegsTo(world, offState, offset, direction)) { - if (DIRECTIONS.values().stream().noneMatch(d -> state.getValue(d) == ConnectionType.LEGS)) + if (PipeBlock.hasLegsTo(world, offState, offset, direction)) { + if (PipeBlock.DIRECTIONS.values().stream().noneMatch(d -> state.getValue(d) == ConnectionType.LEGS)) return ConnectionType.LEGS; } return ConnectionType.DISCONNECTED; @@ -226,7 +226,7 @@ public class PipeBlock extends BaseEntityBlock { if (state.getBlock() instanceof WallBlock || state.getBlock() instanceof FenceBlock) return direction == Direction.DOWN; if (state.getMaterial() == Material.STONE || state.getMaterial() == Material.METAL) - return canSupportCenter(world, pos, direction.getOpposite()); + return Block.canSupportCenter(world, pos, direction.getOpposite()); return false; } @@ -240,7 +240,7 @@ public class PipeBlock extends BaseEntityBlock { var connections = 0; var force = false; for (var dir : Direction.values()) { - var value = newState.getValue(DIRECTIONS.get(dir)); + var value = newState.getValue(PipeBlock.DIRECTIONS.get(dir)); if (!value.isConnected()) continue; connections++; @@ -271,7 +271,7 @@ public class PipeBlock extends BaseEntityBlock { @Override public void playerWillDestroy(Level worldIn, BlockPos pos, BlockState state, Player player) { - dropItems(worldIn, pos, player); + PipeBlock.dropItems(worldIn, pos, player); super.playerWillDestroy(worldIn, pos, state, player); } @@ -302,7 +302,7 @@ public class PipeBlock extends BaseEntityBlock { @org.jetbrains.annotations.Nullable @Override public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType type) { - return createTickerHelper(type, Registry.pipeBlockEntity, PipeBlockEntity::tick); + return BaseEntityBlock.createTickerHelper(type, Registry.pipeBlockEntity, PipeBlockEntity::tick); } public static void dropItems(Level worldIn, BlockPos pos, Player player) { diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java b/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java index dab0372..b15e696 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java @@ -17,7 +17,6 @@ import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.Tag; import net.minecraft.network.Connection; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.Containers; @@ -382,7 +381,7 @@ public class PipeBlockEntity extends BlockEntity implements MenuProvider, IPipeC @Override public Component getDisplayName() { - return new TranslatableComponent("container." + PrettyPipes.ID + ".pipe"); + return Component.translatable("container." + PrettyPipes.ID + ".pipe"); } @Nullable diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/PipeRenderer.java b/src/main/java/de/ellpeck/prettypipes/pipe/PipeRenderer.java index 9d1c3e9..091221a 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/PipeRenderer.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/PipeRenderer.java @@ -7,7 +7,9 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.util.RandomSource; import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.model.data.EmptyModelData; import net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer; import java.util.Random; @@ -40,7 +42,7 @@ public class PipeRenderer implements BlockEntityRenderer { if (!ItemBlockRenderTypes.canRenderInLayer(tile.cover, layer)) continue; ForgeHooksClient.setRenderType(layer); - renderer.getModelRenderer().tesselateBlock(tile.getLevel(), renderer.getBlockModel(tile.cover), tile.cover, tile.getBlockPos(), matrixStack, source.getBuffer(layer), true, new Random(), tile.cover.getSeed(tile.getBlockPos()), overlay); + renderer.getModelRenderer().tesselateBlock(tile.getLevel(), renderer.getBlockModel(tile.cover), tile.cover, tile.getBlockPos(), matrixStack, source.getBuffer(layer), true, RandomSource.create(), tile.cover.getSeed(tile.getBlockPos()), overlay, EmptyModelData.INSTANCE); } ForgeHooksClient.setRenderType(null); ForgeBlockModelRenderer.clearCache(); diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/containers/AbstractPipeGui.java b/src/main/java/de/ellpeck/prettypipes/pipe/containers/AbstractPipeGui.java index 08f5826..21f1058 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/containers/AbstractPipeGui.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/containers/AbstractPipeGui.java @@ -79,7 +79,7 @@ public abstract class AbstractPipeGui> extend @Override protected void renderBg(PoseStack matrix, float partialTicks, int mouseX, int mouseY) { RenderSystem.setShader(GameRenderer::getPositionTexShader); - RenderSystem.setShaderTexture(0, TEXTURE); + RenderSystem.setShaderTexture(0, AbstractPipeGui.TEXTURE); this.blit(matrix, this.leftPos, this.topPos + 32, 0, 0, 176, 171); for (var tab : this.tabs) @@ -143,7 +143,7 @@ public abstract class AbstractPipeGui> extend AbstractPipeGui.this.itemRenderer.renderGuiItem(this.moduleStack, this.x + 6, this.y + itemOffset); RenderSystem.setShader(GameRenderer::getPositionTexShader); - RenderSystem.setShaderTexture(0, TEXTURE); + RenderSystem.setShaderTexture(0, AbstractPipeGui.TEXTURE); } private void drawForeground(PoseStack matrix, int mouseX, int mouseY) { diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/modules/HighPriorityModuleItem.java b/src/main/java/de/ellpeck/prettypipes/pipe/modules/HighPriorityModuleItem.java index 9f69c77..f71052b 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/modules/HighPriorityModuleItem.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/modules/HighPriorityModuleItem.java @@ -7,6 +7,7 @@ import de.ellpeck.prettypipes.pipe.PipeBlockEntity; import net.minecraft.world.item.ItemStack; public class HighPriorityModuleItem extends ModuleItem { + private final int priority; public HighPriorityModuleItem(String name, ModuleTier tier) { diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/modules/LowPriorityModuleItem.java b/src/main/java/de/ellpeck/prettypipes/pipe/modules/LowPriorityModuleItem.java index 25d3e81..b72f4be 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/modules/LowPriorityModuleItem.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/modules/LowPriorityModuleItem.java @@ -7,6 +7,7 @@ import de.ellpeck.prettypipes.pipe.PipeBlockEntity; import net.minecraft.world.item.ItemStack; public class LowPriorityModuleItem extends ModuleItem { + private final int priority; public LowPriorityModuleItem(String name, ModuleTier tier) { diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/modules/RedstoneModuleItem.java b/src/main/java/de/ellpeck/prettypipes/pipe/modules/RedstoneModuleItem.java index 23d5874..8705c01 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/modules/RedstoneModuleItem.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/modules/RedstoneModuleItem.java @@ -7,9 +7,8 @@ import net.minecraft.world.item.ItemStack; public class RedstoneModuleItem extends ModuleItem { - public RedstoneModuleItem(String name) { - super(name); - this.setRegistryName(name); + public RedstoneModuleItem() { + super("redstone_module"); } @Override diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/modules/SortingModuleItem.java b/src/main/java/de/ellpeck/prettypipes/pipe/modules/SortingModuleItem.java index 53c4887..659b476 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/modules/SortingModuleItem.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/modules/SortingModuleItem.java @@ -15,7 +15,6 @@ public class SortingModuleItem extends ModuleItem { public SortingModuleItem(String name, Type type) { super(name); this.type = type; - this.setRegistryName(name); } @Override diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/modules/SpeedModuleItem.java b/src/main/java/de/ellpeck/prettypipes/pipe/modules/SpeedModuleItem.java index a7fa119..be6b4c6 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/modules/SpeedModuleItem.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/modules/SpeedModuleItem.java @@ -7,6 +7,7 @@ import de.ellpeck.prettypipes.pipe.PipeBlockEntity; import net.minecraft.world.item.ItemStack; public class SpeedModuleItem extends ModuleItem { + private final float speedIncrease; public SpeedModuleItem(String name, ModuleTier tier) { diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleGui.java b/src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleGui.java index 126f6f5..a373f5f 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleGui.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleGui.java @@ -17,7 +17,7 @@ public class CraftingModuleGui extends AbstractPipeGui protected void renderBg(PoseStack matrix, float partialTicks, int mouseX, int mouseY) { super.renderBg(matrix, partialTicks, mouseX, mouseY); RenderSystem.setShader(GameRenderer::getPositionTexShader); - RenderSystem.setShaderTexture(0, TEXTURE); + RenderSystem.setShaderTexture(0, AbstractPipeGui.TEXTURE); this.blit(matrix, this.leftPos + 176 / 2 - 16 / 2, this.topPos + 32 + 18 * 2, 176, 80, 16, 16); } } diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleItem.java b/src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleItem.java index 4bc9d90..f613c46 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleItem.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleItem.java @@ -147,7 +147,7 @@ public class CraftingModuleItem extends ModuleItem { var out = output.getStackInSlot(i); if (!out.isEmpty() && ItemEquality.compareItems(out, stack, equalityTypes)) { // figure out how many crafting operations we can actually do with the input items we have in the network - var availableCrafts = CraftingTerminalBlockEntity.getAvailableCrafts(tile, input.getSlots(), input::getStackInSlot, k -> true, s -> items, unavailableConsumer, addDependency(dependencyChain, module), equalityTypes); + var availableCrafts = CraftingTerminalBlockEntity.getAvailableCrafts(tile, input.getSlots(), input::getStackInSlot, k -> true, s -> items, unavailableConsumer, CraftingModuleItem.addDependency(dependencyChain, module), equalityTypes); if (availableCrafts > 0) craftable += out.getCount() * availableCrafts; } @@ -179,7 +179,7 @@ public class CraftingModuleItem extends ModuleItem { continue; var copy = in.copy(); copy.setCount(in.getCount() * toCraft); - var ret = ItemTerminalBlockEntity.requestItemLater(tile.getLevel(), tile.getBlockPos(), items, unavailableConsumer, copy, addDependency(dependencyChain, module), equalityTypes); + var ret = ItemTerminalBlockEntity.requestItemLater(tile.getLevel(), tile.getBlockPos(), items, unavailableConsumer, copy, CraftingModuleItem.addDependency(dependencyChain, module), equalityTypes); tile.craftIngredientRequests.addAll(ret.getLeft()); } diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/modules/filter/FilterIncreaseModuleContainer.java b/src/main/java/de/ellpeck/prettypipes/pipe/modules/filter/FilterIncreaseModuleContainer.java index 16e6765..384c228 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/modules/filter/FilterIncreaseModuleContainer.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/modules/filter/FilterIncreaseModuleContainer.java @@ -5,7 +5,6 @@ import de.ellpeck.prettypipes.pipe.containers.AbstractPipeContainer; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.MenuType; -import net.minecraft.world.inventory.Slot; public class FilterIncreaseModuleContainer extends AbstractPipeContainer implements ItemFilter.IFilteredContainer { diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/modules/filter/FilterIncreaseModuleItem.java b/src/main/java/de/ellpeck/prettypipes/pipe/modules/filter/FilterIncreaseModuleItem.java index 43836d8..53e34d2 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/modules/filter/FilterIncreaseModuleItem.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/modules/filter/FilterIncreaseModuleItem.java @@ -12,9 +12,8 @@ import net.minecraft.world.item.ItemStack; public class FilterIncreaseModuleItem extends ModuleItem { - public FilterIncreaseModuleItem(String name) { - super(name); - this.setRegistryName(name); + public FilterIncreaseModuleItem() { + super("filter_increase_modifier"); } @Override diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/modules/insertion/FilterModuleGui.java b/src/main/java/de/ellpeck/prettypipes/pipe/modules/insertion/FilterModuleGui.java index bc55924..297668e 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/modules/insertion/FilterModuleGui.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/modules/insertion/FilterModuleGui.java @@ -1,7 +1,6 @@ package de.ellpeck.prettypipes.pipe.modules.insertion; import de.ellpeck.prettypipes.pipe.containers.AbstractPipeGui; -import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.network.chat.Component; import net.minecraft.util.Mth; import net.minecraft.world.entity.player.Inventory; diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/modules/modifier/FilterModifierModuleGui.java b/src/main/java/de/ellpeck/prettypipes/pipe/modules/modifier/FilterModifierModuleGui.java index 19204bc..185a2f9 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/modules/modifier/FilterModifierModuleGui.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/modules/modifier/FilterModifierModuleGui.java @@ -126,7 +126,7 @@ public class FilterModifierModuleGui extends AbstractPipeGui) () -> new TranslatableComponent("info." + PrettyPipes.ID + ".limit_to_max_" + (StackSizeModuleItem.getLimitToMaxStackSize(this.menu.moduleStack) ? "on" : "off")); + Supplier buttonText = () -> Component.translatable("info." + PrettyPipes.ID + ".limit_to_max_" + (StackSizeModuleItem.getLimitToMaxStackSize(this.menu.moduleStack) ? "on" : "off")); this.addRenderableWidget(new Button(this.leftPos + 7, this.topPos + 17 + 32 + 10 + 22, 120, 20, buttonText.get(), b -> { PacketButton.sendAndExecute(this.menu.tile.getBlockPos(), ButtonResult.STACK_SIZE_MODULE_BUTTON); b.setMessage(buttonText.get()); diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/modules/stacksize/StackSizeModuleItem.java b/src/main/java/de/ellpeck/prettypipes/pipe/modules/stacksize/StackSizeModuleItem.java index 43c9ee4..3b4b3e4 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/modules/stacksize/StackSizeModuleItem.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/modules/stacksize/StackSizeModuleItem.java @@ -13,9 +13,8 @@ import net.minecraftforge.items.IItemHandler; public class StackSizeModuleItem extends ModuleItem { - public StackSizeModuleItem(String name) { - super(name); - this.setRegistryName(name); + public StackSizeModuleItem() { + super("stack_size_module"); } public static int getMaxStackSize(ItemStack module) { @@ -43,8 +42,8 @@ public class StackSizeModuleItem extends ModuleItem { @Override public int getMaxInsertionAmount(ItemStack module, PipeBlockEntity tile, ItemStack stack, IItemHandler destination) { - var max = getMaxStackSize(module); - if (getLimitToMaxStackSize(module)) + var max = StackSizeModuleItem.getMaxStackSize(module); + if (StackSizeModuleItem.getLimitToMaxStackSize(module)) max = Math.min(max, stack.getMaxStackSize()); var amount = 0; for (var i = 0; i < destination.getSlots(); i++) { diff --git a/src/main/java/de/ellpeck/prettypipes/pressurizer/PressurizerBlock.java b/src/main/java/de/ellpeck/prettypipes/pressurizer/PressurizerBlock.java index 4b15282..f097143 100644 --- a/src/main/java/de/ellpeck/prettypipes/pressurizer/PressurizerBlock.java +++ b/src/main/java/de/ellpeck/prettypipes/pressurizer/PressurizerBlock.java @@ -2,7 +2,6 @@ package de.ellpeck.prettypipes.pressurizer; import de.ellpeck.prettypipes.Registry; import de.ellpeck.prettypipes.Utility; -import de.ellpeck.prettypipes.pipe.PipeBlockEntity; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; @@ -24,6 +23,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Material; import net.minecraft.world.phys.BlockHitResult; import net.minecraftforge.network.NetworkHooks; +import net.minecraftforge.registries.ForgeRegistries; import javax.annotation.Nullable; import java.util.List; @@ -57,13 +57,13 @@ public class PressurizerBlock extends BaseEntityBlock { @Override public void appendHoverText(ItemStack stack, @Nullable BlockGetter worldIn, List tooltip, TooltipFlag flagIn) { - Utility.addTooltip(this.getRegistryName().getPath(), tooltip); + Utility.addTooltip(ForgeRegistries.BLOCKS.getKey(this).getPath(), tooltip); } @org.jetbrains.annotations.Nullable @Override public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType type) { - return level.isClientSide ? null : createTickerHelper(type, Registry.pressurizerBlockEntity, PressurizerBlockEntity::tick); + return level.isClientSide ? null : BaseEntityBlock.createTickerHelper(type, Registry.pressurizerBlockEntity, PressurizerBlockEntity::tick); } @Override diff --git a/src/main/java/de/ellpeck/prettypipes/pressurizer/PressurizerBlockEntity.java b/src/main/java/de/ellpeck/prettypipes/pressurizer/PressurizerBlockEntity.java index ff59b52..577ba87 100644 --- a/src/main/java/de/ellpeck/prettypipes/pressurizer/PressurizerBlockEntity.java +++ b/src/main/java/de/ellpeck/prettypipes/pressurizer/PressurizerBlockEntity.java @@ -11,7 +11,6 @@ import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.Connection; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.world.MenuProvider; import net.minecraft.world.entity.player.Inventory; @@ -86,7 +85,7 @@ public class PressurizerBlockEntity extends BlockEntity implements MenuProvider, @Override public Component getDisplayName() { - return new TranslatableComponent("container." + PrettyPipes.ID + ".pressurizer"); + return Component.translatable("container." + PrettyPipes.ID + ".pressurizer"); } @Nullable diff --git a/src/main/java/de/ellpeck/prettypipes/pressurizer/PressurizerGui.java b/src/main/java/de/ellpeck/prettypipes/pressurizer/PressurizerGui.java index c43d571..68c0449 100644 --- a/src/main/java/de/ellpeck/prettypipes/pressurizer/PressurizerGui.java +++ b/src/main/java/de/ellpeck/prettypipes/pressurizer/PressurizerGui.java @@ -6,7 +6,6 @@ import de.ellpeck.prettypipes.PrettyPipes; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; @@ -26,7 +25,7 @@ public class PressurizerGui extends AbstractContainerScreen= this.leftPos + 26 && mouseY >= this.topPos + 22 && mouseX < this.leftPos + 26 + 124 && mouseY < this.topPos + 22 + 12) - this.renderTooltip(matrix, new TranslatableComponent("info." + PrettyPipes.ID + ".energy", this.menu.tile.getEnergy(), this.menu.tile.getMaxEnergy()), mouseX, mouseY); + this.renderTooltip(matrix, Component.translatable("info." + PrettyPipes.ID + ".energy", this.menu.tile.getEnergy(), this.menu.tile.getMaxEnergy()), mouseX, mouseY); } @Override @@ -38,7 +37,7 @@ public class PressurizerGui extends AbstractContainerScreen BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType type) { - return createTickerHelper(type, Registry.craftingTerminalBlockEntity, ItemTerminalBlockEntity::tick); + return BaseEntityBlock.createTickerHelper(type, Registry.craftingTerminalBlockEntity, ItemTerminalBlockEntity::tick); } } diff --git a/src/main/java/de/ellpeck/prettypipes/terminal/CraftingTerminalBlockEntity.java b/src/main/java/de/ellpeck/prettypipes/terminal/CraftingTerminalBlockEntity.java index be91b82..4746678 100644 --- a/src/main/java/de/ellpeck/prettypipes/terminal/CraftingTerminalBlockEntity.java +++ b/src/main/java/de/ellpeck/prettypipes/terminal/CraftingTerminalBlockEntity.java @@ -17,7 +17,6 @@ import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; @@ -111,10 +110,10 @@ public class CraftingTerminalBlockEntity extends ItemTerminalBlockEntity { network.startProfile("terminal_request_crafting"); this.updateItems(); // get the amount of crafts that we can do - var lowestAvailable = getAvailableCrafts(pipe, this.craftItems.getSlots(), i -> ItemHandlerHelper.copyStackWithSize(this.getRequestedCraftItem(i), 1), this::isGhostItem, s -> { + var lowestAvailable = CraftingTerminalBlockEntity.getAvailableCrafts(pipe, this.craftItems.getSlots(), i -> ItemHandlerHelper.copyStackWithSize(this.getRequestedCraftItem(i), 1), this::isGhostItem, s -> { var item = this.networkItems.get(s); return item != null ? item.getLocations() : Collections.emptyList(); - }, onItemUnavailable(player, force), new Stack<>(), ItemEquality.NBT); + }, ItemTerminalBlockEntity.onItemUnavailable(player, force), new Stack<>(), ItemEquality.NBT); // if we're forcing, just pretend we have one available if (lowestAvailable <= 0 && force) lowestAvailable = maxAmount; @@ -128,11 +127,11 @@ public class CraftingTerminalBlockEntity extends ItemTerminalBlockEntity { continue; requested = requested.copy(); requested.setCount(lowestAvailable); - this.requestItemImpl(requested, onItemUnavailable(player, force)); + this.requestItemImpl(requested, ItemTerminalBlockEntity.onItemUnavailable(player, force)); } - player.sendMessage(new TranslatableComponent("info." + PrettyPipes.ID + ".sending_ingredients", lowestAvailable).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GREEN)), UUID.randomUUID()); + player.sendSystemMessage(Component.translatable("info." + PrettyPipes.ID + ".sending_ingredients", lowestAvailable).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GREEN))); } else { - player.sendMessage(new TranslatableComponent("info." + PrettyPipes.ID + ".hold_alt"), UUID.randomUUID()); + player.sendSystemMessage(Component.translatable("info." + PrettyPipes.ID + ".hold_alt")); } network.endProfile(); } @@ -151,7 +150,7 @@ public class CraftingTerminalBlockEntity extends ItemTerminalBlockEntity { @Override public Component getDisplayName() { - return new TranslatableComponent("container." + PrettyPipes.ID + ".crafting_terminal"); + return Component.translatable("container." + PrettyPipes.ID + ".crafting_terminal"); } @Nullable diff --git a/src/main/java/de/ellpeck/prettypipes/terminal/ItemTerminalBlock.java b/src/main/java/de/ellpeck/prettypipes/terminal/ItemTerminalBlock.java index d286158..20ef73c 100644 --- a/src/main/java/de/ellpeck/prettypipes/terminal/ItemTerminalBlock.java +++ b/src/main/java/de/ellpeck/prettypipes/terminal/ItemTerminalBlock.java @@ -5,7 +5,6 @@ import de.ellpeck.prettypipes.Utility; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -24,10 +23,10 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Material; import net.minecraft.world.phys.BlockHitResult; import net.minecraftforge.network.NetworkHooks; +import net.minecraftforge.registries.ForgeRegistries; import javax.annotation.Nullable; import java.util.List; -import java.util.UUID; public class ItemTerminalBlock extends BaseEntityBlock { @@ -43,7 +42,7 @@ public class ItemTerminalBlock extends BaseEntityBlock { var reason = tile.getInvalidTerminalReason(); if (reason != null) { if (!worldIn.isClientSide) - player.sendMessage(new TranslatableComponent(reason).withStyle(ChatFormatting.RED), UUID.randomUUID()); + player.sendSystemMessage(Component.translatable(reason).withStyle(ChatFormatting.RED)); return InteractionResult.SUCCESS; } if (!worldIn.isClientSide) { @@ -76,13 +75,13 @@ public class ItemTerminalBlock extends BaseEntityBlock { @Override public void appendHoverText(ItemStack stack, @Nullable BlockGetter worldIn, List tooltip, TooltipFlag flagIn) { - Utility.addTooltip(this.getRegistryName().getPath(), tooltip); + Utility.addTooltip(ForgeRegistries.BLOCKS.getKey(this).getPath(), tooltip); } @org.jetbrains.annotations.Nullable @Override public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType type) { - return createTickerHelper(type, Registry.itemTerminalBlockEntity, ItemTerminalBlockEntity::tick); + return BaseEntityBlock.createTickerHelper(type, Registry.itemTerminalBlockEntity, ItemTerminalBlockEntity::tick); } } diff --git a/src/main/java/de/ellpeck/prettypipes/terminal/ItemTerminalBlockEntity.java b/src/main/java/de/ellpeck/prettypipes/terminal/ItemTerminalBlockEntity.java index 76f7bf9..98fe789 100644 --- a/src/main/java/de/ellpeck/prettypipes/terminal/ItemTerminalBlockEntity.java +++ b/src/main/java/de/ellpeck/prettypipes/terminal/ItemTerminalBlockEntity.java @@ -22,7 +22,6 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.world.MenuProvider; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; @@ -163,11 +162,11 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect .filter(s -> ItemEquality.compareItems(s, filter) && s.hasTag() && s.getTag().hashCode() == nbtHash) .findFirst().orElse(filter); } - var requested = this.requestItemImpl(stack, onItemUnavailable(player, false)); + var requested = this.requestItemImpl(stack, ItemTerminalBlockEntity.onItemUnavailable(player, false)); if (requested > 0) { - player.sendMessage(new TranslatableComponent("info." + PrettyPipes.ID + ".sending", requested, stack.getHoverName()).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GREEN)), UUID.randomUUID()); + player.sendSystemMessage(Component.translatable("info." + PrettyPipes.ID + ".sending", requested, stack.getHoverName()).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GREEN))); } else { - onItemUnavailable(player, false).accept(stack); + ItemTerminalBlockEntity.onItemUnavailable(player, false).accept(stack); } network.endProfile(); } @@ -175,7 +174,7 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect public int requestItemImpl(ItemStack stack, Consumer unavailableConsumer) { var item = this.networkItems.get(new EquatableItemStack(stack, ItemEquality.NBT)); Collection locations = item == null ? Collections.emptyList() : item.getLocations(); - var ret = requestItemLater(this.level, this.getConnectedPipe().getBlockPos(), locations, unavailableConsumer, stack, new Stack<>(), ItemEquality.NBT); + var ret = ItemTerminalBlockEntity.requestItemLater(this.level, this.getConnectedPipe().getBlockPos(), locations, unavailableConsumer, stack, new Stack<>(), ItemEquality.NBT); this.existingRequests.addAll(ret.getLeft()); return stack.getCount() - ret.getRight().getCount(); } @@ -248,7 +247,7 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect @Override public Component getDisplayName() { - return new TranslatableComponent("container." + PrettyPipes.ID + ".item_terminal"); + return Component.translatable("container." + PrettyPipes.ID + ".item_terminal"); } @Nullable @@ -319,7 +318,7 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect return s -> { if (ignore) return; - player.sendMessage(new TranslatableComponent("info." + PrettyPipes.ID + ".not_found", s.getHoverName()).setStyle(Style.EMPTY.applyFormat(ChatFormatting.RED)), UUID.randomUUID()); + player.sendSystemMessage(Component.translatable("info." + PrettyPipes.ID + ".not_found", s.getHoverName()).setStyle(Style.EMPTY.applyFormat(ChatFormatting.RED))); }; } } diff --git a/src/main/java/de/ellpeck/prettypipes/terminal/containers/CraftingTerminalGui.java b/src/main/java/de/ellpeck/prettypipes/terminal/containers/CraftingTerminalGui.java index b6fc5ff..a02671b 100644 --- a/src/main/java/de/ellpeck/prettypipes/terminal/containers/CraftingTerminalGui.java +++ b/src/main/java/de/ellpeck/prettypipes/terminal/containers/CraftingTerminalGui.java @@ -6,8 +6,8 @@ import de.ellpeck.prettypipes.PrettyPipes; import de.ellpeck.prettypipes.packets.PacketButton; import de.ellpeck.prettypipes.packets.PacketHandler; import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; @@ -24,10 +24,10 @@ public class CraftingTerminalGui extends ItemTerminalGui { @Override protected void init() { super.init(); - this.requestButton = this.addRenderableWidget(new Button(this.leftPos + 8, this.topPos + 100, 50, 20, new TranslatableComponent("info." + PrettyPipes.ID + ".request"), button -> { - var amount = requestModifier(); + this.requestButton = this.addRenderableWidget(new Button(this.leftPos + 8, this.topPos + 100, 50, 20, Component.translatable("info." + PrettyPipes.ID + ".request"), button -> { + var amount = ItemTerminalGui.requestModifier(); // also allow holding backspace instead of alt for people whose alt key is inaccessible (linux?) - var force = hasAltDown() || InputConstants.isKeyDown(this.minecraft.getWindow().getWindow(), 259) ? 1 : 0; + var force = Screen.hasAltDown() || InputConstants.isKeyDown(this.minecraft.getWindow().getWindow(), 259) ? 1 : 0; PacketHandler.sendToServer(new PacketButton(this.menu.tile.getBlockPos(), PacketButton.ButtonResult.CRAFT_TERMINAL_REQUEST, amount, force)); })); this.tick(); @@ -70,7 +70,7 @@ public class CraftingTerminalGui extends ItemTerminalGui { @Override protected ResourceLocation getTexture() { - return TEXTURE; + return CraftingTerminalGui.TEXTURE; } @Override diff --git a/src/main/java/de/ellpeck/prettypipes/terminal/containers/ItemTerminalGui.java b/src/main/java/de/ellpeck/prettypipes/terminal/containers/ItemTerminalGui.java index 2427719..ef03d99 100644 --- a/src/main/java/de/ellpeck/prettypipes/terminal/containers/ItemTerminalGui.java +++ b/src/main/java/de/ellpeck/prettypipes/terminal/containers/ItemTerminalGui.java @@ -15,12 +15,11 @@ import net.minecraft.client.gui.components.EditBox; import net.minecraft.client.gui.components.Widget; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarratableEntry; +import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.resources.language.I18n; 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.util.Mth; import net.minecraft.world.entity.player.Inventory; @@ -65,14 +64,14 @@ public class ItemTerminalGui extends AbstractContainerScreen { - var modifier = requestModifier(); + this.plusButton = this.addRenderableWidget(new Button(this.leftPos + this.getXOffset() + 95 - 7 + 12, this.topPos + 103, 12, 12, Component.literal("+"), button -> { + var modifier = ItemTerminalGui.requestModifier(); if (modifier > 1 && this.requestAmount == 1) { this.requestAmount = modifier; } else { @@ -82,15 +81,15 @@ public class ItemTerminalGui extends AbstractContainerScreen 384) this.requestAmount = 384; })); - this.minusButton = this.addRenderableWidget(new Button(this.leftPos + this.getXOffset() + 95 - 7 - 24, this.topPos + 103, 12, 12, new TextComponent("-"), button -> { - this.requestAmount -= requestModifier(); + this.minusButton = this.addRenderableWidget(new Button(this.leftPos + this.getXOffset() + 95 - 7 - 24, this.topPos + 103, 12, 12, Component.literal("-"), button -> { + this.requestAmount -= ItemTerminalGui.requestModifier(); if (this.requestAmount < 1) this.requestAmount = 1; })); this.minusButton.active = false; - this.requestButton = this.addRenderableWidget(new Button(this.leftPos + this.getXOffset() + 95 - 7 - 25, this.topPos + 115, 50, 20, new TranslatableComponent("info." + PrettyPipes.ID + ".request"), button -> { + this.requestButton = this.addRenderableWidget(new Button(this.leftPos + this.getXOffset() + 95 - 7 - 25, this.topPos + 115, 50, 20, Component.translatable("info." + PrettyPipes.ID + ".request"), button -> { var widget = this.streamWidgets().filter(w -> w.selected).findFirst(); - if (!widget.isPresent()) + if (widget.isEmpty()) return; var stack = widget.get().stack.copy(); stack.setCount(1); @@ -98,7 +97,7 @@ public class ItemTerminalGui extends AbstractContainerScreen { + this.orderButton = this.addRenderableWidget(new Button(this.leftPos - 22, this.topPos, 20, 20, Component.literal(""), button -> { if (this.sortedItems == null) return; var prefs = PlayerPrefs.get(); @@ -106,7 +105,7 @@ public class ItemTerminalGui extends AbstractContainerScreen { + this.ascendingButton = this.addRenderableWidget(new Button(this.leftPos - 22, this.topPos + 22, 20, 20, Component.literal(""), button -> { if (this.sortedItems == null) return; var prefs = PlayerPrefs.get(); @@ -114,7 +113,7 @@ public class ItemTerminalGui extends AbstractContainerScreen { + this.cancelCraftingButton = this.addRenderableWidget(new Button(this.leftPos + this.imageWidth + 4, this.topPos + 4 + 64, 54, 20, Component.translatable("info." + PrettyPipes.ID + ".cancel_all"), b -> { })); this.cancelCraftingButton.visible = false; for (var y = 0; y < 4; y++) { @@ -207,8 +206,8 @@ public class ItemTerminalGui extends AbstractContainerScreen #updateJSONURL="http://myurl.me/" #optional # A URL for the "homepage" for this mod, displayed in the mod UI @@ -27,7 +27,7 @@ displayName="Pretty Pipes" #mandatory # A text field displayed in the mod UI #credits="" #optional # A text field displayed in the mod UI -authors="Ellpeck" #optional +authors = "Ellpeck" #optional # The description text for the mod (multi line!) (#mandatory) -description=''' +description = ''' wow pipes, how creative''' diff --git a/src/main/resources/assets/prettypipes/models/block/pipe_center.json b/src/main/resources/assets/prettypipes/models/block/pipe_center.json index 8dc48a9..d24ae07 100644 --- a/src/main/resources/assets/prettypipes/models/block/pipe_center.json +++ b/src/main/resources/assets/prettypipes/models/block/pipe_center.json @@ -1,154 +1,370 @@ { - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "0": "prettypipes:block/pipe", - "particle": "prettypipes:block/pipe" - }, - "elements": [ - { - "from": [5, 5, 5], - "to": [6, 11, 6], - "faces": { - "north": {"uv": [0, 0, 1, 6], "texture": "#0"}, - "east": {"uv": [0, 0, 1, 6], "texture": "#0"}, - "south": {"uv": [0, 0, 1, 6], "texture": "#0"}, - "west": {"uv": [0, 0, 1, 6], "texture": "#0"}, - "up": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "down": {"uv": [0, 0, 1, 1], "texture": "#0"} - } - }, - { - "from": [5, 5, 10], - "to": [6, 11, 11], - "faces": { - "north": {"uv": [0, 0, 1, 6], "texture": "#0"}, - "east": {"uv": [0, 0, 1, 6], "texture": "#0"}, - "south": {"uv": [0, 0, 1, 6], "texture": "#0"}, - "west": {"uv": [0, 0, 1, 6], "texture": "#0"}, - "up": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "down": {"uv": [0, 0, 1, 1], "texture": "#0"} - } - }, - { - "from": [10, 5, 10], - "to": [11, 11, 11], - "faces": { - "north": {"uv": [0, 0, 1, 6], "texture": "#0"}, - "east": {"uv": [0, 0, 1, 6], "texture": "#0"}, - "south": {"uv": [0, 0, 1, 6], "texture": "#0"}, - "west": {"uv": [0, 0, 1, 6], "texture": "#0"}, - "up": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "down": {"uv": [0, 0, 1, 1], "texture": "#0"} - } - }, - { - "from": [10, 5, 5], - "to": [11, 11, 6], - "faces": { - "north": {"uv": [0, 0, 1, 6], "texture": "#0"}, - "east": {"uv": [0, 0, 1, 6], "texture": "#0"}, - "south": {"uv": [0, 0, 1, 6], "texture": "#0"}, - "west": {"uv": [0, 0, 1, 6], "texture": "#0"}, - "up": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "down": {"uv": [0, 0, 1, 1], "texture": "#0"} - } - }, - { - "from": [6, 10, 10], - "to": [10, 11, 11], - "faces": { - "north": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "east": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "south": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "west": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "up": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "down": {"uv": [0, 0, 4, 1], "texture": "#0"} - } - }, - { - "from": [6, 5, 10], - "to": [10, 6, 11], - "faces": { - "north": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "east": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "south": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "west": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "up": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "down": {"uv": [0, 0, 4, 1], "texture": "#0"} - } - }, - { - "from": [6, 5, 5], - "to": [10, 6, 6], - "faces": { - "north": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "east": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "south": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "west": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "up": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "down": {"uv": [0, 0, 4, 1], "texture": "#0"} - } - }, - { - "from": [5, 5, 6], - "to": [6, 6, 10], - "faces": { - "north": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "east": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "south": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "west": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "up": {"uv": [0, 0, 1, 4], "texture": "#0"}, - "down": {"uv": [0, 0, 1, 4], "texture": "#0"} - } - }, - { - "from": [5, 10, 6], - "to": [6, 11, 10], - "faces": { - "north": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "east": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "south": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "west": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "up": {"uv": [0, 0, 1, 4], "texture": "#0"}, - "down": {"uv": [0, 0, 1, 4], "texture": "#0"} - } - }, - { - "from": [10, 10, 6], - "to": [11, 11, 10], - "faces": { - "north": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "east": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "south": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "west": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "up": {"uv": [0, 0, 1, 4], "texture": "#0"}, - "down": {"uv": [0, 0, 1, 4], "texture": "#0"} - } - }, - { - "from": [10, 5, 6], - "to": [11, 6, 10], - "faces": { - "north": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "east": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "south": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "west": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "up": {"uv": [0, 0, 1, 4], "texture": "#0"}, - "down": {"uv": [0, 0, 1, 4], "texture": "#0"} - } - }, - { - "from": [6, 10, 5], - "to": [10, 11, 6], - "faces": { - "north": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "east": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "south": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "west": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "up": {"uv": [0, 0, 4, 1], "texture": "#0"}, - "down": {"uv": [0, 0, 4, 1], "texture": "#0"} - } - } - ] + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "prettypipes:block/pipe", + "particle": "prettypipes:block/pipe" + }, + "elements": [ + { + "from": [5, 5, 5], + "to": [6, 11, 6], + "faces": { + "north": { + "uv": [0, 0, 1, 6], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 6], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 6], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 6], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } + }, + { + "from": [5, 5, 10], + "to": [6, 11, 11], + "faces": { + "north": { + "uv": [0, 0, 1, 6], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 6], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 6], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 6], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } + }, + { + "from": [10, 5, 10], + "to": [11, 11, 11], + "faces": { + "north": { + "uv": [0, 0, 1, 6], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 6], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 6], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 6], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } + }, + { + "from": [10, 5, 5], + "to": [11, 11, 6], + "faces": { + "north": { + "uv": [0, 0, 1, 6], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 6], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 6], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 6], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } + }, + { + "from": [6, 10, 10], + "to": [10, 11, 11], + "faces": { + "north": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 4, 1], + "texture": "#0" + } + } + }, + { + "from": [6, 5, 10], + "to": [10, 6, 11], + "faces": { + "north": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 4, 1], + "texture": "#0" + } + } + }, + { + "from": [6, 5, 5], + "to": [10, 6, 6], + "faces": { + "north": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 4, 1], + "texture": "#0" + } + } + }, + { + "from": [5, 5, 6], + "to": [6, 6, 10], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 4], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 4], + "texture": "#0" + } + } + }, + { + "from": [5, 10, 6], + "to": [6, 11, 10], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 4], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 4], + "texture": "#0" + } + } + }, + { + "from": [10, 10, 6], + "to": [11, 11, 10], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 4], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 4], + "texture": "#0" + } + } + }, + { + "from": [10, 5, 6], + "to": [11, 6, 10], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 4], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 4], + "texture": "#0" + } + } + }, + { + "from": [6, 10, 5], + "to": [10, 11, 6], + "faces": { + "north": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 4, 1], + "texture": "#0" + } + } + } + ] } \ No newline at end of file diff --git a/src/main/resources/assets/prettypipes/models/block/pipe_end.json b/src/main/resources/assets/prettypipes/models/block/pipe_end.json index 8eac2f0..706bd36 100644 --- a/src/main/resources/assets/prettypipes/models/block/pipe_end.json +++ b/src/main/resources/assets/prettypipes/models/block/pipe_end.json @@ -1,57 +1,137 @@ { - "credit": "Made with Blockbench", - "textures": { - "0": "prettypipes:block/pipe", - "particle": "prettypipes:block/pipe" - }, - "elements": [ - { - "from": [5, 10, 0], - "to": [6, 11, 5], - "faces": { - "north": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "east": {"uv": [0, 0, 5, 1], "texture": "#0"}, - "south": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "west": {"uv": [0, 0, 5, 1], "texture": "#0"}, - "up": {"uv": [0, 0, 5, 1], "rotation": 90, "texture": "#0"}, - "down": {"uv": [0, 0, 5, 1], "rotation": 270, "texture": "#0"} - } - }, - { - "from": [5, 5, 0], - "to": [6, 6, 5], - "faces": { - "north": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "east": {"uv": [0, 0, 5, 1], "texture": "#0"}, - "south": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "west": {"uv": [0, 0, 5, 1], "texture": "#0"}, - "up": {"uv": [0, 0, 5, 1], "rotation": 90, "texture": "#0"}, - "down": {"uv": [0, 0, 5, 1], "rotation": 270, "texture": "#0"} - } - }, - { - "from": [10, 5, 0], - "to": [11, 6, 5], - "faces": { - "north": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "east": {"uv": [0, 0, 5, 1], "texture": "#0"}, - "south": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "west": {"uv": [0, 0, 5, 1], "texture": "#0"}, - "up": {"uv": [0, 0, 5, 1], "rotation": 90, "texture": "#0"}, - "down": {"uv": [0, 0, 5, 1], "rotation": 270, "texture": "#0"} - } - }, - { - "from": [10, 10, 0], - "to": [11, 11, 5], - "faces": { - "north": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "east": {"uv": [0, 0, 5, 1], "texture": "#0"}, - "south": {"uv": [0, 0, 1, 1], "texture": "#0"}, - "west": {"uv": [0, 0, 5, 1], "texture": "#0"}, - "up": {"uv": [0, 0, 5, 1], "rotation": 90, "texture": "#0"}, - "down": {"uv": [0, 0, 5, 1], "rotation": 270, "texture": "#0"} - } - } - ] + "credit": "Made with Blockbench", + "textures": { + "0": "prettypipes:block/pipe", + "particle": "prettypipes:block/pipe" + }, + "elements": [ + { + "from": [5, 10, 0], + "to": [6, 11, 5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 5, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 5, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 5, 1], + "rotation": 90, + "texture": "#0" + }, + "down": { + "uv": [0, 0, 5, 1], + "rotation": 270, + "texture": "#0" + } + } + }, + { + "from": [5, 5, 0], + "to": [6, 6, 5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 5, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 5, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 5, 1], + "rotation": 90, + "texture": "#0" + }, + "down": { + "uv": [0, 0, 5, 1], + "rotation": 270, + "texture": "#0" + } + } + }, + { + "from": [10, 5, 0], + "to": [11, 6, 5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 5, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 5, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 5, 1], + "rotation": 90, + "texture": "#0" + }, + "down": { + "uv": [0, 0, 5, 1], + "rotation": 270, + "texture": "#0" + } + } + }, + { + "from": [10, 10, 0], + "to": [11, 11, 5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 5, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 5, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 5, 1], + "rotation": 90, + "texture": "#0" + }, + "down": { + "uv": [0, 0, 5, 1], + "rotation": 270, + "texture": "#0" + } + } + } + ] } \ No newline at end of file diff --git a/src/main/resources/assets/prettypipes/models/block/pipe_legs.json b/src/main/resources/assets/prettypipes/models/block/pipe_legs.json index 73164ee..b752c29 100644 --- a/src/main/resources/assets/prettypipes/models/block/pipe_legs.json +++ b/src/main/resources/assets/prettypipes/models/block/pipe_legs.json @@ -1,33 +1,66 @@ { - "credit": "Made with Blockbench", - "parent": "block/block", - "textures": { - "1": "prettypipes:block/pipe_legs", - "particle": "prettypipes:block/pipe" - }, - "elements": [ - { - "from": [6, 4, 6], - "to": [10, 5, 10], - "faces": { - "north": {"uv": [0, 7, 4, 8], "texture": "#1"}, - "east": {"uv": [0, 7, 4, 8], "texture": "#1"}, - "south": {"uv": [0, 7, 4, 8], "texture": "#1"}, - "west": {"uv": [0, 7, 4, 8], "texture": "#1"}, - "up": {"uv": [1, 1, 5, 5], "texture": "#1"}, - "down": {"uv": [1, 1, 5, 5], "texture": "#1"} - } - }, - { - "from": [7, 0, 7], - "to": [9, 4, 9], - "faces": { - "north": {"uv": [1, 1, 3, 5], "texture": "#1"}, - "east": {"uv": [1, 1, 3, 5], "texture": "#1"}, - "south": {"uv": [1, 1, 3, 5], "texture": "#1"}, - "west": {"uv": [1, 1, 3, 5], "texture": "#1"}, - "down": {"uv": [1, 1, 3, 3], "texture": "#1"} - } - } - ] + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "1": "prettypipes:block/pipe_legs", + "particle": "prettypipes:block/pipe" + }, + "elements": [ + { + "from": [6, 4, 6], + "to": [10, 5, 10], + "faces": { + "north": { + "uv": [0, 7, 4, 8], + "texture": "#1" + }, + "east": { + "uv": [0, 7, 4, 8], + "texture": "#1" + }, + "south": { + "uv": [0, 7, 4, 8], + "texture": "#1" + }, + "west": { + "uv": [0, 7, 4, 8], + "texture": "#1" + }, + "up": { + "uv": [1, 1, 5, 5], + "texture": "#1" + }, + "down": { + "uv": [1, 1, 5, 5], + "texture": "#1" + } + } + }, + { + "from": [7, 0, 7], + "to": [9, 4, 9], + "faces": { + "north": { + "uv": [1, 1, 3, 5], + "texture": "#1" + }, + "east": { + "uv": [1, 1, 3, 5], + "texture": "#1" + }, + "south": { + "uv": [1, 1, 3, 5], + "texture": "#1" + }, + "west": { + "uv": [1, 1, 3, 5], + "texture": "#1" + }, + "down": { + "uv": [1, 1, 3, 3], + "texture": "#1" + } + } + } + ] } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index cf2e316..16eb178 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,9 @@ { - "schemaVersion": 1, - "id": "prettypipes", - "version": "0.0.0", - "contributors": [ "SoniEx2" ], - "depends": { "forge": "*" } + "schemaVersion": 1, + "id": "prettypipes", + "version": "0.0.0", + "contributors": ["SoniEx2"], + "depends": { + "forge": "*" + } }