1.19, part 1

This commit is contained in:
Ell 2022-06-27 13:57:06 +02:00
parent 5909820693
commit 27e25fbedf
56 changed files with 846 additions and 574 deletions

View file

@ -24,7 +24,7 @@ if (System.getenv('BUILD_NUMBER') != null) {
java.toolchain.languageVersion = JavaLanguageVersion.of(17) java.toolchain.languageVersion = JavaLanguageVersion.of(17)
minecraft { minecraft {
mappings channel: 'official', version: '1.18.2' mappings channel: 'official', version: '1.19'
runs { runs {
client { client {
@ -105,11 +105,11 @@ configurations {
} }
dependencies { 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' embed 'org.jgrapht:jgrapht-core:1.5.1'
compileOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.5.174:api") compileOnly fg.deobf("mezz.jei:jei-1.19-forge-api:11.0.0.206")
runtimeOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.5.174") runtimeOnly fg.deobf("mezz.jei:jei-1.19-forge:11.0.0.206")
// to test the rf requiring and crafting stuff // to test the rf requiring and crafting stuff
/* runtimeOnly fg.deobf("curse.maven:powah-352656:3057732") /* runtimeOnly fg.deobf("curse.maven:powah-352656:3057732")

View file

@ -52,6 +52,7 @@ import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
import net.minecraft.client.renderer.entity.EntityRenderers; import net.minecraft.client.renderer.entity.EntityRenderers;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.inventory.MenuType; 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.CapabilityManager;
import net.minecraftforge.common.capabilities.CapabilityToken; import net.minecraftforge.common.capabilities.CapabilityToken;
import net.minecraftforge.common.extensions.IForgeMenuType; import net.minecraftforge.common.extensions.IForgeMenuType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.registries.ForgeRegistries; 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.Locale;
import java.util.function.BiFunction; import java.util.function.BiFunction;
@ -86,7 +83,7 @@ public final class Registry {
public static final CreativeModeTab TAB = new CreativeModeTab(PrettyPipes.ID) { public static final CreativeModeTab TAB = new CreativeModeTab(PrettyPipes.ID) {
@Override @Override
public ItemStack makeIcon() { public ItemStack makeIcon() {
return new ItemStack(wrenchItem); return new ItemStack(Registry.wrenchItem);
} }
}; };
@ -125,89 +122,84 @@ public final class Registry {
public static MenuType<FilterModifierModuleContainer> filterModifierModuleContainer; public static MenuType<FilterModifierModuleContainer> filterModifierModuleContainer;
@SubscribeEvent @SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) { public static void register(RegisterEvent event) {
event.getRegistry().registerAll( event.register(ForgeRegistries.Keys.BLOCKS, h -> {
pipeBlock = new PipeBlock().setRegistryName("pipe"), h.register(new ResourceLocation(PrettyPipes.ID, "pipe"), Registry.pipeBlock = new PipeBlock());
itemTerminalBlock = new ItemTerminalBlock().setRegistryName("item_terminal"), h.register(new ResourceLocation(PrettyPipes.ID, "item_terminal"), Registry.itemTerminalBlock = new ItemTerminalBlock());
craftingTerminalBlock = new CraftingTerminalBlock().setRegistryName("crafting_terminal"), h.register(new ResourceLocation(PrettyPipes.ID, "crafting_terminal"), Registry.craftingTerminalBlock = new CraftingTerminalBlock());
pressurizerBlock = new PressurizerBlock().setRegistryName("pressurizer") 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));
} }
@SubscribeEvent ForgeRegistries.BLOCKS.getEntries().stream()
public static void registerItems(RegistryEvent.Register<Item> event) { .filter(b -> b.getKey().location().getNamespace().equals(PrettyPipes.ID))
var registry = event.getRegistry(); .forEach(b -> h.register(b.getKey().location(), new BlockItem(b.getValue(), new Item.Properties().tab(Registry.TAB))));
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() event.register(ForgeRegistries.Keys.BLOCK_ENTITY_TYPES, h -> {
.filter(b -> b.getRegistryName().getNamespace().equals(PrettyPipes.ID)) h.register(new ResourceLocation(PrettyPipes.ID, "pipe"), Registry.pipeBlockEntity = BlockEntityType.Builder.of(PipeBlockEntity::new, Registry.pipeBlock).build(null));
.forEach(b -> registry.register(new BlockItem(b, new Item.Properties().tab(TAB)).setRegistryName(b.getRegistryName()))); 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.<PipeFrameEntity>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 private static <T extends AbstractPipeContainer<?>> MenuType<T> registerPipeContainer(RegisterEvent.RegisterHelper<MenuType<?>> helper, String name) {
public static void registerBlockEntities(RegistryEvent.Register<BlockEntityType<?>> event) { var type = (MenuType<T>) IForgeMenuType.create((windowId, inv, data) -> {
event.getRegistry().registerAll(
pipeBlockEntity = (BlockEntityType<PipeBlockEntity>) BlockEntityType.Builder.of(PipeBlockEntity::new, pipeBlock).build(null).setRegistryName("pipe"),
itemTerminalBlockEntity = (BlockEntityType<ItemTerminalBlockEntity>) BlockEntityType.Builder.of(ItemTerminalBlockEntity::new, itemTerminalBlock).build(null).setRegistryName("item_terminal"),
craftingTerminalBlockEntity = (BlockEntityType<CraftingTerminalBlockEntity>) BlockEntityType.Builder.of(CraftingTerminalBlockEntity::new, craftingTerminalBlock).build(null).setRegistryName("crafting_terminal"),
pressurizerBlockEntity = (BlockEntityType<PressurizerBlockEntity>) BlockEntityType.Builder.of(PressurizerBlockEntity::new, pressurizerBlock).build(null).setRegistryName("pressurizer")
);
}
@SubscribeEvent
public static void registerEntities(RegistryEvent.Register<EntityType<?>> event) {
event.getRegistry().registerAll(
pipeFrameEntity = (EntityType<PipeFrameEntity>) EntityType.Builder.<PipeFrameEntity>of(PipeFrameEntity::new, MobCategory.MISC).build("pipe_frame").setRegistryName("pipe_frame")
);
}
@SubscribeEvent
public static void registerContainers(RegistryEvent.Register<MenuType<?>> event) {
event.getRegistry().registerAll(
pipeContainer = (MenuType<MainPipeContainer>) IForgeMenuType.create((windowId, inv, data) -> new MainPipeContainer(pipeContainer, windowId, inv.player, data.readBlockPos())).setRegistryName("pipe"),
itemTerminalContainer = (MenuType<ItemTerminalContainer>) IForgeMenuType.create((windowId, inv, data) -> new ItemTerminalContainer(itemTerminalContainer, windowId, inv.player, data.readBlockPos())).setRegistryName("item_terminal"),
craftingTerminalContainer = (MenuType<CraftingTerminalContainer>) IForgeMenuType.create((windowId, inv, data) -> new CraftingTerminalContainer(craftingTerminalContainer, windowId, inv.player, data.readBlockPos())).setRegistryName("crafting_terminal"),
pressurizerContainer = (MenuType<PressurizerContainer>) 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 <T extends AbstractPipeContainer<?>> MenuType<T> createPipeContainer(String name) {
return (MenuType<T>) IForgeMenuType.create((windowId, inv, data) -> {
var tile = Utility.getBlockEntity(PipeBlockEntity.class, inv.player.level, data.readBlockPos()); var tile = Utility.getBlockEntity(PipeBlockEntity.class, inv.player.level, data.readBlockPos());
var moduleIndex = data.readInt(); var moduleIndex = data.readInt();
var moduleStack = tile.modules.getStackInSlot(moduleIndex); var moduleStack = tile.modules.getStackInSlot(moduleIndex);
return ((IModule) moduleStack.getItem()).getContainer(moduleStack, tile, windowId, inv, inv.player, 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<String, ModuleTier, ModuleItem> item) { private static void registerTieredModule(RegisterEvent.RegisterHelper<Item> helper, String name, BiFunction<String, ModuleTier, ModuleItem> item) {
List<Item> items = new ArrayList<>();
for (var tier : ModuleTier.values()) for (var tier : ModuleTier.values())
items.add(item.apply(name, tier).setRegistryName(tier.name().toLowerCase(Locale.ROOT) + "_" + name)); helper.register(new ResourceLocation(PrettyPipes.ID, tier.name().toLowerCase(Locale.ROOT) + "_" + name), item.apply(name, tier));
return items.toArray(new Item[0]);
} }
public static void setup(FMLCommonSetupEvent event) { public static void setup(FMLCommonSetupEvent event) {
@ -217,21 +209,21 @@ public final class Registry {
public static final class Client { public static final class Client {
public static void setup(FMLClientSetupEvent event) { public static void setup(FMLClientSetupEvent event) {
ItemBlockRenderTypes.setRenderLayer(pipeBlock, RenderType.cutout()); ItemBlockRenderTypes.setRenderLayer(Registry.pipeBlock, RenderType.cutout());
BlockEntityRenderers.register(pipeBlockEntity, PipeRenderer::new); BlockEntityRenderers.register(Registry.pipeBlockEntity, PipeRenderer::new);
EntityRenderers.register(pipeFrameEntity, PipeFrameRenderer::new); EntityRenderers.register(Registry.pipeFrameEntity, PipeFrameRenderer::new);
MenuScreens.register(pipeContainer, MainPipeGui::new); MenuScreens.register(Registry.pipeContainer, MainPipeGui::new);
MenuScreens.register(itemTerminalContainer, ItemTerminalGui::new); MenuScreens.register(Registry.itemTerminalContainer, ItemTerminalGui::new);
MenuScreens.register(pressurizerContainer, PressurizerGui::new); MenuScreens.register(Registry.pressurizerContainer, PressurizerGui::new);
MenuScreens.register(craftingTerminalContainer, CraftingTerminalGui::new); MenuScreens.register(Registry.craftingTerminalContainer, CraftingTerminalGui::new);
MenuScreens.register(extractionModuleContainer, ExtractionModuleGui::new); MenuScreens.register(Registry.extractionModuleContainer, ExtractionModuleGui::new);
MenuScreens.register(filterModuleContainer, FilterModuleGui::new); MenuScreens.register(Registry.filterModuleContainer, FilterModuleGui::new);
MenuScreens.register(retrievalModuleContainer, RetrievalModuleGui::new); MenuScreens.register(Registry.retrievalModuleContainer, RetrievalModuleGui::new);
MenuScreens.register(stackSizeModuleContainer, StackSizeModuleGui::new); MenuScreens.register(Registry.stackSizeModuleContainer, StackSizeModuleGui::new);
MenuScreens.register(filterIncreaseModuleContainer, FilterIncreaseModuleGui::new); MenuScreens.register(Registry.filterIncreaseModuleContainer, FilterIncreaseModuleGui::new);
MenuScreens.register(craftingModuleContainer, CraftingModuleGui::new); MenuScreens.register(Registry.craftingModuleContainer, CraftingModuleGui::new);
MenuScreens.register(filterModifierModuleContainer, FilterModifierModuleGui::new); MenuScreens.register(Registry.filterModifierModuleContainer, FilterModifierModuleGui::new);
} }
} }
} }

View file

@ -7,7 +7,8 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag; 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.network.protocol.game.ClientboundBlockEntityDataPacket;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.Containers; import net.minecraft.world.Containers;
@ -54,9 +55,9 @@ public final class Utility {
if (Screen.hasShiftDown()) { if (Screen.hasShiftDown()) {
var content = I18n.get("info." + PrettyPipes.ID + "." + name).split("\n"); var content = I18n.get("info." + PrettyPipes.ID + "." + name).split("\n");
for (var s : content) 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 { } 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)));
} }
} }

View file

@ -1,18 +1,7 @@
package de.ellpeck.prettypipes.compat.jei; package de.ellpeck.prettypipes.compat.jei;
import de.ellpeck.prettypipes.misc.ItemEquality; // TODO JEI
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;
public class CraftingModuleTransferHandler implements IRecipeTransferHandler<CraftingModuleContainer, CraftingRecipe> { public class CraftingModuleTransferHandler implements IRecipeTransferHandler<CraftingModuleContainer, CraftingRecipe> {
@Override @Override
@ -54,3 +43,4 @@ public class CraftingModuleTransferHandler implements IRecipeTransferHandler<Cra
return null; return null;
} }
} }
*/

View file

@ -1,18 +1,7 @@
package de.ellpeck.prettypipes.compat.jei; package de.ellpeck.prettypipes.compat.jei;
import de.ellpeck.prettypipes.packets.PacketGhostSlot; // TODO JEI
import de.ellpeck.prettypipes.packets.PacketHandler; /*
import de.ellpeck.prettypipes.terminal.containers.CraftingTerminalContainer;
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.crafting.CraftingRecipe;
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
public class CraftingTerminalTransferHandler implements IRecipeTransferHandler<CraftingTerminalContainer, CraftingRecipe> { public class CraftingTerminalTransferHandler implements IRecipeTransferHandler<CraftingTerminalContainer, CraftingRecipe> {
@Override @Override
@ -40,3 +29,4 @@ public class CraftingTerminalTransferHandler implements IRecipeTransferHandler<C
return null; return null;
} }
} }
*/

View file

@ -1,31 +1,7 @@
package de.ellpeck.prettypipes.compat.jei; package de.ellpeck.prettypipes.compat.jei;
import de.ellpeck.prettypipes.PrettyPipes; // TODO JEI
import de.ellpeck.prettypipes.misc.PlayerPrefs; /*@JeiPlugin
import de.ellpeck.prettypipes.terminal.containers.ItemTerminalGui;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.JeiPlugin;
import mezz.jei.api.constants.VanillaRecipeCategoryUid;
import mezz.jei.api.gui.handlers.IGuiContainerHandler;
import mezz.jei.api.registration.IGuiHandlerRegistration;
import mezz.jei.api.registration.IRecipeTransferRegistration;
import mezz.jei.api.runtime.IJeiRuntime;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.renderer.Rect2i;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.client.event.ScreenEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.TickEvent.ClientTickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import java.util.ArrayList;
import java.util.List;
@JeiPlugin
public class JEIPrettyPipesPlugin implements IModPlugin { public class JEIPrettyPipesPlugin implements IModPlugin {
private IJeiRuntime runtime; private IJeiRuntime runtime;
@ -123,4 +99,4 @@ public class JEIPrettyPipesPlugin implements IModPlugin {
filter.setFilterText(terminalText); filter.setFilterText(terminalText);
} }
} }
} }*/

View file

@ -42,7 +42,7 @@ public class PipeFrameEntity extends ItemFrame implements IEntityAdditionalSpawn
@Override @Override
protected void defineSynchedData() { protected void defineSynchedData() {
super.defineSynchedData(); super.defineSynchedData();
this.entityData.define(AMOUNT, -1); this.entityData.define(PipeFrameEntity.AMOUNT, -1);
} }
@Override @Override
@ -53,7 +53,7 @@ public class PipeFrameEntity extends ItemFrame implements IEntityAdditionalSpawn
if (this.tickCount % 40 != 0) if (this.tickCount % 40 != 0)
return; return;
var network = PipeNetwork.get(this.level); var network = PipeNetwork.get(this.level);
var attached = getAttachedPipe(this.level, this.pos, this.direction); var attached = PipeFrameEntity.getAttachedPipe(this.level, this.pos, this.direction);
if (attached != null) { if (attached != null) {
var node = network.getNodeFromPipe(attached); var node = network.getNodeFromPipe(attached);
if (node != null) { if (node != null) {
@ -61,17 +61,17 @@ public class PipeFrameEntity extends ItemFrame implements IEntityAdditionalSpawn
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
var items = network.getOrderedNetworkItems(node); var items = network.getOrderedNetworkItems(node);
var amount = items.stream().mapToInt(i -> i.getItemAmount(this.level, stack)).sum(); var amount = items.stream().mapToInt(i -> i.getItemAmount(this.level, stack)).sum();
this.entityData.set(AMOUNT, amount); this.entityData.set(PipeFrameEntity.AMOUNT, amount);
return; return;
} }
} }
} }
this.entityData.set(AMOUNT, -1); this.entityData.set(PipeFrameEntity.AMOUNT, -1);
} }
@Override @Override
public boolean survives() { 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) { 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) { 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() { public int getAmount() {
return this.entityData.get(AMOUNT); return this.entityData.get(PipeFrameEntity.AMOUNT);
} }
@Override @Override

View file

@ -15,6 +15,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraftforge.registries.ForgeRegistries;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
@ -65,6 +66,6 @@ public class PipeFrameItem extends Item {
@Override @Override
public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List<Component> tooltip, TooltipFlag flagIn) { public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List<Component> tooltip, TooltipFlag flagIn) {
super.appendHoverText(stack, worldIn, tooltip, flagIn); super.appendHoverText(stack, worldIn, tooltip, flagIn);
Utility.addTooltip(this.getRegistryName().getPath(), tooltip); Utility.addTooltip(ForgeRegistries.ITEMS.getKey(this).getPath(), tooltip);
} }
} }

View file

@ -20,6 +20,7 @@ import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.EntityBlock;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.List; import java.util.List;
@ -108,7 +109,7 @@ public class WrenchItem extends Item {
@Override @Override
public void appendHoverText(ItemStack stack, Level worldIn, List<Component> tooltip, TooltipFlag flagIn) { public void appendHoverText(ItemStack stack, Level worldIn, List<Component> tooltip, TooltipFlag flagIn) {
Utility.addTooltip(this.getRegistryName().getPath(), tooltip); Utility.addTooltip(ForgeRegistries.ITEMS.getKey(this).getPath(), tooltip);
} }
@Override @Override

View file

@ -3,7 +3,7 @@ package de.ellpeck.prettypipes.misc;
import de.ellpeck.prettypipes.PrettyPipes; import de.ellpeck.prettypipes.PrettyPipes;
import de.ellpeck.prettypipes.network.PipeNetwork; import de.ellpeck.prettypipes.network.PipeNetwork;
import net.minecraft.commands.Commands; 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.resources.ResourceLocation;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.AttachCapabilitiesEvent;
@ -33,9 +33,9 @@ public final class Events {
var dump = PipeNetwork.get(source.getLevel()).toString(); var dump = PipeNetwork.get(source.getLevel()).toString();
try { try {
Files.writeString(file, dump, StandardCharsets.UTF_8); 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) { } 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 -1;
} }
return 0; return 0;
@ -43,13 +43,13 @@ public final class Events {
.then(Commands.literal("uncache").executes(c -> { .then(Commands.literal("uncache").executes(c -> {
var source = c.getSource(); var source = c.getSource();
PipeNetwork.get(source.getLevel()).clearCaches(); 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; return 0;
})) }))
.then(Commands.literal("unlock").executes(c -> { .then(Commands.literal("unlock").executes(c -> {
var source = c.getSource(); var source = c.getSource();
PipeNetwork.get(source.getLevel()).unlock(); 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; return 0;
}))); })));
} }

View file

@ -11,7 +11,7 @@ import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.Screen;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; 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.inventory.Slot;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
@ -51,17 +51,17 @@ public class ItemFilter extends ItemStackHandler {
public List<AbstractWidget> getButtons(Screen gui, int x, int y) { public List<AbstractWidget> getButtons(Screen gui, int x, int y) {
List<AbstractWidget> buttons = new ArrayList<>(); List<AbstractWidget> buttons = new ArrayList<>();
if (this.canModifyWhitelist) { if (this.canModifyWhitelist) {
var whitelistText = (Supplier<TranslatableComponent>) () -> new TranslatableComponent("info." + PrettyPipes.ID + "." + (this.isWhitelist ? "whitelist" : "blacklist")); Supplier<Component> whitelistText = () -> Component.translatable("info." + PrettyPipes.ID + "." + (this.isWhitelist ? "whitelist" : "blacklist"));
buttons.add(new Button(x, y, 70, 20, whitelistText.get(), button -> { buttons.add(new Button(x, y, 70, 20, whitelistText.get(), button -> {
PacketButton.sendAndExecute(this.pipe.getBlockPos(), PacketButton.ButtonResult.FILTER_CHANGE, 0); PacketButton.sendAndExecute(this.pipe.getBlockPos(), PacketButton.ButtonResult.FILTER_CHANGE, 0);
button.setMessage(whitelistText.get()); button.setMessage(whitelistText.get());
})); }));
} }
if (this.canPopulateFromInventories) { 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 @Override
public void renderToolTip(PoseStack matrix, int x, int y) { 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) { 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 // also check if any filter increase modules have the item we need
for (ItemStackHandler handler : this.pipe.getFilters()) { for (ItemStackHandler handler : this.pipe.getFilters()) {
for (var i = 0; i < handler.getSlots(); i++) { for (var i = 0; i < handler.getSlots(); i++) {
@ -164,6 +164,7 @@ public class ItemFilter extends ItemStackHandler {
ItemFilter getFilter(); ItemFilter getFilter();
default void onFilterPopulated() {} default void onFilterPopulated() {
}
} }
} }

View file

@ -16,6 +16,6 @@ public enum ItemOrder {
} }
public ItemOrder next() { public ItemOrder next() {
return values()[(this.ordinal() + 1) % values().length]; return ItemOrder.values()[(this.ordinal() + 1) % ItemOrder.values().length];
} }
} }

View file

@ -4,9 +4,11 @@ import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import de.ellpeck.prettypipes.terminal.containers.ItemTerminalGui; import de.ellpeck.prettypipes.terminal.containers.ItemTerminalGui;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.narration.NarrationElementOutput; 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 net.minecraft.world.item.ItemStack;
import java.util.Optional; import java.util.Optional;
@ -21,7 +23,7 @@ public class ItemTerminalWidget extends AbstractWidget {
public boolean craftable; public boolean craftable;
public ItemTerminalWidget(int xIn, int yIn, int gridX, int gridY, ItemTerminalGui screen) { 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.gridX = gridX;
this.gridY = gridY; this.gridY = gridY;
this.screen = screen; this.screen = screen;
@ -41,7 +43,7 @@ public class ItemTerminalWidget extends AbstractWidget {
this.setBlitOffset(100); this.setBlitOffset(100);
renderer.blitOffset = 100; renderer.blitOffset = 100;
if (this.selected) 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(); RenderSystem.enableDepthTest();
renderer.renderGuiItem(this.stack, this.x, this.y); renderer.renderGuiItem(this.stack, this.x, this.y);
var amount = !this.craftable ? this.stack.getCount() : 0; var amount = !this.craftable ? this.stack.getCount() : 0;
@ -65,8 +67,8 @@ public class ItemTerminalWidget extends AbstractWidget {
var tooltip = this.screen.getTooltipFromItem(this.stack); var tooltip = this.screen.getTooltipFromItem(this.stack);
if (this.stack.getCount() >= 1000) { if (this.stack.getCount() >= 1000) {
var comp = tooltip.get(0); var comp = tooltip.get(0);
if (comp instanceof TextComponent text) { if (comp instanceof MutableComponent m) {
tooltip.set(0, text.append(new TextComponent(" (" + this.stack.getCount() + ')').withStyle(ChatFormatting.BOLD))); tooltip.set(0, m.append(Component.literal(" (" + this.stack.getCount() + ')').withStyle(ChatFormatting.BOLD)));
} }
} }
this.screen.renderTooltip(matrix, tooltip, Optional.empty(), mouseX, mouseY); this.screen.renderTooltip(matrix, tooltip, Optional.empty(), mouseX, mouseY);

View file

@ -20,30 +20,30 @@ public class PlayerPrefs {
public boolean syncJei = true; public boolean syncJei = true;
public void save() { public void save() {
var file = getFile(); var file = PlayerPrefs.getFile();
if (file.exists()) if (file.exists())
file.delete(); file.delete();
try (var writer = new FileWriter(file)) { try (var writer = new FileWriter(file)) {
GSON.toJson(this, writer); PlayerPrefs.GSON.toJson(this, writer);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static PlayerPrefs get() { public static PlayerPrefs get() {
if (instance == null) { if (PlayerPrefs.instance == null) {
var file = getFile(); var file = PlayerPrefs.getFile();
if (file.exists()) { if (file.exists()) {
try (var reader = new FileReader(file)) { try (var reader = new FileReader(file)) {
instance = GSON.fromJson(reader, PlayerPrefs.class); PlayerPrefs.instance = PlayerPrefs.GSON.fromJson(reader, PlayerPrefs.class);
return instance; return PlayerPrefs.instance;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
instance = new PlayerPrefs(); PlayerPrefs.instance = new PlayerPrefs();
} }
return instance; return PlayerPrefs.instance;
} }
private static File getFile() { private static File getFile() {

View file

@ -3,7 +3,9 @@ package de.ellpeck.prettypipes.network;
import de.ellpeck.prettypipes.misc.EquatableItemStack; import de.ellpeck.prettypipes.misc.EquatableItemStack;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import java.util.*; import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class NetworkItem { public class NetworkItem {

View file

@ -1,12 +1,11 @@
package de.ellpeck.prettypipes.network; package de.ellpeck.prettypipes.network;
import de.ellpeck.prettypipes.misc.ItemEquality; import de.ellpeck.prettypipes.misc.ItemEquality;
import de.ellpeck.prettypipes.pipe.PipeBlockEntity;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.NbtUtils;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.common.util.INBTSerializable;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
@ -102,6 +101,6 @@ public class NetworkLocation implements INBTSerializable<CompoundTag> {
@Override @Override
public void deserializeNBT(CompoundTag nbt) { public void deserializeNBT(CompoundTag nbt) {
this.pipePos = NbtUtils.readBlockPos(nbt.getCompound("pipe_pos")); this.pipePos = NbtUtils.readBlockPos(nbt.getCompound("pipe_pos"));
this.direction = Direction.values()[(nbt.getInt("direction"))]; this.direction = Direction.values()[nbt.getInt("direction")];
} }
} }

View file

@ -60,7 +60,7 @@ public class PipeItem implements IPipeItem {
} }
public PipeItem(ItemStack stack, float speed) { public PipeItem(ItemStack stack, float speed) {
this(TYPE, stack, speed); this(PipeItem.TYPE, stack, speed);
} }
public PipeItem(ResourceLocation type, CompoundTag nbt) { public PipeItem(ResourceLocation type, CompoundTag nbt) {
@ -78,7 +78,7 @@ public class PipeItem implements IPipeItem {
public void setDestination(BlockPos startInventory, BlockPos destInventory, GraphPath<BlockPos, NetworkEdge> path) { public void setDestination(BlockPos startInventory, BlockPos destInventory, GraphPath<BlockPos, NetworkEdge> path) {
this.startInventory = startInventory; this.startInventory = startInventory;
this.destInventory = destInventory; this.destInventory = destInventory;
this.path = compilePath(path); this.path = PipeItem.compilePath(path);
this.currGoalPos = this.getStartPipe(); this.currGoalPos = this.getStartPipe();
this.currentTile = 0; this.currentTile = 0;
@ -126,7 +126,7 @@ public class PipeItem implements IPipeItem {
currPipe = next; currPipe = next;
} }
} else { } 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) { if (dist < currSpeed * currSpeed) {
// we're past the start of the pipe, so move to the center of the next pipe // we're past the start of the pipe, so move to the center of the next pipe
BlockPos nextPos; BlockPos nextPos;

View file

@ -53,8 +53,8 @@ public class PacketCraftingModuleTransfer {
public void run() { public void run() {
Player player = ctx.get().getSender(); Player player = ctx.get().getSender();
if (player.containerMenu instanceof CraftingModuleContainer container) { if (player.containerMenu instanceof CraftingModuleContainer container) {
copy(container.input, message.inputs); PacketCraftingModuleTransfer.copy(container.input, message.inputs);
copy(container.output, message.outputs); PacketCraftingModuleTransfer.copy(container.output, message.outputs);
container.modified = true; container.modified = true;
container.broadcastChanges(); container.broadcastChanges();
} }

View file

@ -93,7 +93,7 @@ public class PacketGhostSlot {
private final TagKey<Item> tag; private final TagKey<Item> tag;
public Entry(List<ItemStack> stacks) { public Entry(List<ItemStack> stacks) {
var tag = getTagForStacks(stacks); var tag = Entry.getTagForStacks(stacks);
if (tag != null) { if (tag != null) {
this.stacks = null; this.stacks = null;
this.tag = tag; this.tag = tag;

View file

@ -16,24 +16,24 @@ public final class PacketHandler {
private static SimpleChannel network; private static SimpleChannel network;
public static void setup() { public static void setup() {
network = NetworkRegistry.newSimpleChannel(new ResourceLocation(PrettyPipes.ID, "network"), () -> VERSION, VERSION::equals, VERSION::equals); PacketHandler.network = NetworkRegistry.newSimpleChannel(new ResourceLocation(PrettyPipes.ID, "network"), () -> PacketHandler.VERSION, PacketHandler.VERSION::equals, PacketHandler.VERSION::equals);
network.registerMessage(0, PacketItemEnterPipe.class, PacketItemEnterPipe::toBytes, PacketItemEnterPipe::fromBytes, PacketItemEnterPipe::onMessage); PacketHandler.network.registerMessage(0, PacketItemEnterPipe.class, PacketItemEnterPipe::toBytes, PacketItemEnterPipe::fromBytes, PacketItemEnterPipe::onMessage);
network.registerMessage(1, PacketButton.class, PacketButton::toBytes, PacketButton::fromBytes, PacketButton::onMessage); PacketHandler.network.registerMessage(1, PacketButton.class, PacketButton::toBytes, PacketButton::fromBytes, PacketButton::onMessage);
network.registerMessage(2, PacketNetworkItems.class, PacketNetworkItems::toBytes, PacketNetworkItems::fromBytes, PacketNetworkItems::onMessage); PacketHandler.network.registerMessage(2, PacketNetworkItems.class, PacketNetworkItems::toBytes, PacketNetworkItems::fromBytes, PacketNetworkItems::onMessage);
network.registerMessage(3, PacketRequest.class, PacketRequest::toBytes, PacketRequest::fromBytes, PacketRequest::onMessage); PacketHandler.network.registerMessage(3, PacketRequest.class, PacketRequest::toBytes, PacketRequest::fromBytes, PacketRequest::onMessage);
network.registerMessage(4, PacketGhostSlot.class, PacketGhostSlot::toBytes, PacketGhostSlot::fromBytes, PacketGhostSlot::onMessage); PacketHandler.network.registerMessage(4, PacketGhostSlot.class, PacketGhostSlot::toBytes, PacketGhostSlot::fromBytes, PacketGhostSlot::onMessage);
network.registerMessage(5, PacketCraftingModuleTransfer.class, PacketCraftingModuleTransfer::toBytes, PacketCraftingModuleTransfer::fromBytes, PacketCraftingModuleTransfer::onMessage); PacketHandler.network.registerMessage(5, PacketCraftingModuleTransfer.class, PacketCraftingModuleTransfer::toBytes, PacketCraftingModuleTransfer::fromBytes, PacketCraftingModuleTransfer::onMessage);
} }
public static void sendToAllLoaded(Level world, BlockPos pos, Object message) { 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) { 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) { public static void sendToServer(Object message) {
network.send(PacketDistributor.SERVER.noArg(), message); PacketHandler.network.send(PacketDistributor.SERVER.noArg(), message);
} }
} }

View file

@ -5,9 +5,9 @@ import de.ellpeck.prettypipes.network.NetworkEdge;
import de.ellpeck.prettypipes.network.PipeItem; import de.ellpeck.prettypipes.network.PipeItem;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -46,7 +46,7 @@ public interface IPipeItem extends INBTSerializable<CompoundTag> {
static IPipeItem load(CompoundTag nbt) { static IPipeItem load(CompoundTag nbt) {
var type = new ResourceLocation(nbt.getString("type")); 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; return func != null ? func.apply(type, nbt) : null;
} }
} }

View file

@ -50,26 +50,26 @@ public class PipeBlock extends BaseEntityBlock {
public static final Map<Direction, EnumProperty<ConnectionType>> DIRECTIONS = new HashMap<>(); public static final Map<Direction, EnumProperty<ConnectionType>> DIRECTIONS = new HashMap<>();
private static final Map<Pair<BlockState, BlockState>, VoxelShape> SHAPE_CACHE = new HashMap<>(); private static final Map<Pair<BlockState, BlockState>, VoxelShape> SHAPE_CACHE = new HashMap<>();
private static final Map<Pair<BlockState, BlockState>, VoxelShape> COLL_SHAPE_CACHE = new HashMap<>(); private static final Map<Pair<BlockState, BlockState>, 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<Direction, VoxelShape> DIR_SHAPES = ImmutableMap.<Direction, VoxelShape>builder() public static final Map<Direction, VoxelShape> DIR_SHAPES = ImmutableMap.<Direction, VoxelShape>builder()
.put(Direction.UP, box(5, 10, 5, 11, 16, 11)) .put(Direction.UP, Block.box(5, 10, 5, 11, 16, 11))
.put(Direction.DOWN, box(5, 0, 5, 11, 6, 11)) .put(Direction.DOWN, Block.box(5, 0, 5, 11, 6, 11))
.put(Direction.NORTH, box(5, 5, 0, 11, 11, 6)) .put(Direction.NORTH, Block.box(5, 5, 0, 11, 11, 6))
.put(Direction.SOUTH, box(5, 5, 10, 11, 11, 16)) .put(Direction.SOUTH, Block.box(5, 5, 10, 11, 11, 16))
.put(Direction.EAST, box(10, 5, 5, 16, 11, 11)) .put(Direction.EAST, Block.box(10, 5, 5, 16, 11, 11))
.put(Direction.WEST, box(0, 5, 5, 6, 11, 11)) .put(Direction.WEST, Block.box(0, 5, 5, 6, 11, 11))
.build(); .build();
static { static {
for (var dir : Direction.values()) 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() { public PipeBlock() {
super(Block.Properties.of(Material.STONE).strength(2).sound(SoundType.STONE).noOcclusion()); super(Block.Properties.of(Material.STONE).strength(2).sound(SoundType.STONE).noOcclusion());
var state = this.defaultBlockState().setValue(BlockStateProperties.WATERLOGGED, false); 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); state = state.setValue(prop, ConnectionType.DISCONNECTED);
this.registerDefaultState(state); this.registerDefaultState(state);
} }
@ -100,7 +100,7 @@ public class PipeBlock extends BaseEntityBlock {
@Override @Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(DIRECTIONS.values().toArray(new EnumProperty[0])); builder.add(PipeBlock.DIRECTIONS.values().toArray(new EnumProperty[0]));
builder.add(BlockStateProperties.WATERLOGGED); builder.add(BlockStateProperties.WATERLOGGED);
} }
@ -114,7 +114,7 @@ public class PipeBlock extends BaseEntityBlock {
var newState = this.createState(worldIn, pos, state); var newState = this.createState(worldIn, pos, state);
if (newState != state) { if (newState != state) {
worldIn.setBlockAndUpdate(pos, newState); worldIn.setBlockAndUpdate(pos, newState);
onStateChanged(worldIn, pos, newState); PipeBlock.onStateChanged(worldIn, pos, newState);
} }
} }
@ -133,17 +133,17 @@ public class PipeBlock extends BaseEntityBlock {
@Override @Override
public void setPlacedBy(Level worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { public void setPlacedBy(Level worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) {
onStateChanged(worldIn, pos, state); PipeBlock.onStateChanged(worldIn, pos, state);
} }
@Override @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { 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 @Override
public VoxelShape getCollisionShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { 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 // make the shape a bit higher so we can jump up onto a higher block
var newShape = new MutableObject<VoxelShape>(Shapes.empty()); var newShape = new MutableObject<VoxelShape>(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))); 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 key = Pair.of(state, cover);
var shape = cache.get(key); var shape = cache.get(key);
if (shape == null) { if (shape == null) {
shape = CENTER_SHAPE; shape = PipeBlock.CENTER_SHAPE;
for (var entry : DIRECTIONS.entrySet()) { for (var entry : PipeBlock.DIRECTIONS.entrySet()) {
if (state.getValue(entry.getValue()).isConnected()) 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) if (shapeModifier != null)
shape = shapeModifier.apply(shape); shape = shapeModifier.apply(shape);
@ -187,7 +187,7 @@ public class PipeBlock extends BaseEntityBlock {
state = state.setValue(BlockStateProperties.WATERLOGGED, true); state = state.setValue(BlockStateProperties.WATERLOGGED, true);
for (var dir : Direction.values()) { for (var dir : Direction.values()) {
var prop = DIRECTIONS.get(dir); var prop = PipeBlock.DIRECTIONS.get(dir);
var type = this.getConnectionType(world, pos, dir, state); var type = this.getConnectionType(world, pos, dir, state);
// don't reconnect on blocked faces // don't reconnect on blocked faces
if (type.isConnected() && curr.getValue(prop) == ConnectionType.BLOCKED) if (type.isConnected() && curr.getValue(prop) == ConnectionType.BLOCKED)
@ -215,8 +215,8 @@ public class PipeBlock extends BaseEntityBlock {
if (blockHandler != null) if (blockHandler != null)
return ConnectionType.CONNECTED; return ConnectionType.CONNECTED;
var offState = world.getBlockState(offset); var offState = world.getBlockState(offset);
if (hasLegsTo(world, offState, offset, direction)) { if (PipeBlock.hasLegsTo(world, offState, offset, direction)) {
if (DIRECTIONS.values().stream().noneMatch(d -> state.getValue(d) == ConnectionType.LEGS)) if (PipeBlock.DIRECTIONS.values().stream().noneMatch(d -> state.getValue(d) == ConnectionType.LEGS))
return ConnectionType.LEGS; return ConnectionType.LEGS;
} }
return ConnectionType.DISCONNECTED; return ConnectionType.DISCONNECTED;
@ -226,7 +226,7 @@ public class PipeBlock extends BaseEntityBlock {
if (state.getBlock() instanceof WallBlock || state.getBlock() instanceof FenceBlock) if (state.getBlock() instanceof WallBlock || state.getBlock() instanceof FenceBlock)
return direction == Direction.DOWN; return direction == Direction.DOWN;
if (state.getMaterial() == Material.STONE || state.getMaterial() == Material.METAL) if (state.getMaterial() == Material.STONE || state.getMaterial() == Material.METAL)
return canSupportCenter(world, pos, direction.getOpposite()); return Block.canSupportCenter(world, pos, direction.getOpposite());
return false; return false;
} }
@ -240,7 +240,7 @@ public class PipeBlock extends BaseEntityBlock {
var connections = 0; var connections = 0;
var force = false; var force = false;
for (var dir : Direction.values()) { for (var dir : Direction.values()) {
var value = newState.getValue(DIRECTIONS.get(dir)); var value = newState.getValue(PipeBlock.DIRECTIONS.get(dir));
if (!value.isConnected()) if (!value.isConnected())
continue; continue;
connections++; connections++;
@ -271,7 +271,7 @@ public class PipeBlock extends BaseEntityBlock {
@Override @Override
public void playerWillDestroy(Level worldIn, BlockPos pos, BlockState state, Player player) { 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); super.playerWillDestroy(worldIn, pos, state, player);
} }
@ -302,7 +302,7 @@ public class PipeBlock extends BaseEntityBlock {
@org.jetbrains.annotations.Nullable @org.jetbrains.annotations.Nullable
@Override @Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) { public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> 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) { public static void dropItems(Level worldIn, BlockPos pos, Player player) {

View file

@ -17,7 +17,6 @@ import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.Connection; import net.minecraft.network.Connection;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.Containers; import net.minecraft.world.Containers;
@ -382,7 +381,7 @@ public class PipeBlockEntity extends BlockEntity implements MenuProvider, IPipeC
@Override @Override
public Component getDisplayName() { public Component getDisplayName() {
return new TranslatableComponent("container." + PrettyPipes.ID + ".pipe"); return Component.translatable("container." + PrettyPipes.ID + ".pipe");
} }
@Nullable @Nullable

View file

@ -7,7 +7,9 @@ import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.util.RandomSource;
import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer; import net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer;
import java.util.Random; import java.util.Random;
@ -40,7 +42,7 @@ public class PipeRenderer implements BlockEntityRenderer<PipeBlockEntity> {
if (!ItemBlockRenderTypes.canRenderInLayer(tile.cover, layer)) if (!ItemBlockRenderTypes.canRenderInLayer(tile.cover, layer))
continue; continue;
ForgeHooksClient.setRenderType(layer); 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); ForgeHooksClient.setRenderType(null);
ForgeBlockModelRenderer.clearCache(); ForgeBlockModelRenderer.clearCache();

View file

@ -79,7 +79,7 @@ public abstract class AbstractPipeGui<T extends AbstractPipeContainer<?>> extend
@Override @Override
protected void renderBg(PoseStack matrix, float partialTicks, int mouseX, int mouseY) { protected void renderBg(PoseStack matrix, float partialTicks, int mouseX, int mouseY) {
RenderSystem.setShader(GameRenderer::getPositionTexShader); 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); this.blit(matrix, this.leftPos, this.topPos + 32, 0, 0, 176, 171);
for (var tab : this.tabs) for (var tab : this.tabs)
@ -143,7 +143,7 @@ public abstract class AbstractPipeGui<T extends AbstractPipeContainer<?>> extend
AbstractPipeGui.this.itemRenderer.renderGuiItem(this.moduleStack, this.x + 6, this.y + itemOffset); AbstractPipeGui.this.itemRenderer.renderGuiItem(this.moduleStack, this.x + 6, this.y + itemOffset);
RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, TEXTURE); RenderSystem.setShaderTexture(0, AbstractPipeGui.TEXTURE);
} }
private void drawForeground(PoseStack matrix, int mouseX, int mouseY) { private void drawForeground(PoseStack matrix, int mouseX, int mouseY) {

View file

@ -7,6 +7,7 @@ import de.ellpeck.prettypipes.pipe.PipeBlockEntity;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
public class HighPriorityModuleItem extends ModuleItem { public class HighPriorityModuleItem extends ModuleItem {
private final int priority; private final int priority;
public HighPriorityModuleItem(String name, ModuleTier tier) { public HighPriorityModuleItem(String name, ModuleTier tier) {

View file

@ -7,6 +7,7 @@ import de.ellpeck.prettypipes.pipe.PipeBlockEntity;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
public class LowPriorityModuleItem extends ModuleItem { public class LowPriorityModuleItem extends ModuleItem {
private final int priority; private final int priority;
public LowPriorityModuleItem(String name, ModuleTier tier) { public LowPriorityModuleItem(String name, ModuleTier tier) {

View file

@ -7,9 +7,8 @@ import net.minecraft.world.item.ItemStack;
public class RedstoneModuleItem extends ModuleItem { public class RedstoneModuleItem extends ModuleItem {
public RedstoneModuleItem(String name) { public RedstoneModuleItem() {
super(name); super("redstone_module");
this.setRegistryName(name);
} }
@Override @Override

View file

@ -15,7 +15,6 @@ public class SortingModuleItem extends ModuleItem {
public SortingModuleItem(String name, Type type) { public SortingModuleItem(String name, Type type) {
super(name); super(name);
this.type = type; this.type = type;
this.setRegistryName(name);
} }
@Override @Override

View file

@ -7,6 +7,7 @@ import de.ellpeck.prettypipes.pipe.PipeBlockEntity;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
public class SpeedModuleItem extends ModuleItem { public class SpeedModuleItem extends ModuleItem {
private final float speedIncrease; private final float speedIncrease;
public SpeedModuleItem(String name, ModuleTier tier) { public SpeedModuleItem(String name, ModuleTier tier) {

View file

@ -17,7 +17,7 @@ public class CraftingModuleGui extends AbstractPipeGui<CraftingModuleContainer>
protected void renderBg(PoseStack matrix, float partialTicks, int mouseX, int mouseY) { protected void renderBg(PoseStack matrix, float partialTicks, int mouseX, int mouseY) {
super.renderBg(matrix, partialTicks, mouseX, mouseY); super.renderBg(matrix, partialTicks, mouseX, mouseY);
RenderSystem.setShader(GameRenderer::getPositionTexShader); 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); this.blit(matrix, this.leftPos + 176 / 2 - 16 / 2, this.topPos + 32 + 18 * 2, 176, 80, 16, 16);
} }
} }

View file

@ -147,7 +147,7 @@ public class CraftingModuleItem extends ModuleItem {
var out = output.getStackInSlot(i); var out = output.getStackInSlot(i);
if (!out.isEmpty() && ItemEquality.compareItems(out, stack, equalityTypes)) { 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 // 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) if (availableCrafts > 0)
craftable += out.getCount() * availableCrafts; craftable += out.getCount() * availableCrafts;
} }
@ -179,7 +179,7 @@ public class CraftingModuleItem extends ModuleItem {
continue; continue;
var copy = in.copy(); var copy = in.copy();
copy.setCount(in.getCount() * toCraft); 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()); tile.craftIngredientRequests.addAll(ret.getLeft());
} }

View file

@ -5,7 +5,6 @@ import de.ellpeck.prettypipes.pipe.containers.AbstractPipeContainer;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.MenuType; import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.inventory.Slot;
public class FilterIncreaseModuleContainer extends AbstractPipeContainer<FilterIncreaseModuleItem> implements ItemFilter.IFilteredContainer { public class FilterIncreaseModuleContainer extends AbstractPipeContainer<FilterIncreaseModuleItem> implements ItemFilter.IFilteredContainer {

View file

@ -12,9 +12,8 @@ import net.minecraft.world.item.ItemStack;
public class FilterIncreaseModuleItem extends ModuleItem { public class FilterIncreaseModuleItem extends ModuleItem {
public FilterIncreaseModuleItem(String name) { public FilterIncreaseModuleItem() {
super(name); super("filter_increase_modifier");
this.setRegistryName(name);
} }
@Override @Override

View file

@ -1,7 +1,6 @@
package de.ellpeck.prettypipes.pipe.modules.insertion; package de.ellpeck.prettypipes.pipe.modules.insertion;
import de.ellpeck.prettypipes.pipe.containers.AbstractPipeGui; import de.ellpeck.prettypipes.pipe.containers.AbstractPipeGui;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;

View file

@ -126,7 +126,7 @@ public class FilterModifierModuleGui extends AbstractPipeGui<FilterModifierModul
text = ChatFormatting.BOLD + text; text = ChatFormatting.BOLD + text;
FilterModifierModuleGui.this.font.draw(matrix, text, this.x, this.y, color); FilterModifierModuleGui.this.font.draw(matrix, text, this.x, this.y, color);
RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, TEXTURE); RenderSystem.setShaderTexture(0, AbstractPipeGui.TEXTURE);
} }
private boolean onClicked(double mouseX, double mouseY, int button) { private boolean onClicked(double mouseX, double mouseY, int button) {

View file

@ -19,7 +19,6 @@ public class FilterModifierModuleItem extends ModuleItem {
public FilterModifierModuleItem(String name, ItemEquality.Type type) { public FilterModifierModuleItem(String name, ItemEquality.Type type) {
super(name); super(name);
this.type = type; this.type = type;
this.setRegistryName(name);
} }
@Override @Override
@ -39,7 +38,7 @@ public class FilterModifierModuleItem extends ModuleItem {
public ItemEquality getEqualityType(ItemStack stack) { public ItemEquality getEqualityType(ItemStack stack) {
if (this.type == ItemEquality.Type.TAG) { if (this.type == ItemEquality.Type.TAG) {
return ItemEquality.tag(getFilterTag(stack)); return ItemEquality.tag(FilterModifierModuleItem.getFilterTag(stack));
} else { } else {
return this.type.getDefaultInstance(); return this.type.getDefaultInstance();
} }

View file

@ -6,7 +6,6 @@ import de.ellpeck.prettypipes.pipe.containers.AbstractPipeContainer;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.MenuType; import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.inventory.Slot;
import javax.annotation.Nullable; import javax.annotation.Nullable;

View file

@ -1,7 +1,6 @@
package de.ellpeck.prettypipes.pipe.modules.retrieval; package de.ellpeck.prettypipes.pipe.modules.retrieval;
import de.ellpeck.prettypipes.pipe.containers.AbstractPipeGui; import de.ellpeck.prettypipes.pipe.containers.AbstractPipeGui;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;

View file

@ -4,16 +4,13 @@ import de.ellpeck.prettypipes.Registry;
import de.ellpeck.prettypipes.items.IModule; import de.ellpeck.prettypipes.items.IModule;
import de.ellpeck.prettypipes.items.ModuleItem; import de.ellpeck.prettypipes.items.ModuleItem;
import de.ellpeck.prettypipes.items.ModuleTier; import de.ellpeck.prettypipes.items.ModuleTier;
import de.ellpeck.prettypipes.misc.ItemEquality;
import de.ellpeck.prettypipes.misc.ItemFilter; import de.ellpeck.prettypipes.misc.ItemFilter;
import de.ellpeck.prettypipes.network.PipeNetwork; import de.ellpeck.prettypipes.network.PipeNetwork;
import de.ellpeck.prettypipes.pipe.PipeBlockEntity; import de.ellpeck.prettypipes.pipe.PipeBlockEntity;
import de.ellpeck.prettypipes.pipe.containers.AbstractPipeContainer; import de.ellpeck.prettypipes.pipe.containers.AbstractPipeContainer;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import org.apache.commons.lang3.tuple.Pair;
public class RetrievalModuleItem extends ModuleItem { public class RetrievalModuleItem extends ModuleItem {

View file

@ -9,7 +9,6 @@ import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.EditBox; import net.minecraft.client.gui.components.EditBox;
import net.minecraft.client.resources.language.I18n; import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -23,7 +22,7 @@ public class StackSizeModuleGui extends AbstractPipeGui<StackSizeModuleContainer
@Override @Override
protected void init() { protected void init() {
super.init(); super.init();
var textField = this.addRenderableWidget(new EditBox(this.font, this.leftPos + 7, this.topPos + 17 + 32 + 10, 40, 20, new TranslatableComponent("info." + PrettyPipes.ID + ".max_stack_size")) { var textField = this.addRenderableWidget(new EditBox(this.font, this.leftPos + 7, this.topPos + 17 + 32 + 10, 40, 20, Component.translatable("info." + PrettyPipes.ID + ".max_stack_size")) {
@Override @Override
public void insertText(String textToWrite) { public void insertText(String textToWrite) {
var ret = new StringBuilder(); var ret = new StringBuilder();
@ -43,7 +42,7 @@ public class StackSizeModuleGui extends AbstractPipeGui<StackSizeModuleContainer
var amount = Integer.parseInt(s); var amount = Integer.parseInt(s);
PacketButton.sendAndExecute(this.menu.tile.getBlockPos(), ButtonResult.STACK_SIZE_AMOUNT, amount); PacketButton.sendAndExecute(this.menu.tile.getBlockPos(), ButtonResult.STACK_SIZE_AMOUNT, amount);
}); });
var buttonText = (Supplier<TranslatableComponent>) () -> new TranslatableComponent("info." + PrettyPipes.ID + ".limit_to_max_" + (StackSizeModuleItem.getLimitToMaxStackSize(this.menu.moduleStack) ? "on" : "off")); Supplier<Component> 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 -> { 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); PacketButton.sendAndExecute(this.menu.tile.getBlockPos(), ButtonResult.STACK_SIZE_MODULE_BUTTON);
b.setMessage(buttonText.get()); b.setMessage(buttonText.get());

View file

@ -13,9 +13,8 @@ import net.minecraftforge.items.IItemHandler;
public class StackSizeModuleItem extends ModuleItem { public class StackSizeModuleItem extends ModuleItem {
public StackSizeModuleItem(String name) { public StackSizeModuleItem() {
super(name); super("stack_size_module");
this.setRegistryName(name);
} }
public static int getMaxStackSize(ItemStack module) { public static int getMaxStackSize(ItemStack module) {
@ -43,8 +42,8 @@ public class StackSizeModuleItem extends ModuleItem {
@Override @Override
public int getMaxInsertionAmount(ItemStack module, PipeBlockEntity tile, ItemStack stack, IItemHandler destination) { public int getMaxInsertionAmount(ItemStack module, PipeBlockEntity tile, ItemStack stack, IItemHandler destination) {
var max = getMaxStackSize(module); var max = StackSizeModuleItem.getMaxStackSize(module);
if (getLimitToMaxStackSize(module)) if (StackSizeModuleItem.getLimitToMaxStackSize(module))
max = Math.min(max, stack.getMaxStackSize()); max = Math.min(max, stack.getMaxStackSize());
var amount = 0; var amount = 0;
for (var i = 0; i < destination.getSlots(); i++) { for (var i = 0; i < destination.getSlots(); i++) {

View file

@ -2,7 +2,6 @@ package de.ellpeck.prettypipes.pressurizer;
import de.ellpeck.prettypipes.Registry; import de.ellpeck.prettypipes.Registry;
import de.ellpeck.prettypipes.Utility; import de.ellpeck.prettypipes.Utility;
import de.ellpeck.prettypipes.pipe.PipeBlockEntity;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer; 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.level.material.Material;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.registries.ForgeRegistries;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
@ -57,13 +57,13 @@ public class PressurizerBlock extends BaseEntityBlock {
@Override @Override
public void appendHoverText(ItemStack stack, @Nullable BlockGetter worldIn, List<Component> tooltip, TooltipFlag flagIn) { public void appendHoverText(ItemStack stack, @Nullable BlockGetter worldIn, List<Component> tooltip, TooltipFlag flagIn) {
Utility.addTooltip(this.getRegistryName().getPath(), tooltip); Utility.addTooltip(ForgeRegistries.BLOCKS.getKey(this).getPath(), tooltip);
} }
@org.jetbrains.annotations.Nullable @org.jetbrains.annotations.Nullable
@Override @Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) { public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return level.isClientSide ? null : createTickerHelper(type, Registry.pressurizerBlockEntity, PressurizerBlockEntity::tick); return level.isClientSide ? null : BaseEntityBlock.createTickerHelper(type, Registry.pressurizerBlockEntity, PressurizerBlockEntity::tick);
} }
@Override @Override

View file

@ -11,7 +11,6 @@ import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.Connection; import net.minecraft.network.Connection;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
import net.minecraft.world.MenuProvider; import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
@ -86,7 +85,7 @@ public class PressurizerBlockEntity extends BlockEntity implements MenuProvider,
@Override @Override
public Component getDisplayName() { public Component getDisplayName() {
return new TranslatableComponent("container." + PrettyPipes.ID + ".pressurizer"); return Component.translatable("container." + PrettyPipes.ID + ".pressurizer");
} }
@Nullable @Nullable

View file

@ -6,7 +6,6 @@ import de.ellpeck.prettypipes.PrettyPipes;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
@ -26,7 +25,7 @@ public class PressurizerGui extends AbstractContainerScreen<PressurizerContainer
super.render(matrix, mouseX, mouseY, partialTicks); super.render(matrix, mouseX, mouseY, partialTicks);
this.renderTooltip(matrix, mouseX, mouseY); this.renderTooltip(matrix, mouseX, mouseY);
if (mouseX >= this.leftPos + 26 && mouseY >= this.topPos + 22 && mouseX < this.leftPos + 26 + 124 && mouseY < this.topPos + 22 + 12) if (mouseX >= 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 @Override
@ -38,7 +37,7 @@ public class PressurizerGui extends AbstractContainerScreen<PressurizerContainer
@Override @Override
protected void renderBg(PoseStack matrixStack, float partialTicks, int x, int y) { protected void renderBg(PoseStack matrixStack, float partialTicks, int x, int y) {
RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, TEXTURE); RenderSystem.setShaderTexture(0, PressurizerGui.TEXTURE);
this.blit(matrixStack, this.leftPos, this.topPos, 0, 0, 176, 137); this.blit(matrixStack, this.leftPos, this.topPos, 0, 0, 176, 137);
var energy = (int) (this.menu.tile.getEnergyPercentage() * 124); var energy = (int) (this.menu.tile.getEnergyPercentage() * 124);
this.blit(matrixStack, this.leftPos + 26, this.topPos + 22, 0, 137, energy, 12); this.blit(matrixStack, this.leftPos + 26, this.topPos + 22, 0, 137, energy, 12);

View file

@ -3,6 +3,7 @@ package de.ellpeck.prettypipes.terminal;
import de.ellpeck.prettypipes.Registry; import de.ellpeck.prettypipes.Registry;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BaseEntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
@ -18,6 +19,6 @@ public class CraftingTerminalBlock extends ItemTerminalBlock {
@org.jetbrains.annotations.Nullable @org.jetbrains.annotations.Nullable
@Override @Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) { public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return createTickerHelper(type, Registry.craftingTerminalBlockEntity, ItemTerminalBlockEntity::tick); return BaseEntityBlock.createTickerHelper(type, Registry.craftingTerminalBlockEntity, ItemTerminalBlockEntity::tick);
} }
} }

View file

@ -17,7 +17,6 @@ import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style; 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.Inventory;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.AbstractContainerMenu;
@ -111,10 +110,10 @@ public class CraftingTerminalBlockEntity extends ItemTerminalBlockEntity {
network.startProfile("terminal_request_crafting"); network.startProfile("terminal_request_crafting");
this.updateItems(); this.updateItems();
// get the amount of crafts that we can do // 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); var item = this.networkItems.get(s);
return item != null ? item.getLocations() : Collections.emptyList(); 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 we're forcing, just pretend we have one available
if (lowestAvailable <= 0 && force) if (lowestAvailable <= 0 && force)
lowestAvailable = maxAmount; lowestAvailable = maxAmount;
@ -128,11 +127,11 @@ public class CraftingTerminalBlockEntity extends ItemTerminalBlockEntity {
continue; continue;
requested = requested.copy(); requested = requested.copy();
requested.setCount(lowestAvailable); 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 { } else {
player.sendMessage(new TranslatableComponent("info." + PrettyPipes.ID + ".hold_alt"), UUID.randomUUID()); player.sendSystemMessage(Component.translatable("info." + PrettyPipes.ID + ".hold_alt"));
} }
network.endProfile(); network.endProfile();
} }
@ -151,7 +150,7 @@ public class CraftingTerminalBlockEntity extends ItemTerminalBlockEntity {
@Override @Override
public Component getDisplayName() { public Component getDisplayName() {
return new TranslatableComponent("container." + PrettyPipes.ID + ".crafting_terminal"); return Component.translatable("container." + PrettyPipes.ID + ".crafting_terminal");
} }
@Nullable @Nullable

View file

@ -5,7 +5,6 @@ import de.ellpeck.prettypipes.Utility;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; 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.level.material.Material;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.registries.ForgeRegistries;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import java.util.UUID;
public class ItemTerminalBlock extends BaseEntityBlock { public class ItemTerminalBlock extends BaseEntityBlock {
@ -43,7 +42,7 @@ public class ItemTerminalBlock extends BaseEntityBlock {
var reason = tile.getInvalidTerminalReason(); var reason = tile.getInvalidTerminalReason();
if (reason != null) { if (reason != null) {
if (!worldIn.isClientSide) if (!worldIn.isClientSide)
player.sendMessage(new TranslatableComponent(reason).withStyle(ChatFormatting.RED), UUID.randomUUID()); player.sendSystemMessage(Component.translatable(reason).withStyle(ChatFormatting.RED));
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} }
if (!worldIn.isClientSide) { if (!worldIn.isClientSide) {
@ -76,13 +75,13 @@ public class ItemTerminalBlock extends BaseEntityBlock {
@Override @Override
public void appendHoverText(ItemStack stack, @Nullable BlockGetter worldIn, List<Component> tooltip, TooltipFlag flagIn) { public void appendHoverText(ItemStack stack, @Nullable BlockGetter worldIn, List<Component> tooltip, TooltipFlag flagIn) {
Utility.addTooltip(this.getRegistryName().getPath(), tooltip); Utility.addTooltip(ForgeRegistries.BLOCKS.getKey(this).getPath(), tooltip);
} }
@org.jetbrains.annotations.Nullable @org.jetbrains.annotations.Nullable
@Override @Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) { public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return createTickerHelper(type, Registry.itemTerminalBlockEntity, ItemTerminalBlockEntity::tick); return BaseEntityBlock.createTickerHelper(type, Registry.itemTerminalBlockEntity, ItemTerminalBlockEntity::tick);
} }
} }

View file

@ -22,7 +22,6 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style; import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.MenuProvider; import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player; 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) .filter(s -> ItemEquality.compareItems(s, filter) && s.hasTag() && s.getTag().hashCode() == nbtHash)
.findFirst().orElse(filter); .findFirst().orElse(filter);
} }
var requested = this.requestItemImpl(stack, onItemUnavailable(player, false)); var requested = this.requestItemImpl(stack, ItemTerminalBlockEntity.onItemUnavailable(player, false));
if (requested > 0) { 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 { } else {
onItemUnavailable(player, false).accept(stack); ItemTerminalBlockEntity.onItemUnavailable(player, false).accept(stack);
} }
network.endProfile(); network.endProfile();
} }
@ -175,7 +174,7 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect
public int requestItemImpl(ItemStack stack, Consumer<ItemStack> unavailableConsumer) { public int requestItemImpl(ItemStack stack, Consumer<ItemStack> unavailableConsumer) {
var item = this.networkItems.get(new EquatableItemStack(stack, ItemEquality.NBT)); var item = this.networkItems.get(new EquatableItemStack(stack, ItemEquality.NBT));
Collection<NetworkLocation> locations = item == null ? Collections.emptyList() : item.getLocations(); Collection<NetworkLocation> 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()); this.existingRequests.addAll(ret.getLeft());
return stack.getCount() - ret.getRight().getCount(); return stack.getCount() - ret.getRight().getCount();
} }
@ -248,7 +247,7 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect
@Override @Override
public Component getDisplayName() { public Component getDisplayName() {
return new TranslatableComponent("container." + PrettyPipes.ID + ".item_terminal"); return Component.translatable("container." + PrettyPipes.ID + ".item_terminal");
} }
@Nullable @Nullable
@ -319,7 +318,7 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect
return s -> { return s -> {
if (ignore) if (ignore)
return; 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)));
}; };
} }
} }

View file

@ -6,8 +6,8 @@ import de.ellpeck.prettypipes.PrettyPipes;
import de.ellpeck.prettypipes.packets.PacketButton; import de.ellpeck.prettypipes.packets.PacketButton;
import de.ellpeck.prettypipes.packets.PacketHandler; import de.ellpeck.prettypipes.packets.PacketHandler;
import net.minecraft.client.gui.components.Button; 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.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
@ -24,10 +24,10 @@ public class CraftingTerminalGui extends ItemTerminalGui {
@Override @Override
protected void init() { protected void init() {
super.init(); super.init();
this.requestButton = this.addRenderableWidget(new Button(this.leftPos + 8, this.topPos + 100, 50, 20, new TranslatableComponent("info." + PrettyPipes.ID + ".request"), button -> { this.requestButton = this.addRenderableWidget(new Button(this.leftPos + 8, this.topPos + 100, 50, 20, Component.translatable("info." + PrettyPipes.ID + ".request"), button -> {
var amount = requestModifier(); var amount = ItemTerminalGui.requestModifier();
// also allow holding backspace instead of alt for people whose alt key is inaccessible (linux?) // 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)); PacketHandler.sendToServer(new PacketButton(this.menu.tile.getBlockPos(), PacketButton.ButtonResult.CRAFT_TERMINAL_REQUEST, amount, force));
})); }));
this.tick(); this.tick();
@ -70,7 +70,7 @@ public class CraftingTerminalGui extends ItemTerminalGui {
@Override @Override
protected ResourceLocation getTexture() { protected ResourceLocation getTexture() {
return TEXTURE; return CraftingTerminalGui.TEXTURE;
} }
@Override @Override

View file

@ -15,12 +15,11 @@ import net.minecraft.client.gui.components.EditBox;
import net.minecraft.client.gui.components.Widget; import net.minecraft.client.gui.components.Widget;
import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.gui.narration.NarratableEntry; 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.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.resources.language.I18n; import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.Component; 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.resources.ResourceLocation;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
@ -65,14 +64,14 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
protected void init() { protected void init() {
super.init(); super.init();
this.search = this.addRenderableWidget(new EditBox(this.font, this.leftPos + this.getXOffset() + 97, this.topPos + 6, 86, 8, new TextComponent(""))); this.search = this.addRenderableWidget(new EditBox(this.font, this.leftPos + this.getXOffset() + 97, this.topPos + 6, 86, 8, Component.literal("")));
this.search.setBordered(false); this.search.setBordered(false);
this.lastSearchText = ""; this.lastSearchText = "";
if (this.items != null) if (this.items != null)
this.updateWidgets(); this.updateWidgets();
this.plusButton = this.addRenderableWidget(new Button(this.leftPos + this.getXOffset() + 95 - 7 + 12, this.topPos + 103, 12, 12, new TextComponent("+"), button -> { this.plusButton = this.addRenderableWidget(new Button(this.leftPos + this.getXOffset() + 95 - 7 + 12, this.topPos + 103, 12, 12, Component.literal("+"), button -> {
var modifier = requestModifier(); var modifier = ItemTerminalGui.requestModifier();
if (modifier > 1 && this.requestAmount == 1) { if (modifier > 1 && this.requestAmount == 1) {
this.requestAmount = modifier; this.requestAmount = modifier;
} else { } else {
@ -82,15 +81,15 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
if (this.requestAmount > 384) if (this.requestAmount > 384)
this.requestAmount = 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.minusButton = this.addRenderableWidget(new Button(this.leftPos + this.getXOffset() + 95 - 7 - 24, this.topPos + 103, 12, 12, Component.literal("-"), button -> {
this.requestAmount -= requestModifier(); this.requestAmount -= ItemTerminalGui.requestModifier();
if (this.requestAmount < 1) if (this.requestAmount < 1)
this.requestAmount = 1; this.requestAmount = 1;
})); }));
this.minusButton.active = false; 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(); var widget = this.streamWidgets().filter(w -> w.selected).findFirst();
if (!widget.isPresent()) if (widget.isEmpty())
return; return;
var stack = widget.get().stack.copy(); var stack = widget.get().stack.copy();
stack.setCount(1); stack.setCount(1);
@ -98,7 +97,7 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
this.requestAmount = 1; this.requestAmount = 1;
})); }));
this.requestButton.active = false; this.requestButton.active = false;
this.orderButton = this.addRenderableWidget(new Button(this.leftPos - 22, this.topPos, 20, 20, new TextComponent(""), button -> { this.orderButton = this.addRenderableWidget(new Button(this.leftPos - 22, this.topPos, 20, 20, Component.literal(""), button -> {
if (this.sortedItems == null) if (this.sortedItems == null)
return; return;
var prefs = PlayerPrefs.get(); var prefs = PlayerPrefs.get();
@ -106,7 +105,7 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
prefs.save(); prefs.save();
this.updateWidgets(); this.updateWidgets();
})); }));
this.ascendingButton = this.addRenderableWidget(new Button(this.leftPos - 22, this.topPos + 22, 20, 20, new TextComponent(""), button -> { this.ascendingButton = this.addRenderableWidget(new Button(this.leftPos - 22, this.topPos + 22, 20, 20, Component.literal(""), button -> {
if (this.sortedItems == null) if (this.sortedItems == null)
return; return;
var prefs = PlayerPrefs.get(); var prefs = PlayerPrefs.get();
@ -114,7 +113,7 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
prefs.save(); prefs.save();
this.updateWidgets(); this.updateWidgets();
})); }));
this.cancelCraftingButton = this.addRenderableWidget(new Button(this.leftPos + this.imageWidth + 4, this.topPos + 4 + 64, 54, 20, new TranslatableComponent("info." + PrettyPipes.ID + ".cancel_all"), b -> { 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; this.cancelCraftingButton.visible = false;
for (var y = 0; y < 4; y++) { for (var y = 0; y < 4; y++) {
@ -207,8 +206,8 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
public void updateWidgets() { public void updateWidgets() {
var prefs = PlayerPrefs.get(); var prefs = PlayerPrefs.get();
this.ascendingButton.setMessage(new TextComponent(prefs.terminalAscending ? "^" : "v")); this.ascendingButton.setMessage(Component.literal(prefs.terminalAscending ? "^" : "v"));
this.orderButton.setMessage(new TextComponent(prefs.terminalItemOrder.name().substring(0, 1))); this.orderButton.setMessage(Component.literal(prefs.terminalItemOrder.name().substring(0, 1)));
this.cancelCraftingButton.visible = this.currentlyCrafting != null && !this.currentlyCrafting.isEmpty(); this.cancelCraftingButton.visible = this.currentlyCrafting != null && !this.currentlyCrafting.isEmpty();
var comparator = prefs.terminalItemOrder.comparator; var comparator = prefs.terminalItemOrder.comparator;
@ -280,13 +279,13 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
if (this.sortedItems != null) { if (this.sortedItems != null) {
var prefs = PlayerPrefs.get(); var prefs = PlayerPrefs.get();
if (this.orderButton.isHoveredOrFocused()) if (this.orderButton.isHoveredOrFocused())
this.renderTooltip(matrix, new TranslatableComponent("info." + PrettyPipes.ID + ".order", I18n.get("info." + PrettyPipes.ID + ".order." + prefs.terminalItemOrder.name().toLowerCase(Locale.ROOT))), mouseX, mouseY); this.renderTooltip(matrix, Component.translatable("info." + PrettyPipes.ID + ".order", I18n.get("info." + PrettyPipes.ID + ".order." + prefs.terminalItemOrder.name().toLowerCase(Locale.ROOT))), mouseX, mouseY);
if (this.ascendingButton.isHoveredOrFocused()) if (this.ascendingButton.isHoveredOrFocused())
this.renderTooltip(matrix, new TranslatableComponent("info." + PrettyPipes.ID + "." + (prefs.terminalAscending ? "ascending" : "descending")), mouseX, mouseY); this.renderTooltip(matrix, Component.translatable("info." + PrettyPipes.ID + "." + (prefs.terminalAscending ? "ascending" : "descending")), mouseX, mouseY);
} }
if (this.cancelCraftingButton.visible && this.cancelCraftingButton.isHoveredOrFocused()) { if (this.cancelCraftingButton.visible && this.cancelCraftingButton.isHoveredOrFocused()) {
var tooltip = I18n.get("info." + PrettyPipes.ID + ".cancel_all.desc").split("\n"); var tooltip = I18n.get("info." + PrettyPipes.ID + ".cancel_all.desc").split("\n");
this.renderComponentTooltip(matrix, Arrays.stream(tooltip).map(TextComponent::new).collect(Collectors.toList()), mouseX, mouseY); this.renderComponentTooltip(matrix, Arrays.stream(tooltip).map(Component::literal).collect(Collectors.toList()), mouseX, mouseY);
} }
if (!this.hoveredCrafting.isEmpty()) if (!this.hoveredCrafting.isEmpty())
this.renderTooltip(matrix, this.hoveredCrafting, mouseX, mouseY); this.renderTooltip(matrix, this.hoveredCrafting, mouseX, mouseY);
@ -325,7 +324,7 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
this.hoveredCrafting = ItemStack.EMPTY; this.hoveredCrafting = ItemStack.EMPTY;
if (this.currentlyCrafting != null && !this.currentlyCrafting.isEmpty()) { if (this.currentlyCrafting != null && !this.currentlyCrafting.isEmpty()) {
RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, TEXTURE); RenderSystem.setShaderTexture(0, ItemTerminalGui.TEXTURE);
this.blit(matrix, this.leftPos + this.imageWidth, this.topPos + 4, 191, 0, 65, 89); this.blit(matrix, this.leftPos + this.imageWidth, this.topPos + 4, 191, 0, 65, 89);
var x = 0; var x = 0;
@ -349,7 +348,7 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
} }
protected ResourceLocation getTexture() { protected ResourceLocation getTexture() {
return TEXTURE; return ItemTerminalGui.TEXTURE;
} }
@Override @Override
@ -377,9 +376,9 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
} }
public static int requestModifier() { public static int requestModifier() {
if (hasControlDown()) { if (Screen.hasControlDown()) {
return 10; return 10;
} else if (hasShiftDown()) { } else if (Screen.hasShiftDown()) {
return 64; return 64;
} else { } else {
return 1; return 1;

View file

@ -10,144 +10,360 @@
"from": [5, 5, 5], "from": [5, 5, 5],
"to": [6, 11, 6], "to": [6, 11, 6],
"faces": { "faces": {
"north": {"uv": [0, 0, 1, 6], "texture": "#0"}, "north": {
"east": {"uv": [0, 0, 1, 6], "texture": "#0"}, "uv": [0, 0, 1, 6],
"south": {"uv": [0, 0, 1, 6], "texture": "#0"}, "texture": "#0"
"west": {"uv": [0, 0, 1, 6], "texture": "#0"}, },
"up": {"uv": [0, 0, 1, 1], "texture": "#0"}, "east": {
"down": {"uv": [0, 0, 1, 1], "texture": "#0"} "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], "from": [5, 5, 10],
"to": [6, 11, 11], "to": [6, 11, 11],
"faces": { "faces": {
"north": {"uv": [0, 0, 1, 6], "texture": "#0"}, "north": {
"east": {"uv": [0, 0, 1, 6], "texture": "#0"}, "uv": [0, 0, 1, 6],
"south": {"uv": [0, 0, 1, 6], "texture": "#0"}, "texture": "#0"
"west": {"uv": [0, 0, 1, 6], "texture": "#0"}, },
"up": {"uv": [0, 0, 1, 1], "texture": "#0"}, "east": {
"down": {"uv": [0, 0, 1, 1], "texture": "#0"} "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], "from": [10, 5, 10],
"to": [11, 11, 11], "to": [11, 11, 11],
"faces": { "faces": {
"north": {"uv": [0, 0, 1, 6], "texture": "#0"}, "north": {
"east": {"uv": [0, 0, 1, 6], "texture": "#0"}, "uv": [0, 0, 1, 6],
"south": {"uv": [0, 0, 1, 6], "texture": "#0"}, "texture": "#0"
"west": {"uv": [0, 0, 1, 6], "texture": "#0"}, },
"up": {"uv": [0, 0, 1, 1], "texture": "#0"}, "east": {
"down": {"uv": [0, 0, 1, 1], "texture": "#0"} "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], "from": [10, 5, 5],
"to": [11, 11, 6], "to": [11, 11, 6],
"faces": { "faces": {
"north": {"uv": [0, 0, 1, 6], "texture": "#0"}, "north": {
"east": {"uv": [0, 0, 1, 6], "texture": "#0"}, "uv": [0, 0, 1, 6],
"south": {"uv": [0, 0, 1, 6], "texture": "#0"}, "texture": "#0"
"west": {"uv": [0, 0, 1, 6], "texture": "#0"}, },
"up": {"uv": [0, 0, 1, 1], "texture": "#0"}, "east": {
"down": {"uv": [0, 0, 1, 1], "texture": "#0"} "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], "from": [6, 10, 10],
"to": [10, 11, 11], "to": [10, 11, 11],
"faces": { "faces": {
"north": {"uv": [0, 0, 4, 1], "texture": "#0"}, "north": {
"east": {"uv": [0, 0, 1, 1], "texture": "#0"}, "uv": [0, 0, 4, 1],
"south": {"uv": [0, 0, 4, 1], "texture": "#0"}, "texture": "#0"
"west": {"uv": [0, 0, 1, 1], "texture": "#0"}, },
"up": {"uv": [0, 0, 4, 1], "texture": "#0"}, "east": {
"down": {"uv": [0, 0, 4, 1], "texture": "#0"} "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], "from": [6, 5, 10],
"to": [10, 6, 11], "to": [10, 6, 11],
"faces": { "faces": {
"north": {"uv": [0, 0, 4, 1], "texture": "#0"}, "north": {
"east": {"uv": [0, 0, 1, 1], "texture": "#0"}, "uv": [0, 0, 4, 1],
"south": {"uv": [0, 0, 4, 1], "texture": "#0"}, "texture": "#0"
"west": {"uv": [0, 0, 1, 1], "texture": "#0"}, },
"up": {"uv": [0, 0, 4, 1], "texture": "#0"}, "east": {
"down": {"uv": [0, 0, 4, 1], "texture": "#0"} "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], "from": [6, 5, 5],
"to": [10, 6, 6], "to": [10, 6, 6],
"faces": { "faces": {
"north": {"uv": [0, 0, 4, 1], "texture": "#0"}, "north": {
"east": {"uv": [0, 0, 1, 1], "texture": "#0"}, "uv": [0, 0, 4, 1],
"south": {"uv": [0, 0, 4, 1], "texture": "#0"}, "texture": "#0"
"west": {"uv": [0, 0, 1, 1], "texture": "#0"}, },
"up": {"uv": [0, 0, 4, 1], "texture": "#0"}, "east": {
"down": {"uv": [0, 0, 4, 1], "texture": "#0"} "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], "from": [5, 5, 6],
"to": [6, 6, 10], "to": [6, 6, 10],
"faces": { "faces": {
"north": {"uv": [0, 0, 1, 1], "texture": "#0"}, "north": {
"east": {"uv": [0, 0, 4, 1], "texture": "#0"}, "uv": [0, 0, 1, 1],
"south": {"uv": [0, 0, 1, 1], "texture": "#0"}, "texture": "#0"
"west": {"uv": [0, 0, 4, 1], "texture": "#0"}, },
"up": {"uv": [0, 0, 1, 4], "texture": "#0"}, "east": {
"down": {"uv": [0, 0, 1, 4], "texture": "#0"} "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], "from": [5, 10, 6],
"to": [6, 11, 10], "to": [6, 11, 10],
"faces": { "faces": {
"north": {"uv": [0, 0, 1, 1], "texture": "#0"}, "north": {
"east": {"uv": [0, 0, 4, 1], "texture": "#0"}, "uv": [0, 0, 1, 1],
"south": {"uv": [0, 0, 1, 1], "texture": "#0"}, "texture": "#0"
"west": {"uv": [0, 0, 4, 1], "texture": "#0"}, },
"up": {"uv": [0, 0, 1, 4], "texture": "#0"}, "east": {
"down": {"uv": [0, 0, 1, 4], "texture": "#0"} "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], "from": [10, 10, 6],
"to": [11, 11, 10], "to": [11, 11, 10],
"faces": { "faces": {
"north": {"uv": [0, 0, 1, 1], "texture": "#0"}, "north": {
"east": {"uv": [0, 0, 4, 1], "texture": "#0"}, "uv": [0, 0, 1, 1],
"south": {"uv": [0, 0, 1, 1], "texture": "#0"}, "texture": "#0"
"west": {"uv": [0, 0, 4, 1], "texture": "#0"}, },
"up": {"uv": [0, 0, 1, 4], "texture": "#0"}, "east": {
"down": {"uv": [0, 0, 1, 4], "texture": "#0"} "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], "from": [10, 5, 6],
"to": [11, 6, 10], "to": [11, 6, 10],
"faces": { "faces": {
"north": {"uv": [0, 0, 1, 1], "texture": "#0"}, "north": {
"east": {"uv": [0, 0, 4, 1], "texture": "#0"}, "uv": [0, 0, 1, 1],
"south": {"uv": [0, 0, 1, 1], "texture": "#0"}, "texture": "#0"
"west": {"uv": [0, 0, 4, 1], "texture": "#0"}, },
"up": {"uv": [0, 0, 1, 4], "texture": "#0"}, "east": {
"down": {"uv": [0, 0, 1, 4], "texture": "#0"} "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], "from": [6, 10, 5],
"to": [10, 11, 6], "to": [10, 11, 6],
"faces": { "faces": {
"north": {"uv": [0, 0, 4, 1], "texture": "#0"}, "north": {
"east": {"uv": [0, 0, 1, 1], "texture": "#0"}, "uv": [0, 0, 4, 1],
"south": {"uv": [0, 0, 4, 1], "texture": "#0"}, "texture": "#0"
"west": {"uv": [0, 0, 1, 1], "texture": "#0"}, },
"up": {"uv": [0, 0, 4, 1], "texture": "#0"}, "east": {
"down": {"uv": [0, 0, 4, 1], "texture": "#0"} "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"
}
} }
} }
] ]

View file

@ -9,48 +9,128 @@
"from": [5, 10, 0], "from": [5, 10, 0],
"to": [6, 11, 5], "to": [6, 11, 5],
"faces": { "faces": {
"north": {"uv": [0, 0, 1, 1], "texture": "#0"}, "north": {
"east": {"uv": [0, 0, 5, 1], "texture": "#0"}, "uv": [0, 0, 1, 1],
"south": {"uv": [0, 0, 1, 1], "texture": "#0"}, "texture": "#0"
"west": {"uv": [0, 0, 5, 1], "texture": "#0"}, },
"up": {"uv": [0, 0, 5, 1], "rotation": 90, "texture": "#0"}, "east": {
"down": {"uv": [0, 0, 5, 1], "rotation": 270, "texture": "#0"} "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], "from": [5, 5, 0],
"to": [6, 6, 5], "to": [6, 6, 5],
"faces": { "faces": {
"north": {"uv": [0, 0, 1, 1], "texture": "#0"}, "north": {
"east": {"uv": [0, 0, 5, 1], "texture": "#0"}, "uv": [0, 0, 1, 1],
"south": {"uv": [0, 0, 1, 1], "texture": "#0"}, "texture": "#0"
"west": {"uv": [0, 0, 5, 1], "texture": "#0"}, },
"up": {"uv": [0, 0, 5, 1], "rotation": 90, "texture": "#0"}, "east": {
"down": {"uv": [0, 0, 5, 1], "rotation": 270, "texture": "#0"} "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], "from": [10, 5, 0],
"to": [11, 6, 5], "to": [11, 6, 5],
"faces": { "faces": {
"north": {"uv": [0, 0, 1, 1], "texture": "#0"}, "north": {
"east": {"uv": [0, 0, 5, 1], "texture": "#0"}, "uv": [0, 0, 1, 1],
"south": {"uv": [0, 0, 1, 1], "texture": "#0"}, "texture": "#0"
"west": {"uv": [0, 0, 5, 1], "texture": "#0"}, },
"up": {"uv": [0, 0, 5, 1], "rotation": 90, "texture": "#0"}, "east": {
"down": {"uv": [0, 0, 5, 1], "rotation": 270, "texture": "#0"} "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], "from": [10, 10, 0],
"to": [11, 11, 5], "to": [11, 11, 5],
"faces": { "faces": {
"north": {"uv": [0, 0, 1, 1], "texture": "#0"}, "north": {
"east": {"uv": [0, 0, 5, 1], "texture": "#0"}, "uv": [0, 0, 1, 1],
"south": {"uv": [0, 0, 1, 1], "texture": "#0"}, "texture": "#0"
"west": {"uv": [0, 0, 5, 1], "texture": "#0"}, },
"up": {"uv": [0, 0, 5, 1], "rotation": 90, "texture": "#0"}, "east": {
"down": {"uv": [0, 0, 5, 1], "rotation": 270, "texture": "#0"} "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"
}
} }
} }
] ]

View file

@ -10,23 +10,56 @@
"from": [6, 4, 6], "from": [6, 4, 6],
"to": [10, 5, 10], "to": [10, 5, 10],
"faces": { "faces": {
"north": {"uv": [0, 7, 4, 8], "texture": "#1"}, "north": {
"east": {"uv": [0, 7, 4, 8], "texture": "#1"}, "uv": [0, 7, 4, 8],
"south": {"uv": [0, 7, 4, 8], "texture": "#1"}, "texture": "#1"
"west": {"uv": [0, 7, 4, 8], "texture": "#1"}, },
"up": {"uv": [1, 1, 5, 5], "texture": "#1"}, "east": {
"down": {"uv": [1, 1, 5, 5], "texture": "#1"} "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], "from": [7, 0, 7],
"to": [9, 4, 9], "to": [9, 4, 9],
"faces": { "faces": {
"north": {"uv": [1, 1, 3, 5], "texture": "#1"}, "north": {
"east": {"uv": [1, 1, 3, 5], "texture": "#1"}, "uv": [1, 1, 3, 5],
"south": {"uv": [1, 1, 3, 5], "texture": "#1"}, "texture": "#1"
"west": {"uv": [1, 1, 3, 5], "texture": "#1"}, },
"down": {"uv": [1, 1, 3, 3], "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"
}
} }
} }
] ]

View file

@ -3,5 +3,7 @@
"id": "prettypipes", "id": "prettypipes",
"version": "0.0.0", "version": "0.0.0",
"contributors": ["SoniEx2"], "contributors": ["SoniEx2"],
"depends": { "forge": "*" } "depends": {
"forge": "*"
}
} }