mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-11-22 11:53:29 +01:00
1.19, part 1
This commit is contained in:
parent
5909820693
commit
27e25fbedf
56 changed files with 846 additions and 574 deletions
|
@ -24,7 +24,7 @@ if (System.getenv('BUILD_NUMBER') != null) {
|
|||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
||||
minecraft {
|
||||
mappings channel: 'official', version: '1.18.2'
|
||||
mappings channel: 'official', version: '1.19'
|
||||
|
||||
runs {
|
||||
client {
|
||||
|
@ -105,11 +105,11 @@ configurations {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
minecraft 'net.minecraftforge:forge:1.18.2-40.0.32'
|
||||
minecraft 'net.minecraftforge:forge:1.19-41.0.45'
|
||||
embed 'org.jgrapht:jgrapht-core:1.5.1'
|
||||
|
||||
compileOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.5.174:api")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.5.174")
|
||||
compileOnly fg.deobf("mezz.jei:jei-1.19-forge-api:11.0.0.206")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-1.19-forge:11.0.0.206")
|
||||
|
||||
// to test the rf requiring and crafting stuff
|
||||
/* runtimeOnly fg.deobf("curse.maven:powah-352656:3057732")
|
||||
|
|
|
@ -52,6 +52,7 @@ import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
|||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderers;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
|
@ -65,18 +66,14 @@ import net.minecraftforge.common.capabilities.Capability;
|
|||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.common.capabilities.CapabilityToken;
|
||||
import net.minecraftforge.common.extensions.IForgeMenuType;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.RegisterEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
|
@ -86,7 +83,7 @@ public final class Registry {
|
|||
public static final CreativeModeTab TAB = new CreativeModeTab(PrettyPipes.ID) {
|
||||
@Override
|
||||
public ItemStack makeIcon() {
|
||||
return new ItemStack(wrenchItem);
|
||||
return new ItemStack(Registry.wrenchItem);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -125,89 +122,84 @@ public final class Registry {
|
|||
public static MenuType<FilterModifierModuleContainer> filterModifierModuleContainer;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerBlocks(RegistryEvent.Register<Block> event) {
|
||||
event.getRegistry().registerAll(
|
||||
pipeBlock = new PipeBlock().setRegistryName("pipe"),
|
||||
itemTerminalBlock = new ItemTerminalBlock().setRegistryName("item_terminal"),
|
||||
craftingTerminalBlock = new CraftingTerminalBlock().setRegistryName("crafting_terminal"),
|
||||
pressurizerBlock = new PressurizerBlock().setRegistryName("pressurizer")
|
||||
);
|
||||
public static void register(RegisterEvent event) {
|
||||
event.register(ForgeRegistries.Keys.BLOCKS, h -> {
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, "pipe"), Registry.pipeBlock = new PipeBlock());
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, "item_terminal"), Registry.itemTerminalBlock = new ItemTerminalBlock());
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, "crafting_terminal"), Registry.craftingTerminalBlock = new CraftingTerminalBlock());
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, "pressurizer"), Registry.pressurizerBlock = new PressurizerBlock());
|
||||
});
|
||||
|
||||
event.register(ForgeRegistries.Keys.ITEMS, h -> {
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, "wrench"), Registry.wrenchItem = new WrenchItem());
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, "blank_module"), new Item(new Item.Properties().tab(Registry.TAB)));
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, "pipe_frame"), Registry.pipeFrameItem = new PipeFrameItem());
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, "stack_size_module"), new StackSizeModuleItem());
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, "redstone_module"), new RedstoneModuleItem());
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, "filter_increase_modifier"), new FilterIncreaseModuleItem());
|
||||
|
||||
Registry.registerTieredModule(h, "extraction_module", ExtractionModuleItem::new);
|
||||
Registry.registerTieredModule(h, "filter_module", FilterModuleItem::new);
|
||||
Registry.registerTieredModule(h, "speed_module", SpeedModuleItem::new);
|
||||
Registry.registerTieredModule(h, "low_priority_module", LowPriorityModuleItem::new);
|
||||
Registry.registerTieredModule(h, "high_priority_module", HighPriorityModuleItem::new);
|
||||
Registry.registerTieredModule(h, "retrieval_module", RetrievalModuleItem::new);
|
||||
Registry.registerTieredModule(h, "crafting_module", CraftingModuleItem::new);
|
||||
|
||||
for (var type : ItemEquality.Type.values()) {
|
||||
var name = type.name().toLowerCase(Locale.ROOT) + "_filter_modifier";
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, name), new FilterModifierModuleItem(name, type));
|
||||
}
|
||||
for (var type : SortingModuleItem.Type.values()) {
|
||||
var name = type.name().toLowerCase(Locale.ROOT) + "_sorting_modifier";
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, name), new SortingModuleItem(name, type));
|
||||
}
|
||||
|
||||
ForgeRegistries.BLOCKS.getEntries().stream()
|
||||
.filter(b -> b.getKey().location().getNamespace().equals(PrettyPipes.ID))
|
||||
.forEach(b -> h.register(b.getKey().location(), new BlockItem(b.getValue(), new Item.Properties().tab(Registry.TAB))));
|
||||
});
|
||||
|
||||
event.register(ForgeRegistries.Keys.BLOCK_ENTITY_TYPES, h -> {
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, "pipe"), Registry.pipeBlockEntity = BlockEntityType.Builder.of(PipeBlockEntity::new, Registry.pipeBlock).build(null));
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, "item_terminal"), Registry.itemTerminalBlockEntity = BlockEntityType.Builder.of(ItemTerminalBlockEntity::new, Registry.itemTerminalBlock).build(null));
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, "crafting_terminal"), Registry.craftingTerminalBlockEntity = BlockEntityType.Builder.of(CraftingTerminalBlockEntity::new, Registry.craftingTerminalBlock).build(null));
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, "pressurizer"), Registry.pressurizerBlockEntity = BlockEntityType.Builder.of(PressurizerBlockEntity::new, Registry.pressurizerBlock).build(null));
|
||||
});
|
||||
|
||||
event.register(ForgeRegistries.Keys.ENTITY_TYPES, h ->
|
||||
h.register(new ResourceLocation(PrettyPipes.ID, "pipe_frame"), Registry.pipeFrameEntity = EntityType.Builder.<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
|
||||
public static void registerItems(RegistryEvent.Register<Item> event) {
|
||||
var registry = event.getRegistry();
|
||||
registry.registerAll(
|
||||
wrenchItem = new WrenchItem().setRegistryName("wrench"),
|
||||
new Item(new Item.Properties().tab(TAB)).setRegistryName("blank_module"),
|
||||
pipeFrameItem = new PipeFrameItem().setRegistryName("pipe_frame")
|
||||
);
|
||||
registry.registerAll(createTieredModule("extraction_module", ExtractionModuleItem::new));
|
||||
registry.registerAll(createTieredModule("filter_module", FilterModuleItem::new));
|
||||
registry.registerAll(createTieredModule("speed_module", SpeedModuleItem::new));
|
||||
registry.registerAll(createTieredModule("low_priority_module", LowPriorityModuleItem::new));
|
||||
registry.registerAll(createTieredModule("high_priority_module", HighPriorityModuleItem::new));
|
||||
registry.registerAll(createTieredModule("retrieval_module", RetrievalModuleItem::new));
|
||||
registry.register(new StackSizeModuleItem("stack_size_module"));
|
||||
registry.registerAll(Arrays.stream(ItemEquality.Type.values()).map(t -> new FilterModifierModuleItem(t.name().toLowerCase(Locale.ROOT) + "_filter_modifier", t)).toArray(Item[]::new));
|
||||
registry.register(new RedstoneModuleItem("redstone_module"));
|
||||
registry.register(new FilterIncreaseModuleItem("filter_increase_modifier"));
|
||||
registry.registerAll(createTieredModule("crafting_module", CraftingModuleItem::new));
|
||||
registry.registerAll(Arrays.stream(SortingModuleItem.Type.values()).map(t -> new SortingModuleItem(t.name().toLowerCase(Locale.ROOT) + "_sorting_modifier", t)).toArray(Item[]::new));
|
||||
|
||||
ForgeRegistries.BLOCKS.getValues().stream()
|
||||
.filter(b -> b.getRegistryName().getNamespace().equals(PrettyPipes.ID))
|
||||
.forEach(b -> registry.register(new BlockItem(b, new Item.Properties().tab(TAB)).setRegistryName(b.getRegistryName())));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerBlockEntities(RegistryEvent.Register<BlockEntityType<?>> event) {
|
||||
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) -> {
|
||||
private static <T extends AbstractPipeContainer<?>> MenuType<T> registerPipeContainer(RegisterEvent.RegisterHelper<MenuType<?>> helper, String name) {
|
||||
var type = (MenuType<T>) IForgeMenuType.create((windowId, inv, data) -> {
|
||||
var tile = Utility.getBlockEntity(PipeBlockEntity.class, inv.player.level, data.readBlockPos());
|
||||
var moduleIndex = data.readInt();
|
||||
var moduleStack = tile.modules.getStackInSlot(moduleIndex);
|
||||
return ((IModule) moduleStack.getItem()).getContainer(moduleStack, tile, windowId, inv, inv.player, moduleIndex);
|
||||
}).setRegistryName(name);
|
||||
});
|
||||
helper.register(new ResourceLocation(PrettyPipes.ID, name), type);
|
||||
return type;
|
||||
}
|
||||
|
||||
private static Item[] createTieredModule(String name, BiFunction<String, ModuleTier, ModuleItem> item) {
|
||||
List<Item> items = new ArrayList<>();
|
||||
private static void registerTieredModule(RegisterEvent.RegisterHelper<Item> helper, String name, BiFunction<String, ModuleTier, ModuleItem> item) {
|
||||
for (var tier : ModuleTier.values())
|
||||
items.add(item.apply(name, tier).setRegistryName(tier.name().toLowerCase(Locale.ROOT) + "_" + name));
|
||||
return items.toArray(new Item[0]);
|
||||
helper.register(new ResourceLocation(PrettyPipes.ID, tier.name().toLowerCase(Locale.ROOT) + "_" + name), item.apply(name, tier));
|
||||
}
|
||||
|
||||
public static void setup(FMLCommonSetupEvent event) {
|
||||
|
@ -217,21 +209,21 @@ public final class Registry {
|
|||
public static final class Client {
|
||||
|
||||
public static void setup(FMLClientSetupEvent event) {
|
||||
ItemBlockRenderTypes.setRenderLayer(pipeBlock, RenderType.cutout());
|
||||
BlockEntityRenderers.register(pipeBlockEntity, PipeRenderer::new);
|
||||
EntityRenderers.register(pipeFrameEntity, PipeFrameRenderer::new);
|
||||
ItemBlockRenderTypes.setRenderLayer(Registry.pipeBlock, RenderType.cutout());
|
||||
BlockEntityRenderers.register(Registry.pipeBlockEntity, PipeRenderer::new);
|
||||
EntityRenderers.register(Registry.pipeFrameEntity, PipeFrameRenderer::new);
|
||||
|
||||
MenuScreens.register(pipeContainer, MainPipeGui::new);
|
||||
MenuScreens.register(itemTerminalContainer, ItemTerminalGui::new);
|
||||
MenuScreens.register(pressurizerContainer, PressurizerGui::new);
|
||||
MenuScreens.register(craftingTerminalContainer, CraftingTerminalGui::new);
|
||||
MenuScreens.register(extractionModuleContainer, ExtractionModuleGui::new);
|
||||
MenuScreens.register(filterModuleContainer, FilterModuleGui::new);
|
||||
MenuScreens.register(retrievalModuleContainer, RetrievalModuleGui::new);
|
||||
MenuScreens.register(stackSizeModuleContainer, StackSizeModuleGui::new);
|
||||
MenuScreens.register(filterIncreaseModuleContainer, FilterIncreaseModuleGui::new);
|
||||
MenuScreens.register(craftingModuleContainer, CraftingModuleGui::new);
|
||||
MenuScreens.register(filterModifierModuleContainer, FilterModifierModuleGui::new);
|
||||
MenuScreens.register(Registry.pipeContainer, MainPipeGui::new);
|
||||
MenuScreens.register(Registry.itemTerminalContainer, ItemTerminalGui::new);
|
||||
MenuScreens.register(Registry.pressurizerContainer, PressurizerGui::new);
|
||||
MenuScreens.register(Registry.craftingTerminalContainer, CraftingTerminalGui::new);
|
||||
MenuScreens.register(Registry.extractionModuleContainer, ExtractionModuleGui::new);
|
||||
MenuScreens.register(Registry.filterModuleContainer, FilterModuleGui::new);
|
||||
MenuScreens.register(Registry.retrievalModuleContainer, RetrievalModuleGui::new);
|
||||
MenuScreens.register(Registry.stackSizeModuleContainer, StackSizeModuleGui::new);
|
||||
MenuScreens.register(Registry.filterIncreaseModuleContainer, FilterIncreaseModuleGui::new);
|
||||
MenuScreens.register(Registry.craftingModuleContainer, CraftingModuleGui::new);
|
||||
MenuScreens.register(Registry.filterModifierModuleContainer, FilterModifierModuleGui::new);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.network.chat.*;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.Containers;
|
||||
|
@ -54,9 +55,9 @@ public final class Utility {
|
|||
if (Screen.hasShiftDown()) {
|
||||
var content = I18n.get("info." + PrettyPipes.ID + "." + name).split("\n");
|
||||
for (var s : content)
|
||||
tooltip.add(new TextComponent(s).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GRAY)));
|
||||
tooltip.add(Component.literal(s).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GRAY)));
|
||||
} else {
|
||||
tooltip.add(new TranslatableComponent("info." + PrettyPipes.ID + ".shift").setStyle(Style.EMPTY.applyFormat(ChatFormatting.DARK_GRAY)));
|
||||
tooltip.add(Component.translatable("info." + PrettyPipes.ID + ".shift").setStyle(Style.EMPTY.applyFormat(ChatFormatting.DARK_GRAY)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,18 +1,7 @@
|
|||
package de.ellpeck.prettypipes.compat.jei;
|
||||
|
||||
import de.ellpeck.prettypipes.misc.ItemEquality;
|
||||
import de.ellpeck.prettypipes.packets.PacketCraftingModuleTransfer;
|
||||
import de.ellpeck.prettypipes.packets.PacketHandler;
|
||||
import de.ellpeck.prettypipes.pipe.modules.craft.CraftingModuleContainer;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.transfer.IRecipeTransferError;
|
||||
import mezz.jei.api.recipe.transfer.IRecipeTransferHandler;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.CraftingRecipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
// TODO JEI
|
||||
/*
|
||||
public class CraftingModuleTransferHandler implements IRecipeTransferHandler<CraftingModuleContainer, CraftingRecipe> {
|
||||
|
||||
@Override
|
||||
|
@ -54,3 +43,4 @@ public class CraftingModuleTransferHandler implements IRecipeTransferHandler<Cra
|
|||
return null;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -1,18 +1,7 @@
|
|||
package de.ellpeck.prettypipes.compat.jei;
|
||||
|
||||
import de.ellpeck.prettypipes.packets.PacketGhostSlot;
|
||||
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;
|
||||
|
||||
// TODO JEI
|
||||
/*
|
||||
public class CraftingTerminalTransferHandler implements IRecipeTransferHandler<CraftingTerminalContainer, CraftingRecipe> {
|
||||
|
||||
@Override
|
||||
|
@ -40,3 +29,4 @@ public class CraftingTerminalTransferHandler implements IRecipeTransferHandler<C
|
|||
return null;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -1,31 +1,7 @@
|
|||
package de.ellpeck.prettypipes.compat.jei;
|
||||
|
||||
import de.ellpeck.prettypipes.PrettyPipes;
|
||||
import de.ellpeck.prettypipes.misc.PlayerPrefs;
|
||||
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
|
||||
// TODO JEI
|
||||
/*@JeiPlugin
|
||||
public class JEIPrettyPipesPlugin implements IModPlugin {
|
||||
|
||||
private IJeiRuntime runtime;
|
||||
|
@ -123,4 +99,4 @@ public class JEIPrettyPipesPlugin implements IModPlugin {
|
|||
filter.setFilterText(terminalText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
|
|
@ -42,7 +42,7 @@ public class PipeFrameEntity extends ItemFrame implements IEntityAdditionalSpawn
|
|||
@Override
|
||||
protected void defineSynchedData() {
|
||||
super.defineSynchedData();
|
||||
this.entityData.define(AMOUNT, -1);
|
||||
this.entityData.define(PipeFrameEntity.AMOUNT, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,7 +53,7 @@ public class PipeFrameEntity extends ItemFrame implements IEntityAdditionalSpawn
|
|||
if (this.tickCount % 40 != 0)
|
||||
return;
|
||||
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) {
|
||||
var node = network.getNodeFromPipe(attached);
|
||||
if (node != null) {
|
||||
|
@ -61,17 +61,17 @@ public class PipeFrameEntity extends ItemFrame implements IEntityAdditionalSpawn
|
|||
if (!stack.isEmpty()) {
|
||||
var items = network.getOrderedNetworkItems(node);
|
||||
var amount = items.stream().mapToInt(i -> i.getItemAmount(this.level, stack)).sum();
|
||||
this.entityData.set(AMOUNT, amount);
|
||||
this.entityData.set(PipeFrameEntity.AMOUNT, amount);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.entityData.set(AMOUNT, -1);
|
||||
this.entityData.set(PipeFrameEntity.AMOUNT, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean survives() {
|
||||
return super.survives() && canPlace(this.level, this.pos, this.direction);
|
||||
return super.survives() && PipeFrameEntity.canPlace(this.level, this.pos, this.direction);
|
||||
}
|
||||
|
||||
private static BlockPos getAttachedPipe(Level world, BlockPos pos, Direction direction) {
|
||||
|
@ -85,11 +85,11 @@ public class PipeFrameEntity extends ItemFrame implements IEntityAdditionalSpawn
|
|||
}
|
||||
|
||||
public static boolean canPlace(Level world, BlockPos pos, Direction direction) {
|
||||
return getAttachedPipe(world, pos, direction) != null;
|
||||
return PipeFrameEntity.getAttachedPipe(world, pos, direction) != null;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return this.entityData.get(AMOUNT);
|
||||
return this.entityData.get(PipeFrameEntity.AMOUNT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
@ -65,6 +66,6 @@ public class PipeFrameItem extends Item {
|
|||
@Override
|
||||
public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List<Component> tooltip, TooltipFlag flagIn) {
|
||||
super.appendHoverText(stack, worldIn, tooltip, flagIn);
|
||||
Utility.addTooltip(this.getRegistryName().getPath(), tooltip);
|
||||
Utility.addTooltip(ForgeRegistries.ITEMS.getKey(this).getPath(), tooltip);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import net.minecraft.world.item.enchantment.Enchantments;
|
|||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.EntityBlock;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -108,7 +109,7 @@ public class WrenchItem extends Item {
|
|||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack stack, Level worldIn, List<Component> tooltip, TooltipFlag flagIn) {
|
||||
Utility.addTooltip(this.getRegistryName().getPath(), tooltip);
|
||||
Utility.addTooltip(ForgeRegistries.ITEMS.getKey(this).getPath(), tooltip);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,7 @@ package de.ellpeck.prettypipes.misc;
|
|||
import de.ellpeck.prettypipes.PrettyPipes;
|
||||
import de.ellpeck.prettypipes.network.PipeNetwork;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||
|
@ -33,9 +33,9 @@ public final class Events {
|
|||
var dump = PipeNetwork.get(source.getLevel()).toString();
|
||||
try {
|
||||
Files.writeString(file, dump, StandardCharsets.UTF_8);
|
||||
source.sendSuccess(new TextComponent("Wrote network dump to file " + file.toAbsolutePath()), true);
|
||||
source.sendSuccess(Component.literal("Wrote network dump to file " + file.toAbsolutePath()), true);
|
||||
} catch (IOException e) {
|
||||
source.sendFailure(new TextComponent("Failed to write network dump to file " + file.toAbsolutePath()));
|
||||
source.sendFailure(Component.literal("Failed to write network dump to file " + file.toAbsolutePath()));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -43,13 +43,13 @@ public final class Events {
|
|||
.then(Commands.literal("uncache").executes(c -> {
|
||||
var source = c.getSource();
|
||||
PipeNetwork.get(source.getLevel()).clearCaches();
|
||||
source.sendSuccess(new TextComponent("Cleared all pipe caches in the world"), true);
|
||||
source.sendSuccess(Component.literal("Cleared all pipe caches in the world"), true);
|
||||
return 0;
|
||||
}))
|
||||
.then(Commands.literal("unlock").executes(c -> {
|
||||
var source = c.getSource();
|
||||
PipeNetwork.get(source.getLevel()).unlock();
|
||||
source.sendSuccess(new TextComponent("Resolved all network locks in the world"), true);
|
||||
source.sendSuccess(Component.literal("Resolved all network locks in the world"), true);
|
||||
return 0;
|
||||
})));
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraft.client.gui.components.Button;
|
|||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.inventory.Slot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -51,17 +51,17 @@ public class ItemFilter extends ItemStackHandler {
|
|||
public List<AbstractWidget> getButtons(Screen gui, int x, int y) {
|
||||
List<AbstractWidget> buttons = new ArrayList<>();
|
||||
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 -> {
|
||||
PacketButton.sendAndExecute(this.pipe.getBlockPos(), PacketButton.ButtonResult.FILTER_CHANGE, 0);
|
||||
button.setMessage(whitelistText.get());
|
||||
}));
|
||||
}
|
||||
if (this.canPopulateFromInventories) {
|
||||
buttons.add(new Button(x + 72, y, 70, 20, new TranslatableComponent("info." + PrettyPipes.ID + ".populate"), button -> PacketButton.sendAndExecute(this.pipe.getBlockPos(), PacketButton.ButtonResult.FILTER_CHANGE, 1)) {
|
||||
buttons.add(new Button(x + 72, y, 70, 20, Component.translatable("info." + PrettyPipes.ID + ".populate"), button -> PacketButton.sendAndExecute(this.pipe.getBlockPos(), PacketButton.ButtonResult.FILTER_CHANGE, 1)) {
|
||||
@Override
|
||||
public void renderToolTip(PoseStack matrix, int x, int y) {
|
||||
gui.renderTooltip(matrix, new TranslatableComponent("info." + PrettyPipes.ID + ".populate.description").withStyle(ChatFormatting.GRAY), x, y);
|
||||
gui.renderTooltip(matrix, Component.translatable("info." + PrettyPipes.ID + ".populate.description").withStyle(ChatFormatting.GRAY), x, y);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public class ItemFilter extends ItemStackHandler {
|
|||
}
|
||||
|
||||
private boolean isFiltered(ItemStack stack) {
|
||||
var types = getEqualityTypes(this.pipe);
|
||||
var types = ItemFilter.getEqualityTypes(this.pipe);
|
||||
// also check if any filter increase modules have the item we need
|
||||
for (ItemStackHandler handler : this.pipe.getFilters()) {
|
||||
for (var i = 0; i < handler.getSlots(); i++) {
|
||||
|
@ -164,6 +164,7 @@ public class ItemFilter extends ItemStackHandler {
|
|||
|
||||
ItemFilter getFilter();
|
||||
|
||||
default void onFilterPopulated() {}
|
||||
default void onFilterPopulated() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,6 @@ public enum ItemOrder {
|
|||
}
|
||||
|
||||
public ItemOrder next() {
|
||||
return values()[(this.ordinal() + 1) % values().length];
|
||||
return ItemOrder.values()[(this.ordinal() + 1) % ItemOrder.values().length];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,11 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import de.ellpeck.prettypipes.terminal.containers.ItemTerminalGui;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.narration.NarrationElementOutput;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
import java.util.Optional;
|
||||
|
@ -21,7 +23,7 @@ public class ItemTerminalWidget extends AbstractWidget {
|
|||
public boolean craftable;
|
||||
|
||||
public ItemTerminalWidget(int xIn, int yIn, int gridX, int gridY, ItemTerminalGui screen) {
|
||||
super(xIn, yIn, 16, 16, new TextComponent(""));
|
||||
super(xIn, yIn, 16, 16, Component.literal(""));
|
||||
this.gridX = gridX;
|
||||
this.gridY = gridY;
|
||||
this.screen = screen;
|
||||
|
@ -41,7 +43,7 @@ public class ItemTerminalWidget extends AbstractWidget {
|
|||
this.setBlitOffset(100);
|
||||
renderer.blitOffset = 100;
|
||||
if (this.selected)
|
||||
fill(matrix, this.x, this.y, this.x + 16, this.y + 16, -2130706433);
|
||||
GuiComponent.fill(matrix, this.x, this.y, this.x + 16, this.y + 16, -2130706433);
|
||||
RenderSystem.enableDepthTest();
|
||||
renderer.renderGuiItem(this.stack, this.x, this.y);
|
||||
var amount = !this.craftable ? this.stack.getCount() : 0;
|
||||
|
@ -65,8 +67,8 @@ public class ItemTerminalWidget extends AbstractWidget {
|
|||
var tooltip = this.screen.getTooltipFromItem(this.stack);
|
||||
if (this.stack.getCount() >= 1000) {
|
||||
var comp = tooltip.get(0);
|
||||
if (comp instanceof TextComponent text) {
|
||||
tooltip.set(0, text.append(new TextComponent(" (" + this.stack.getCount() + ')').withStyle(ChatFormatting.BOLD)));
|
||||
if (comp instanceof MutableComponent m) {
|
||||
tooltip.set(0, m.append(Component.literal(" (" + this.stack.getCount() + ')').withStyle(ChatFormatting.BOLD)));
|
||||
}
|
||||
}
|
||||
this.screen.renderTooltip(matrix, tooltip, Optional.empty(), mouseX, mouseY);
|
||||
|
|
|
@ -20,30 +20,30 @@ public class PlayerPrefs {
|
|||
public boolean syncJei = true;
|
||||
|
||||
public void save() {
|
||||
var file = getFile();
|
||||
var file = PlayerPrefs.getFile();
|
||||
if (file.exists())
|
||||
file.delete();
|
||||
try (var writer = new FileWriter(file)) {
|
||||
GSON.toJson(this, writer);
|
||||
PlayerPrefs.GSON.toJson(this, writer);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static PlayerPrefs get() {
|
||||
if (instance == null) {
|
||||
var file = getFile();
|
||||
if (PlayerPrefs.instance == null) {
|
||||
var file = PlayerPrefs.getFile();
|
||||
if (file.exists()) {
|
||||
try (var reader = new FileReader(file)) {
|
||||
instance = GSON.fromJson(reader, PlayerPrefs.class);
|
||||
return instance;
|
||||
PlayerPrefs.instance = PlayerPrefs.GSON.fromJson(reader, PlayerPrefs.class);
|
||||
return PlayerPrefs.instance;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
instance = new PlayerPrefs();
|
||||
PlayerPrefs.instance = new PlayerPrefs();
|
||||
}
|
||||
return instance;
|
||||
return PlayerPrefs.instance;
|
||||
}
|
||||
|
||||
private static File getFile() {
|
||||
|
|
|
@ -3,7 +3,9 @@ package de.ellpeck.prettypipes.network;
|
|||
import de.ellpeck.prettypipes.misc.EquatableItemStack;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class NetworkItem {
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package de.ellpeck.prettypipes.network;
|
||||
|
||||
import de.ellpeck.prettypipes.misc.ItemEquality;
|
||||
import de.ellpeck.prettypipes.pipe.PipeBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.common.util.INBTSerializable;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
@ -102,6 +101,6 @@ public class NetworkLocation implements INBTSerializable<CompoundTag> {
|
|||
@Override
|
||||
public void deserializeNBT(CompoundTag nbt) {
|
||||
this.pipePos = NbtUtils.readBlockPos(nbt.getCompound("pipe_pos"));
|
||||
this.direction = Direction.values()[(nbt.getInt("direction"))];
|
||||
this.direction = Direction.values()[nbt.getInt("direction")];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class PipeItem implements IPipeItem {
|
|||
}
|
||||
|
||||
public PipeItem(ItemStack stack, float speed) {
|
||||
this(TYPE, stack, speed);
|
||||
this(PipeItem.TYPE, stack, speed);
|
||||
}
|
||||
|
||||
public PipeItem(ResourceLocation type, CompoundTag nbt) {
|
||||
|
@ -78,7 +78,7 @@ public class PipeItem implements IPipeItem {
|
|||
public void setDestination(BlockPos startInventory, BlockPos destInventory, GraphPath<BlockPos, NetworkEdge> path) {
|
||||
this.startInventory = startInventory;
|
||||
this.destInventory = destInventory;
|
||||
this.path = compilePath(path);
|
||||
this.path = PipeItem.compilePath(path);
|
||||
this.currGoalPos = this.getStartPipe();
|
||||
this.currentTile = 0;
|
||||
|
||||
|
@ -126,7 +126,7 @@ public class PipeItem implements IPipeItem {
|
|||
currPipe = next;
|
||||
}
|
||||
} else {
|
||||
var dist = (this.currGoalPos).distToLowCornerSqr(this.x - 0.5F, this.y - 0.5F, this.z - 0.5F);
|
||||
var dist = this.currGoalPos.distToLowCornerSqr(this.x - 0.5F, this.y - 0.5F, this.z - 0.5F);
|
||||
if (dist < currSpeed * currSpeed) {
|
||||
// we're past the start of the pipe, so move to the center of the next pipe
|
||||
BlockPos nextPos;
|
||||
|
|
|
@ -53,8 +53,8 @@ public class PacketCraftingModuleTransfer {
|
|||
public void run() {
|
||||
Player player = ctx.get().getSender();
|
||||
if (player.containerMenu instanceof CraftingModuleContainer container) {
|
||||
copy(container.input, message.inputs);
|
||||
copy(container.output, message.outputs);
|
||||
PacketCraftingModuleTransfer.copy(container.input, message.inputs);
|
||||
PacketCraftingModuleTransfer.copy(container.output, message.outputs);
|
||||
container.modified = true;
|
||||
container.broadcastChanges();
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public class PacketGhostSlot {
|
|||
private final TagKey<Item> tag;
|
||||
|
||||
public Entry(List<ItemStack> stacks) {
|
||||
var tag = getTagForStacks(stacks);
|
||||
var tag = Entry.getTagForStacks(stacks);
|
||||
if (tag != null) {
|
||||
this.stacks = null;
|
||||
this.tag = tag;
|
||||
|
|
|
@ -16,24 +16,24 @@ public final class PacketHandler {
|
|||
private static SimpleChannel network;
|
||||
|
||||
public static void setup() {
|
||||
network = NetworkRegistry.newSimpleChannel(new ResourceLocation(PrettyPipes.ID, "network"), () -> VERSION, VERSION::equals, VERSION::equals);
|
||||
network.registerMessage(0, PacketItemEnterPipe.class, PacketItemEnterPipe::toBytes, PacketItemEnterPipe::fromBytes, PacketItemEnterPipe::onMessage);
|
||||
network.registerMessage(1, PacketButton.class, PacketButton::toBytes, PacketButton::fromBytes, PacketButton::onMessage);
|
||||
network.registerMessage(2, PacketNetworkItems.class, PacketNetworkItems::toBytes, PacketNetworkItems::fromBytes, PacketNetworkItems::onMessage);
|
||||
network.registerMessage(3, PacketRequest.class, PacketRequest::toBytes, PacketRequest::fromBytes, PacketRequest::onMessage);
|
||||
network.registerMessage(4, PacketGhostSlot.class, PacketGhostSlot::toBytes, PacketGhostSlot::fromBytes, PacketGhostSlot::onMessage);
|
||||
network.registerMessage(5, PacketCraftingModuleTransfer.class, PacketCraftingModuleTransfer::toBytes, PacketCraftingModuleTransfer::fromBytes, PacketCraftingModuleTransfer::onMessage);
|
||||
PacketHandler.network = NetworkRegistry.newSimpleChannel(new ResourceLocation(PrettyPipes.ID, "network"), () -> PacketHandler.VERSION, PacketHandler.VERSION::equals, PacketHandler.VERSION::equals);
|
||||
PacketHandler.network.registerMessage(0, PacketItemEnterPipe.class, PacketItemEnterPipe::toBytes, PacketItemEnterPipe::fromBytes, PacketItemEnterPipe::onMessage);
|
||||
PacketHandler.network.registerMessage(1, PacketButton.class, PacketButton::toBytes, PacketButton::fromBytes, PacketButton::onMessage);
|
||||
PacketHandler.network.registerMessage(2, PacketNetworkItems.class, PacketNetworkItems::toBytes, PacketNetworkItems::fromBytes, PacketNetworkItems::onMessage);
|
||||
PacketHandler.network.registerMessage(3, PacketRequest.class, PacketRequest::toBytes, PacketRequest::fromBytes, PacketRequest::onMessage);
|
||||
PacketHandler.network.registerMessage(4, PacketGhostSlot.class, PacketGhostSlot::toBytes, PacketGhostSlot::fromBytes, PacketGhostSlot::onMessage);
|
||||
PacketHandler.network.registerMessage(5, PacketCraftingModuleTransfer.class, PacketCraftingModuleTransfer::toBytes, PacketCraftingModuleTransfer::fromBytes, PacketCraftingModuleTransfer::onMessage);
|
||||
}
|
||||
|
||||
public static void sendToAllLoaded(Level world, BlockPos pos, Object message) {
|
||||
network.send(PacketDistributor.TRACKING_CHUNK.with(() -> world.getChunkAt(pos)), message);
|
||||
PacketHandler.network.send(PacketDistributor.TRACKING_CHUNK.with(() -> world.getChunkAt(pos)), message);
|
||||
}
|
||||
|
||||
public static void sendTo(Player player, Object message) {
|
||||
network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), message);
|
||||
PacketHandler.network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), message);
|
||||
}
|
||||
|
||||
public static void sendToServer(Object message) {
|
||||
network.send(PacketDistributor.SERVER.noArg(), message);
|
||||
PacketHandler.network.send(PacketDistributor.SERVER.noArg(), message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ import de.ellpeck.prettypipes.network.NetworkEdge;
|
|||
import de.ellpeck.prettypipes.network.PipeItem;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -46,7 +46,7 @@ public interface IPipeItem extends INBTSerializable<CompoundTag> {
|
|||
|
||||
static IPipeItem load(CompoundTag nbt) {
|
||||
var type = new ResourceLocation(nbt.getString("type"));
|
||||
var func = TYPES.get(type);
|
||||
var func = IPipeItem.TYPES.get(type);
|
||||
return func != null ? func.apply(type, nbt) : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,26 +50,26 @@ public class PipeBlock extends BaseEntityBlock {
|
|||
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> 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()
|
||||
.put(Direction.UP, box(5, 10, 5, 11, 16, 11))
|
||||
.put(Direction.DOWN, box(5, 0, 5, 11, 6, 11))
|
||||
.put(Direction.NORTH, box(5, 5, 0, 11, 11, 6))
|
||||
.put(Direction.SOUTH, box(5, 5, 10, 11, 11, 16))
|
||||
.put(Direction.EAST, box(10, 5, 5, 16, 11, 11))
|
||||
.put(Direction.WEST, box(0, 5, 5, 6, 11, 11))
|
||||
.put(Direction.UP, Block.box(5, 10, 5, 11, 16, 11))
|
||||
.put(Direction.DOWN, Block.box(5, 0, 5, 11, 6, 11))
|
||||
.put(Direction.NORTH, Block.box(5, 5, 0, 11, 11, 6))
|
||||
.put(Direction.SOUTH, Block.box(5, 5, 10, 11, 11, 16))
|
||||
.put(Direction.EAST, Block.box(10, 5, 5, 16, 11, 11))
|
||||
.put(Direction.WEST, Block.box(0, 5, 5, 6, 11, 11))
|
||||
.build();
|
||||
|
||||
static {
|
||||
for (var dir : Direction.values())
|
||||
DIRECTIONS.put(dir, EnumProperty.create(dir.getName(), ConnectionType.class));
|
||||
PipeBlock.DIRECTIONS.put(dir, EnumProperty.create(dir.getName(), ConnectionType.class));
|
||||
}
|
||||
|
||||
public PipeBlock() {
|
||||
super(Block.Properties.of(Material.STONE).strength(2).sound(SoundType.STONE).noOcclusion());
|
||||
|
||||
var state = this.defaultBlockState().setValue(BlockStateProperties.WATERLOGGED, false);
|
||||
for (var prop : DIRECTIONS.values())
|
||||
for (var prop : PipeBlock.DIRECTIONS.values())
|
||||
state = state.setValue(prop, ConnectionType.DISCONNECTED);
|
||||
this.registerDefaultState(state);
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class PipeBlock extends BaseEntityBlock {
|
|||
|
||||
@Override
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
|
||||
builder.add(DIRECTIONS.values().toArray(new EnumProperty[0]));
|
||||
builder.add(PipeBlock.DIRECTIONS.values().toArray(new EnumProperty[0]));
|
||||
builder.add(BlockStateProperties.WATERLOGGED);
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class PipeBlock extends BaseEntityBlock {
|
|||
var newState = this.createState(worldIn, pos, state);
|
||||
if (newState != state) {
|
||||
worldIn.setBlockAndUpdate(pos, newState);
|
||||
onStateChanged(worldIn, pos, newState);
|
||||
PipeBlock.onStateChanged(worldIn, pos, newState);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,17 +133,17 @@ public class PipeBlock extends BaseEntityBlock {
|
|||
|
||||
@Override
|
||||
public void setPlacedBy(Level worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) {
|
||||
onStateChanged(worldIn, pos, state);
|
||||
PipeBlock.onStateChanged(worldIn, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
|
||||
return this.cacheAndGetShape(state, worldIn, pos, s -> s.getShape(worldIn, pos, context), SHAPE_CACHE, null);
|
||||
return this.cacheAndGetShape(state, worldIn, pos, s -> s.getShape(worldIn, pos, context), PipeBlock.SHAPE_CACHE, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
|
||||
return this.cacheAndGetShape(state, worldIn, pos, s -> s.getCollisionShape(worldIn, pos, context), COLL_SHAPE_CACHE, s -> {
|
||||
return this.cacheAndGetShape(state, worldIn, pos, s -> s.getCollisionShape(worldIn, pos, context), PipeBlock.COLL_SHAPE_CACHE, s -> {
|
||||
// make the shape a bit higher so we can jump up onto a higher block
|
||||
var newShape = new MutableObject<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)));
|
||||
|
@ -166,10 +166,10 @@ public class PipeBlock extends BaseEntityBlock {
|
|||
var key = Pair.of(state, cover);
|
||||
var shape = cache.get(key);
|
||||
if (shape == null) {
|
||||
shape = CENTER_SHAPE;
|
||||
for (var entry : DIRECTIONS.entrySet()) {
|
||||
shape = PipeBlock.CENTER_SHAPE;
|
||||
for (var entry : PipeBlock.DIRECTIONS.entrySet()) {
|
||||
if (state.getValue(entry.getValue()).isConnected())
|
||||
shape = Shapes.or(shape, DIR_SHAPES.get(entry.getKey()));
|
||||
shape = Shapes.or(shape, PipeBlock.DIR_SHAPES.get(entry.getKey()));
|
||||
}
|
||||
if (shapeModifier != null)
|
||||
shape = shapeModifier.apply(shape);
|
||||
|
@ -187,7 +187,7 @@ public class PipeBlock extends BaseEntityBlock {
|
|||
state = state.setValue(BlockStateProperties.WATERLOGGED, true);
|
||||
|
||||
for (var dir : Direction.values()) {
|
||||
var prop = DIRECTIONS.get(dir);
|
||||
var prop = PipeBlock.DIRECTIONS.get(dir);
|
||||
var type = this.getConnectionType(world, pos, dir, state);
|
||||
// don't reconnect on blocked faces
|
||||
if (type.isConnected() && curr.getValue(prop) == ConnectionType.BLOCKED)
|
||||
|
@ -215,8 +215,8 @@ public class PipeBlock extends BaseEntityBlock {
|
|||
if (blockHandler != null)
|
||||
return ConnectionType.CONNECTED;
|
||||
var offState = world.getBlockState(offset);
|
||||
if (hasLegsTo(world, offState, offset, direction)) {
|
||||
if (DIRECTIONS.values().stream().noneMatch(d -> state.getValue(d) == ConnectionType.LEGS))
|
||||
if (PipeBlock.hasLegsTo(world, offState, offset, direction)) {
|
||||
if (PipeBlock.DIRECTIONS.values().stream().noneMatch(d -> state.getValue(d) == ConnectionType.LEGS))
|
||||
return ConnectionType.LEGS;
|
||||
}
|
||||
return ConnectionType.DISCONNECTED;
|
||||
|
@ -226,7 +226,7 @@ public class PipeBlock extends BaseEntityBlock {
|
|||
if (state.getBlock() instanceof WallBlock || state.getBlock() instanceof FenceBlock)
|
||||
return direction == Direction.DOWN;
|
||||
if (state.getMaterial() == Material.STONE || state.getMaterial() == Material.METAL)
|
||||
return canSupportCenter(world, pos, direction.getOpposite());
|
||||
return Block.canSupportCenter(world, pos, direction.getOpposite());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ public class PipeBlock extends BaseEntityBlock {
|
|||
var connections = 0;
|
||||
var force = false;
|
||||
for (var dir : Direction.values()) {
|
||||
var value = newState.getValue(DIRECTIONS.get(dir));
|
||||
var value = newState.getValue(PipeBlock.DIRECTIONS.get(dir));
|
||||
if (!value.isConnected())
|
||||
continue;
|
||||
connections++;
|
||||
|
@ -271,7 +271,7 @@ public class PipeBlock extends BaseEntityBlock {
|
|||
|
||||
@Override
|
||||
public void playerWillDestroy(Level worldIn, BlockPos pos, BlockState state, Player player) {
|
||||
dropItems(worldIn, pos, player);
|
||||
PipeBlock.dropItems(worldIn, pos, player);
|
||||
super.playerWillDestroy(worldIn, pos, state, player);
|
||||
}
|
||||
|
||||
|
@ -302,7 +302,7 @@ public class PipeBlock extends BaseEntityBlock {
|
|||
@org.jetbrains.annotations.Nullable
|
||||
@Override
|
||||
public <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) {
|
||||
|
|
|
@ -17,7 +17,6 @@ import net.minecraft.nbt.NbtUtils;
|
|||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.Containers;
|
||||
|
@ -382,7 +381,7 @@ public class PipeBlockEntity extends BlockEntity implements MenuProvider, IPipeC
|
|||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return new TranslatableComponent("container." + PrettyPipes.ID + ".pipe");
|
||||
return Component.translatable("container." + PrettyPipes.ID + ".pipe");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -7,7 +7,9 @@ import net.minecraft.client.renderer.MultiBufferSource;
|
|||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.client.model.data.EmptyModelData;
|
||||
import net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer;
|
||||
|
||||
import java.util.Random;
|
||||
|
@ -40,7 +42,7 @@ public class PipeRenderer implements BlockEntityRenderer<PipeBlockEntity> {
|
|||
if (!ItemBlockRenderTypes.canRenderInLayer(tile.cover, layer))
|
||||
continue;
|
||||
ForgeHooksClient.setRenderType(layer);
|
||||
renderer.getModelRenderer().tesselateBlock(tile.getLevel(), renderer.getBlockModel(tile.cover), tile.cover, tile.getBlockPos(), matrixStack, source.getBuffer(layer), true, new Random(), tile.cover.getSeed(tile.getBlockPos()), overlay);
|
||||
renderer.getModelRenderer().tesselateBlock(tile.getLevel(), renderer.getBlockModel(tile.cover), tile.cover, tile.getBlockPos(), matrixStack, source.getBuffer(layer), true, RandomSource.create(), tile.cover.getSeed(tile.getBlockPos()), overlay, EmptyModelData.INSTANCE);
|
||||
}
|
||||
ForgeHooksClient.setRenderType(null);
|
||||
ForgeBlockModelRenderer.clearCache();
|
||||
|
|
|
@ -79,7 +79,7 @@ public abstract class AbstractPipeGui<T extends AbstractPipeContainer<?>> extend
|
|||
@Override
|
||||
protected void renderBg(PoseStack matrix, float partialTicks, int mouseX, int mouseY) {
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||
RenderSystem.setShaderTexture(0, AbstractPipeGui.TEXTURE);
|
||||
this.blit(matrix, this.leftPos, this.topPos + 32, 0, 0, 176, 171);
|
||||
|
||||
for (var tab : this.tabs)
|
||||
|
@ -143,7 +143,7 @@ public abstract class AbstractPipeGui<T extends AbstractPipeContainer<?>> extend
|
|||
|
||||
AbstractPipeGui.this.itemRenderer.renderGuiItem(this.moduleStack, this.x + 6, this.y + itemOffset);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||
RenderSystem.setShaderTexture(0, AbstractPipeGui.TEXTURE);
|
||||
}
|
||||
|
||||
private void drawForeground(PoseStack matrix, int mouseX, int mouseY) {
|
||||
|
|
|
@ -7,6 +7,7 @@ import de.ellpeck.prettypipes.pipe.PipeBlockEntity;
|
|||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class HighPriorityModuleItem extends ModuleItem {
|
||||
|
||||
private final int priority;
|
||||
|
||||
public HighPriorityModuleItem(String name, ModuleTier tier) {
|
||||
|
|
|
@ -7,6 +7,7 @@ import de.ellpeck.prettypipes.pipe.PipeBlockEntity;
|
|||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class LowPriorityModuleItem extends ModuleItem {
|
||||
|
||||
private final int priority;
|
||||
|
||||
public LowPriorityModuleItem(String name, ModuleTier tier) {
|
||||
|
|
|
@ -7,9 +7,8 @@ import net.minecraft.world.item.ItemStack;
|
|||
|
||||
public class RedstoneModuleItem extends ModuleItem {
|
||||
|
||||
public RedstoneModuleItem(String name) {
|
||||
super(name);
|
||||
this.setRegistryName(name);
|
||||
public RedstoneModuleItem() {
|
||||
super("redstone_module");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,7 +15,6 @@ public class SortingModuleItem extends ModuleItem {
|
|||
public SortingModuleItem(String name, Type type) {
|
||||
super(name);
|
||||
this.type = type;
|
||||
this.setRegistryName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,6 +7,7 @@ import de.ellpeck.prettypipes.pipe.PipeBlockEntity;
|
|||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class SpeedModuleItem extends ModuleItem {
|
||||
|
||||
private final float speedIncrease;
|
||||
|
||||
public SpeedModuleItem(String name, ModuleTier tier) {
|
||||
|
|
|
@ -17,7 +17,7 @@ public class CraftingModuleGui extends AbstractPipeGui<CraftingModuleContainer>
|
|||
protected void renderBg(PoseStack matrix, float partialTicks, int mouseX, int mouseY) {
|
||||
super.renderBg(matrix, partialTicks, mouseX, mouseY);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||
RenderSystem.setShaderTexture(0, AbstractPipeGui.TEXTURE);
|
||||
this.blit(matrix, this.leftPos + 176 / 2 - 16 / 2, this.topPos + 32 + 18 * 2, 176, 80, 16, 16);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ public class CraftingModuleItem extends ModuleItem {
|
|||
var out = output.getStackInSlot(i);
|
||||
if (!out.isEmpty() && ItemEquality.compareItems(out, stack, equalityTypes)) {
|
||||
// figure out how many crafting operations we can actually do with the input items we have in the network
|
||||
var availableCrafts = CraftingTerminalBlockEntity.getAvailableCrafts(tile, input.getSlots(), input::getStackInSlot, k -> true, s -> items, unavailableConsumer, addDependency(dependencyChain, module), equalityTypes);
|
||||
var availableCrafts = CraftingTerminalBlockEntity.getAvailableCrafts(tile, input.getSlots(), input::getStackInSlot, k -> true, s -> items, unavailableConsumer, CraftingModuleItem.addDependency(dependencyChain, module), equalityTypes);
|
||||
if (availableCrafts > 0)
|
||||
craftable += out.getCount() * availableCrafts;
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public class CraftingModuleItem extends ModuleItem {
|
|||
continue;
|
||||
var copy = in.copy();
|
||||
copy.setCount(in.getCount() * toCraft);
|
||||
var ret = ItemTerminalBlockEntity.requestItemLater(tile.getLevel(), tile.getBlockPos(), items, unavailableConsumer, copy, addDependency(dependencyChain, module), equalityTypes);
|
||||
var ret = ItemTerminalBlockEntity.requestItemLater(tile.getLevel(), tile.getBlockPos(), items, unavailableConsumer, copy, CraftingModuleItem.addDependency(dependencyChain, module), equalityTypes);
|
||||
tile.craftIngredientRequests.addAll(ret.getLeft());
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import de.ellpeck.prettypipes.pipe.containers.AbstractPipeContainer;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.inventory.Slot;
|
||||
|
||||
public class FilterIncreaseModuleContainer extends AbstractPipeContainer<FilterIncreaseModuleItem> implements ItemFilter.IFilteredContainer {
|
||||
|
||||
|
|
|
@ -12,9 +12,8 @@ import net.minecraft.world.item.ItemStack;
|
|||
|
||||
public class FilterIncreaseModuleItem extends ModuleItem {
|
||||
|
||||
public FilterIncreaseModuleItem(String name) {
|
||||
super(name);
|
||||
this.setRegistryName(name);
|
||||
public FilterIncreaseModuleItem() {
|
||||
super("filter_increase_modifier");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package de.ellpeck.prettypipes.pipe.modules.insertion;
|
||||
|
||||
import de.ellpeck.prettypipes.pipe.containers.AbstractPipeGui;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
|
|
|
@ -126,7 +126,7 @@ public class FilterModifierModuleGui extends AbstractPipeGui<FilterModifierModul
|
|||
text = ChatFormatting.BOLD + text;
|
||||
FilterModifierModuleGui.this.font.draw(matrix, text, this.x, this.y, color);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||
RenderSystem.setShaderTexture(0, AbstractPipeGui.TEXTURE);
|
||||
}
|
||||
|
||||
private boolean onClicked(double mouseX, double mouseY, int button) {
|
||||
|
|
|
@ -19,7 +19,6 @@ public class FilterModifierModuleItem extends ModuleItem {
|
|||
public FilterModifierModuleItem(String name, ItemEquality.Type type) {
|
||||
super(name);
|
||||
this.type = type;
|
||||
this.setRegistryName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,7 +38,7 @@ public class FilterModifierModuleItem extends ModuleItem {
|
|||
|
||||
public ItemEquality getEqualityType(ItemStack stack) {
|
||||
if (this.type == ItemEquality.Type.TAG) {
|
||||
return ItemEquality.tag(getFilterTag(stack));
|
||||
return ItemEquality.tag(FilterModifierModuleItem.getFilterTag(stack));
|
||||
} else {
|
||||
return this.type.getDefaultInstance();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import de.ellpeck.prettypipes.pipe.containers.AbstractPipeContainer;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.inventory.Slot;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package de.ellpeck.prettypipes.pipe.modules.retrieval;
|
||||
|
||||
import de.ellpeck.prettypipes.pipe.containers.AbstractPipeGui;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
|
||||
|
|
|
@ -4,16 +4,13 @@ import de.ellpeck.prettypipes.Registry;
|
|||
import de.ellpeck.prettypipes.items.IModule;
|
||||
import de.ellpeck.prettypipes.items.ModuleItem;
|
||||
import de.ellpeck.prettypipes.items.ModuleTier;
|
||||
import de.ellpeck.prettypipes.misc.ItemEquality;
|
||||
import de.ellpeck.prettypipes.misc.ItemFilter;
|
||||
import de.ellpeck.prettypipes.network.PipeNetwork;
|
||||
import de.ellpeck.prettypipes.pipe.PipeBlockEntity;
|
||||
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.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public class RetrievalModuleItem extends ModuleItem {
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.client.gui.components.Button;
|
|||
import net.minecraft.client.gui.components.EditBox;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
@ -23,7 +22,7 @@ public class StackSizeModuleGui extends AbstractPipeGui<StackSizeModuleContainer
|
|||
@Override
|
||||
protected void 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
|
||||
public void insertText(String textToWrite) {
|
||||
var ret = new StringBuilder();
|
||||
|
@ -43,7 +42,7 @@ public class StackSizeModuleGui extends AbstractPipeGui<StackSizeModuleContainer
|
|||
var amount = Integer.parseInt(s);
|
||||
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 -> {
|
||||
PacketButton.sendAndExecute(this.menu.tile.getBlockPos(), ButtonResult.STACK_SIZE_MODULE_BUTTON);
|
||||
b.setMessage(buttonText.get());
|
||||
|
|
|
@ -13,9 +13,8 @@ import net.minecraftforge.items.IItemHandler;
|
|||
|
||||
public class StackSizeModuleItem extends ModuleItem {
|
||||
|
||||
public StackSizeModuleItem(String name) {
|
||||
super(name);
|
||||
this.setRegistryName(name);
|
||||
public StackSizeModuleItem() {
|
||||
super("stack_size_module");
|
||||
}
|
||||
|
||||
public static int getMaxStackSize(ItemStack module) {
|
||||
|
@ -43,8 +42,8 @@ public class StackSizeModuleItem extends ModuleItem {
|
|||
|
||||
@Override
|
||||
public int getMaxInsertionAmount(ItemStack module, PipeBlockEntity tile, ItemStack stack, IItemHandler destination) {
|
||||
var max = getMaxStackSize(module);
|
||||
if (getLimitToMaxStackSize(module))
|
||||
var max = StackSizeModuleItem.getMaxStackSize(module);
|
||||
if (StackSizeModuleItem.getLimitToMaxStackSize(module))
|
||||
max = Math.min(max, stack.getMaxStackSize());
|
||||
var amount = 0;
|
||||
for (var i = 0; i < destination.getSlots(); i++) {
|
||||
|
|
|
@ -2,7 +2,6 @@ package de.ellpeck.prettypipes.pressurizer;
|
|||
|
||||
import de.ellpeck.prettypipes.Registry;
|
||||
import de.ellpeck.prettypipes.Utility;
|
||||
import de.ellpeck.prettypipes.pipe.PipeBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
@ -24,6 +23,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
@ -57,13 +57,13 @@ public class PressurizerBlock extends BaseEntityBlock {
|
|||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack stack, @Nullable BlockGetter worldIn, List<Component> tooltip, TooltipFlag flagIn) {
|
||||
Utility.addTooltip(this.getRegistryName().getPath(), tooltip);
|
||||
Utility.addTooltip(ForgeRegistries.BLOCKS.getKey(this).getPath(), tooltip);
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.Nullable
|
||||
@Override
|
||||
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
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||
import net.minecraft.world.MenuProvider;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
|
@ -86,7 +85,7 @@ public class PressurizerBlockEntity extends BlockEntity implements MenuProvider,
|
|||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return new TranslatableComponent("container." + PrettyPipes.ID + ".pressurizer");
|
||||
return Component.translatable("container." + PrettyPipes.ID + ".pressurizer");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -6,7 +6,6 @@ import de.ellpeck.prettypipes.PrettyPipes;
|
|||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
|
||||
|
@ -26,7 +25,7 @@ public class PressurizerGui extends AbstractContainerScreen<PressurizerContainer
|
|||
super.render(matrix, mouseX, mouseY, partialTicks);
|
||||
this.renderTooltip(matrix, mouseX, mouseY);
|
||||
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
|
||||
|
@ -38,7 +37,7 @@ public class PressurizerGui extends AbstractContainerScreen<PressurizerContainer
|
|||
@Override
|
||||
protected void renderBg(PoseStack matrixStack, float partialTicks, int x, int y) {
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||
RenderSystem.setShaderTexture(0, PressurizerGui.TEXTURE);
|
||||
this.blit(matrixStack, this.leftPos, this.topPos, 0, 0, 176, 137);
|
||||
var energy = (int) (this.menu.tile.getEnergyPercentage() * 124);
|
||||
this.blit(matrixStack, this.leftPos + 26, this.topPos + 22, 0, 137, energy, 12);
|
||||
|
|
|
@ -3,6 +3,7 @@ package de.ellpeck.prettypipes.terminal;
|
|||
import de.ellpeck.prettypipes.Registry;
|
||||
import net.minecraft.core.BlockPos;
|
||||
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.BlockEntityTicker;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
@ -18,6 +19,6 @@ public class CraftingTerminalBlock extends ItemTerminalBlock {
|
|||
@org.jetbrains.annotations.Nullable
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
|
@ -111,10 +110,10 @@ public class CraftingTerminalBlockEntity extends ItemTerminalBlockEntity {
|
|||
network.startProfile("terminal_request_crafting");
|
||||
this.updateItems();
|
||||
// get the amount of crafts that we can do
|
||||
var lowestAvailable = getAvailableCrafts(pipe, this.craftItems.getSlots(), i -> ItemHandlerHelper.copyStackWithSize(this.getRequestedCraftItem(i), 1), this::isGhostItem, s -> {
|
||||
var lowestAvailable = CraftingTerminalBlockEntity.getAvailableCrafts(pipe, this.craftItems.getSlots(), i -> ItemHandlerHelper.copyStackWithSize(this.getRequestedCraftItem(i), 1), this::isGhostItem, s -> {
|
||||
var item = this.networkItems.get(s);
|
||||
return item != null ? item.getLocations() : Collections.emptyList();
|
||||
}, onItemUnavailable(player, force), new Stack<>(), ItemEquality.NBT);
|
||||
}, ItemTerminalBlockEntity.onItemUnavailable(player, force), new Stack<>(), ItemEquality.NBT);
|
||||
// if we're forcing, just pretend we have one available
|
||||
if (lowestAvailable <= 0 && force)
|
||||
lowestAvailable = maxAmount;
|
||||
|
@ -128,11 +127,11 @@ public class CraftingTerminalBlockEntity extends ItemTerminalBlockEntity {
|
|||
continue;
|
||||
requested = requested.copy();
|
||||
requested.setCount(lowestAvailable);
|
||||
this.requestItemImpl(requested, onItemUnavailable(player, force));
|
||||
this.requestItemImpl(requested, ItemTerminalBlockEntity.onItemUnavailable(player, force));
|
||||
}
|
||||
player.sendMessage(new TranslatableComponent("info." + PrettyPipes.ID + ".sending_ingredients", lowestAvailable).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GREEN)), UUID.randomUUID());
|
||||
player.sendSystemMessage(Component.translatable("info." + PrettyPipes.ID + ".sending_ingredients", lowestAvailable).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GREEN)));
|
||||
} else {
|
||||
player.sendMessage(new TranslatableComponent("info." + PrettyPipes.ID + ".hold_alt"), UUID.randomUUID());
|
||||
player.sendSystemMessage(Component.translatable("info." + PrettyPipes.ID + ".hold_alt"));
|
||||
}
|
||||
network.endProfile();
|
||||
}
|
||||
|
@ -151,7 +150,7 @@ public class CraftingTerminalBlockEntity extends ItemTerminalBlockEntity {
|
|||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return new TranslatableComponent("container." + PrettyPipes.ID + ".crafting_terminal");
|
||||
return Component.translatable("container." + PrettyPipes.ID + ".crafting_terminal");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -5,7 +5,6 @@ import de.ellpeck.prettypipes.Utility;
|
|||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
@ -24,10 +23,10 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ItemTerminalBlock extends BaseEntityBlock {
|
||||
|
||||
|
@ -43,7 +42,7 @@ public class ItemTerminalBlock extends BaseEntityBlock {
|
|||
var reason = tile.getInvalidTerminalReason();
|
||||
if (reason != null) {
|
||||
if (!worldIn.isClientSide)
|
||||
player.sendMessage(new TranslatableComponent(reason).withStyle(ChatFormatting.RED), UUID.randomUUID());
|
||||
player.sendSystemMessage(Component.translatable(reason).withStyle(ChatFormatting.RED));
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
if (!worldIn.isClientSide) {
|
||||
|
@ -76,13 +75,13 @@ public class ItemTerminalBlock extends BaseEntityBlock {
|
|||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack stack, @Nullable BlockGetter worldIn, List<Component> tooltip, TooltipFlag flagIn) {
|
||||
Utility.addTooltip(this.getRegistryName().getPath(), tooltip);
|
||||
Utility.addTooltip(ForgeRegistries.BLOCKS.getKey(this).getPath(), tooltip);
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.Nullable
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import net.minecraft.nbt.CompoundTag;
|
|||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.MenuProvider;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
@ -163,11 +162,11 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect
|
|||
.filter(s -> ItemEquality.compareItems(s, filter) && s.hasTag() && s.getTag().hashCode() == nbtHash)
|
||||
.findFirst().orElse(filter);
|
||||
}
|
||||
var requested = this.requestItemImpl(stack, onItemUnavailable(player, false));
|
||||
var requested = this.requestItemImpl(stack, ItemTerminalBlockEntity.onItemUnavailable(player, false));
|
||||
if (requested > 0) {
|
||||
player.sendMessage(new TranslatableComponent("info." + PrettyPipes.ID + ".sending", requested, stack.getHoverName()).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GREEN)), UUID.randomUUID());
|
||||
player.sendSystemMessage(Component.translatable("info." + PrettyPipes.ID + ".sending", requested, stack.getHoverName()).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GREEN)));
|
||||
} else {
|
||||
onItemUnavailable(player, false).accept(stack);
|
||||
ItemTerminalBlockEntity.onItemUnavailable(player, false).accept(stack);
|
||||
}
|
||||
network.endProfile();
|
||||
}
|
||||
|
@ -175,7 +174,7 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect
|
|||
public int requestItemImpl(ItemStack stack, Consumer<ItemStack> unavailableConsumer) {
|
||||
var item = this.networkItems.get(new EquatableItemStack(stack, ItemEquality.NBT));
|
||||
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());
|
||||
return stack.getCount() - ret.getRight().getCount();
|
||||
}
|
||||
|
@ -248,7 +247,7 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect
|
|||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return new TranslatableComponent("container." + PrettyPipes.ID + ".item_terminal");
|
||||
return Component.translatable("container." + PrettyPipes.ID + ".item_terminal");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -319,7 +318,7 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect
|
|||
return s -> {
|
||||
if (ignore)
|
||||
return;
|
||||
player.sendMessage(new TranslatableComponent("info." + PrettyPipes.ID + ".not_found", s.getHoverName()).setStyle(Style.EMPTY.applyFormat(ChatFormatting.RED)), UUID.randomUUID());
|
||||
player.sendSystemMessage(Component.translatable("info." + PrettyPipes.ID + ".not_found", s.getHoverName()).setStyle(Style.EMPTY.applyFormat(ChatFormatting.RED)));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ import de.ellpeck.prettypipes.PrettyPipes;
|
|||
import de.ellpeck.prettypipes.packets.PacketButton;
|
||||
import de.ellpeck.prettypipes.packets.PacketHandler;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
|
||||
|
@ -24,10 +24,10 @@ public class CraftingTerminalGui extends ItemTerminalGui {
|
|||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
this.requestButton = this.addRenderableWidget(new Button(this.leftPos + 8, this.topPos + 100, 50, 20, new TranslatableComponent("info." + PrettyPipes.ID + ".request"), button -> {
|
||||
var amount = requestModifier();
|
||||
this.requestButton = this.addRenderableWidget(new Button(this.leftPos + 8, this.topPos + 100, 50, 20, Component.translatable("info." + PrettyPipes.ID + ".request"), button -> {
|
||||
var amount = ItemTerminalGui.requestModifier();
|
||||
// also allow holding backspace instead of alt for people whose alt key is inaccessible (linux?)
|
||||
var force = hasAltDown() || InputConstants.isKeyDown(this.minecraft.getWindow().getWindow(), 259) ? 1 : 0;
|
||||
var force = Screen.hasAltDown() || InputConstants.isKeyDown(this.minecraft.getWindow().getWindow(), 259) ? 1 : 0;
|
||||
PacketHandler.sendToServer(new PacketButton(this.menu.tile.getBlockPos(), PacketButton.ButtonResult.CRAFT_TERMINAL_REQUEST, amount, force));
|
||||
}));
|
||||
this.tick();
|
||||
|
@ -70,7 +70,7 @@ public class CraftingTerminalGui extends ItemTerminalGui {
|
|||
|
||||
@Override
|
||||
protected ResourceLocation getTexture() {
|
||||
return TEXTURE;
|
||||
return CraftingTerminalGui.TEXTURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,12 +15,11 @@ import net.minecraft.client.gui.components.EditBox;
|
|||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
|
@ -65,14 +64,14 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
|
|||
protected void 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.lastSearchText = "";
|
||||
if (this.items != null)
|
||||
this.updateWidgets();
|
||||
|
||||
this.plusButton = this.addRenderableWidget(new Button(this.leftPos + this.getXOffset() + 95 - 7 + 12, this.topPos + 103, 12, 12, new TextComponent("+"), button -> {
|
||||
var modifier = requestModifier();
|
||||
this.plusButton = this.addRenderableWidget(new Button(this.leftPos + this.getXOffset() + 95 - 7 + 12, this.topPos + 103, 12, 12, Component.literal("+"), button -> {
|
||||
var modifier = ItemTerminalGui.requestModifier();
|
||||
if (modifier > 1 && this.requestAmount == 1) {
|
||||
this.requestAmount = modifier;
|
||||
} else {
|
||||
|
@ -82,15 +81,15 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
|
|||
if (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.requestAmount -= requestModifier();
|
||||
this.minusButton = this.addRenderableWidget(new Button(this.leftPos + this.getXOffset() + 95 - 7 - 24, this.topPos + 103, 12, 12, Component.literal("-"), button -> {
|
||||
this.requestAmount -= ItemTerminalGui.requestModifier();
|
||||
if (this.requestAmount < 1)
|
||||
this.requestAmount = 1;
|
||||
}));
|
||||
this.minusButton.active = false;
|
||||
this.requestButton = this.addRenderableWidget(new Button(this.leftPos + this.getXOffset() + 95 - 7 - 25, this.topPos + 115, 50, 20, new TranslatableComponent("info." + PrettyPipes.ID + ".request"), button -> {
|
||||
this.requestButton = this.addRenderableWidget(new Button(this.leftPos + this.getXOffset() + 95 - 7 - 25, this.topPos + 115, 50, 20, Component.translatable("info." + PrettyPipes.ID + ".request"), button -> {
|
||||
var widget = this.streamWidgets().filter(w -> w.selected).findFirst();
|
||||
if (!widget.isPresent())
|
||||
if (widget.isEmpty())
|
||||
return;
|
||||
var stack = widget.get().stack.copy();
|
||||
stack.setCount(1);
|
||||
|
@ -98,7 +97,7 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
|
|||
this.requestAmount = 1;
|
||||
}));
|
||||
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)
|
||||
return;
|
||||
var prefs = PlayerPrefs.get();
|
||||
|
@ -106,7 +105,7 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
|
|||
prefs.save();
|
||||
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)
|
||||
return;
|
||||
var prefs = PlayerPrefs.get();
|
||||
|
@ -114,7 +113,7 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
|
|||
prefs.save();
|
||||
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;
|
||||
for (var y = 0; y < 4; y++) {
|
||||
|
@ -207,8 +206,8 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
|
|||
|
||||
public void updateWidgets() {
|
||||
var prefs = PlayerPrefs.get();
|
||||
this.ascendingButton.setMessage(new TextComponent(prefs.terminalAscending ? "^" : "v"));
|
||||
this.orderButton.setMessage(new TextComponent(prefs.terminalItemOrder.name().substring(0, 1)));
|
||||
this.ascendingButton.setMessage(Component.literal(prefs.terminalAscending ? "^" : "v"));
|
||||
this.orderButton.setMessage(Component.literal(prefs.terminalItemOrder.name().substring(0, 1)));
|
||||
this.cancelCraftingButton.visible = this.currentlyCrafting != null && !this.currentlyCrafting.isEmpty();
|
||||
|
||||
var comparator = prefs.terminalItemOrder.comparator;
|
||||
|
@ -280,13 +279,13 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
|
|||
if (this.sortedItems != null) {
|
||||
var prefs = PlayerPrefs.get();
|
||||
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())
|
||||
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()) {
|
||||
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())
|
||||
this.renderTooltip(matrix, this.hoveredCrafting, mouseX, mouseY);
|
||||
|
@ -325,7 +324,7 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
|
|||
this.hoveredCrafting = ItemStack.EMPTY;
|
||||
if (this.currentlyCrafting != null && !this.currentlyCrafting.isEmpty()) {
|
||||
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);
|
||||
|
||||
var x = 0;
|
||||
|
@ -349,7 +348,7 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
|
|||
}
|
||||
|
||||
protected ResourceLocation getTexture() {
|
||||
return TEXTURE;
|
||||
return ItemTerminalGui.TEXTURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -377,9 +376,9 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
|
|||
}
|
||||
|
||||
public static int requestModifier() {
|
||||
if (hasControlDown()) {
|
||||
if (Screen.hasControlDown()) {
|
||||
return 10;
|
||||
} else if (hasShiftDown()) {
|
||||
} else if (Screen.hasShiftDown()) {
|
||||
return 64;
|
||||
} else {
|
||||
return 1;
|
||||
|
|
|
@ -4,20 +4,20 @@
|
|||
# Note that there are a couple of TOML lists in this file.
|
||||
# Find more information on toml format here: https://github.com/toml-lang/toml
|
||||
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||
modLoader="javafml" #mandatory
|
||||
modLoader = "javafml" #mandatory
|
||||
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
||||
loaderVersion="[28,)" #mandatory (28 is current forge version)
|
||||
loaderVersion = "[28,)" #mandatory (28 is current forge version)
|
||||
# A URL to refer people to when problems occur with this mod
|
||||
issueTrackerURL="https://github.com/Ellpeck/PrettyPipes" #optional
|
||||
license="MIT"
|
||||
issueTrackerURL = "https://github.com/Ellpeck/PrettyPipes" #optional
|
||||
license = "MIT"
|
||||
# A list of mods - how many allowed here is determined by the individual mod loader
|
||||
[[mods]] #mandatory
|
||||
# The modid of the mod
|
||||
modId="prettypipes" #mandatory
|
||||
modId = "prettypipes" #mandatory
|
||||
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
||||
version="${file.jarVersion}"
|
||||
# A display name for the mod
|
||||
displayName="Pretty Pipes" #mandatory
|
||||
version = "${file.jarVersion}"
|
||||
# A display name for the mod
|
||||
displayName = "Pretty Pipes" #mandatory
|
||||
# A URL to query for updates for this mod. See the JSON update specification <here>
|
||||
#updateJSONURL="http://myurl.me/" #optional
|
||||
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||
|
@ -27,7 +27,7 @@ displayName="Pretty Pipes" #mandatory
|
|||
# A text field displayed in the mod UI
|
||||
#credits="" #optional
|
||||
# A text field displayed in the mod UI
|
||||
authors="Ellpeck" #optional
|
||||
authors = "Ellpeck" #optional
|
||||
# The description text for the mod (multi line!) (#mandatory)
|
||||
description='''
|
||||
description = '''
|
||||
wow pipes, how creative'''
|
||||
|
|
|
@ -1,154 +1,370 @@
|
|||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"0": "prettypipes:block/pipe",
|
||||
"particle": "prettypipes:block/pipe"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [5, 5, 5],
|
||||
"to": [6, 11, 6],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 1, 6], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 1, 6], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 1, 6], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 1, 6], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 1, 1], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [5, 5, 10],
|
||||
"to": [6, 11, 11],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 1, 6], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 1, 6], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 1, 6], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 1, 6], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 1, 1], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [10, 5, 10],
|
||||
"to": [11, 11, 11],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 1, 6], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 1, 6], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 1, 6], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 1, 6], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 1, 1], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [10, 5, 5],
|
||||
"to": [11, 11, 6],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 1, 6], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 1, 6], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 1, 6], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 1, 6], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 1, 1], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 10, 10],
|
||||
"to": [10, 11, 11],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 4, 1], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 5, 10],
|
||||
"to": [10, 6, 11],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 4, 1], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 5, 5],
|
||||
"to": [10, 6, 6],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 4, 1], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [5, 5, 6],
|
||||
"to": [6, 6, 10],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 1, 4], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 1, 4], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [5, 10, 6],
|
||||
"to": [6, 11, 10],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 1, 4], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 1, 4], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [10, 10, 6],
|
||||
"to": [11, 11, 10],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 1, 4], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 1, 4], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [10, 5, 6],
|
||||
"to": [11, 6, 10],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 1, 4], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 1, 4], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 10, 5],
|
||||
"to": [10, 11, 6],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 4, 1], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 4, 1], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"0": "prettypipes:block/pipe",
|
||||
"particle": "prettypipes:block/pipe"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [5, 5, 5],
|
||||
"to": [6, 11, 6],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 0, 1, 6],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 0, 1, 6],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 0, 1, 6],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 0, 1, 6],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [5, 5, 10],
|
||||
"to": [6, 11, 11],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 0, 1, 6],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 0, 1, 6],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 0, 1, 6],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 0, 1, 6],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [10, 5, 10],
|
||||
"to": [11, 11, 11],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 0, 1, 6],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 0, 1, 6],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 0, 1, 6],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 0, 1, 6],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [10, 5, 5],
|
||||
"to": [11, 11, 6],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 0, 1, 6],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 0, 1, 6],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 0, 1, 6],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 0, 1, 6],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 10, 10],
|
||||
"to": [10, 11, 11],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 5, 10],
|
||||
"to": [10, 6, 11],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 5, 5],
|
||||
"to": [10, 6, 6],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [5, 5, 6],
|
||||
"to": [6, 6, 10],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [0, 0, 1, 4],
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [0, 0, 1, 4],
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [5, 10, 6],
|
||||
"to": [6, 11, 10],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [0, 0, 1, 4],
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [0, 0, 1, 4],
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [10, 10, 6],
|
||||
"to": [11, 11, 10],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [0, 0, 1, 4],
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [0, 0, 1, 4],
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [10, 5, 6],
|
||||
"to": [11, 6, 10],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [0, 0, 1, 4],
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [0, 0, 1, 4],
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 10, 5],
|
||||
"to": [10, 11, 6],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [0, 0, 4, 1],
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,57 +1,137 @@
|
|||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "prettypipes:block/pipe",
|
||||
"particle": "prettypipes:block/pipe"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [5, 10, 0],
|
||||
"to": [6, 11, 5],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 5, 1], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 5, 1], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 5, 1], "rotation": 90, "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 5, 1], "rotation": 270, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [5, 5, 0],
|
||||
"to": [6, 6, 5],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 5, 1], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 5, 1], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 5, 1], "rotation": 90, "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 5, 1], "rotation": 270, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [10, 5, 0],
|
||||
"to": [11, 6, 5],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 5, 1], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 5, 1], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 5, 1], "rotation": 90, "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 5, 1], "rotation": 270, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [10, 10, 0],
|
||||
"to": [11, 11, 5],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 5, 1], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 1, 1], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 5, 1], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 5, 1], "rotation": 90, "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 5, 1], "rotation": 270, "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "prettypipes:block/pipe",
|
||||
"particle": "prettypipes:block/pipe"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [5, 10, 0],
|
||||
"to": [6, 11, 5],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 0, 5, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 0, 5, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [0, 0, 5, 1],
|
||||
"rotation": 90,
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [0, 0, 5, 1],
|
||||
"rotation": 270,
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [5, 5, 0],
|
||||
"to": [6, 6, 5],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 0, 5, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 0, 5, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [0, 0, 5, 1],
|
||||
"rotation": 90,
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [0, 0, 5, 1],
|
||||
"rotation": 270,
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [10, 5, 0],
|
||||
"to": [11, 6, 5],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 0, 5, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 0, 5, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [0, 0, 5, 1],
|
||||
"rotation": 90,
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [0, 0, 5, 1],
|
||||
"rotation": 270,
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [10, 10, 0],
|
||||
"to": [11, 11, 5],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 0, 5, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 0, 1, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 0, 5, 1],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [0, 0, 5, 1],
|
||||
"rotation": 90,
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [0, 0, 5, 1],
|
||||
"rotation": 270,
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,33 +1,66 @@
|
|||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"1": "prettypipes:block/pipe_legs",
|
||||
"particle": "prettypipes:block/pipe"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [6, 4, 6],
|
||||
"to": [10, 5, 10],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 7, 4, 8], "texture": "#1"},
|
||||
"east": {"uv": [0, 7, 4, 8], "texture": "#1"},
|
||||
"south": {"uv": [0, 7, 4, 8], "texture": "#1"},
|
||||
"west": {"uv": [0, 7, 4, 8], "texture": "#1"},
|
||||
"up": {"uv": [1, 1, 5, 5], "texture": "#1"},
|
||||
"down": {"uv": [1, 1, 5, 5], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [7, 0, 7],
|
||||
"to": [9, 4, 9],
|
||||
"faces": {
|
||||
"north": {"uv": [1, 1, 3, 5], "texture": "#1"},
|
||||
"east": {"uv": [1, 1, 3, 5], "texture": "#1"},
|
||||
"south": {"uv": [1, 1, 3, 5], "texture": "#1"},
|
||||
"west": {"uv": [1, 1, 3, 5], "texture": "#1"},
|
||||
"down": {"uv": [1, 1, 3, 3], "texture": "#1"}
|
||||
}
|
||||
}
|
||||
]
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"1": "prettypipes:block/pipe_legs",
|
||||
"particle": "prettypipes:block/pipe"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [6, 4, 6],
|
||||
"to": [10, 5, 10],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 7, 4, 8],
|
||||
"texture": "#1"
|
||||
},
|
||||
"east": {
|
||||
"uv": [0, 7, 4, 8],
|
||||
"texture": "#1"
|
||||
},
|
||||
"south": {
|
||||
"uv": [0, 7, 4, 8],
|
||||
"texture": "#1"
|
||||
},
|
||||
"west": {
|
||||
"uv": [0, 7, 4, 8],
|
||||
"texture": "#1"
|
||||
},
|
||||
"up": {
|
||||
"uv": [1, 1, 5, 5],
|
||||
"texture": "#1"
|
||||
},
|
||||
"down": {
|
||||
"uv": [1, 1, 5, 5],
|
||||
"texture": "#1"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [7, 0, 7],
|
||||
"to": [9, 4, 9],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [1, 1, 3, 5],
|
||||
"texture": "#1"
|
||||
},
|
||||
"east": {
|
||||
"uv": [1, 1, 3, 5],
|
||||
"texture": "#1"
|
||||
},
|
||||
"south": {
|
||||
"uv": [1, 1, 3, 5],
|
||||
"texture": "#1"
|
||||
},
|
||||
"west": {
|
||||
"uv": [1, 1, 3, 5],
|
||||
"texture": "#1"
|
||||
},
|
||||
"down": {
|
||||
"uv": [1, 1, 3, 3],
|
||||
"texture": "#1"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "prettypipes",
|
||||
"version": "0.0.0",
|
||||
"contributors": [ "SoniEx2" ],
|
||||
"depends": { "forge": "*" }
|
||||
"schemaVersion": 1,
|
||||
"id": "prettypipes",
|
||||
"version": "0.0.0",
|
||||
"contributors": ["SoniEx2"],
|
||||
"depends": {
|
||||
"forge": "*"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue