diff --git a/build.gradle b/build.gradle index 33a6b8fd19c..23915b84226 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1695527071 +//version: 1699743071 /* * DO NOT CHANGE THIS FILE! * Also, you may replace this file at any time if there is an update available. @@ -456,7 +456,7 @@ configurations { } } -String mixinProviderSpec = 'zone.rong:mixinbooter:8.3' +String mixinProviderSpec = 'zone.rong:mixinbooter:8.9' dependencies { if (usesMixins.toBoolean()) { annotationProcessor 'org.ow2.asm:asm-debug-all:5.2' diff --git a/dependencies.gradle b/dependencies.gradle index b123f3110b9..ffe5c4160cc 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -40,6 +40,17 @@ dependencies { compileOnlyApi "curse.maven:xaeros-263420:4516832" // Xaero's Minimap 23.4.1 compileOnlyApi rfg.deobf("curse.maven:hwyla-253449:2568751") // HWYLA 1.8.26-B41 compileOnlyApi rfg.deobf("curse.maven:baubles-227083:2518667") // Baubles 1.5.2 + compileOnlyApi rfg.deobf("curse.maven:forestry-59751:2684780") // Forestry 5.8.2.387 + + // Mods with Soft compat but which have no need to be in code, such as isModLoaded() checks and getModItem() recipes. + // Uncomment any of these to test them in-game. + + // runtimeOnly rfg.deobf("curse.maven:beebetteratbees-244516:2627215") // BeeBetterAtBees 2.0.3 (recommended to enable when testing Forestry compat) + // runtimeOnly rfg.deobf("curse.maven:jei-bees-248370:2490058") // JEIBees 0.9.0.5 (recommended to enable when testing Forestry compat) + // runtimeOnly rfg.deobf("curse.maven:binnies-mods-223525:2916129") // Binnie 2.5.1.203 + // runtimeOnly rfg.deobf("curse.maven:magic-bees-65764:2855061") // Magic Bees 3.2.25 + // runtimeOnly rfg.deobf("curse.maven:gendustry-70492:2516215") // Gendustry 1.6.5.8 + // runtimeOnly rfg.deobf("curse.maven:bdlib-70496:2518031") // BdLib 1.14.3.12 } minecraft { diff --git a/src/main/java/gregtech/GregTechMod.java b/src/main/java/gregtech/GregTechMod.java index 3f6b844486c..b481b0618a3 100644 --- a/src/main/java/gregtech/GregTechMod.java +++ b/src/main/java/gregtech/GregTechMod.java @@ -24,6 +24,10 @@ + "required-after:codechickenlib@[3.2.3,);" + "after:appliedenergistics2;" + "after:forestry;" + + "after:extrabees;" + + "after:extratrees;" + + "after:genetics;" + + "after:magicbees;" + "after:jei@[4.15.0,);" + "after:crafttweaker@[4.1.20,);" + "after:groovyscript@[0.6.0,);" diff --git a/src/main/java/gregtech/api/GTValues.java b/src/main/java/gregtech/api/GTValues.java index 084f28f4094..677c77ad7a8 100644 --- a/src/main/java/gregtech/api/GTValues.java +++ b/src/main/java/gregtech/api/GTValues.java @@ -146,7 +146,18 @@ public class GTValues { MODID_XAERO_MINIMAP = "xaerominimap", MODID_HWYLA = "hwyla", MODID_BAUBLES = "baubles", - MODID_TOP_ADDONS = "topaddons"; + MODID_TOP_ADDONS = "topaddons", + MODID_IC2 = "ic2", + MODID_GTFO = "gregtechfoodoption", + MODID_BINNIE = "binniecore", + MODID_XU2 = "extrautils2", + MODID_TR = "techreborn", + MODID_MB = "magicbees", + MODID_EB = "extrabees", + MODID_ET = "extratrees", + MODID_GENETICS = "genetics", + MODID_BOP = "biomesoplenty", + MODID_TCON = "tconstruct"; private static Boolean isClient; diff --git a/src/main/java/gregtech/api/block/machines/MachineItemBlock.java b/src/main/java/gregtech/api/block/machines/MachineItemBlock.java index 4d97969ae99..42febdc36b5 100644 --- a/src/main/java/gregtech/api/block/machines/MachineItemBlock.java +++ b/src/main/java/gregtech/api/block/machines/MachineItemBlock.java @@ -18,6 +18,7 @@ import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -184,4 +185,10 @@ public CreativeTabs[] getCreativeTabs() { tabs[tabs.length - 1] = getCreativeTab(); return tabs; } + + @Override + public int getItemStackLimit(@Nonnull ItemStack stack) { + MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(stack); + return metaTileEntity != null ? metaTileEntity.getItemStackLimit(stack) : super.getItemStackLimit(stack); + } } diff --git a/src/main/java/gregtech/api/capability/GregtechDataCodes.java b/src/main/java/gregtech/api/capability/GregtechDataCodes.java index 8a8c0e0d536..049167fbab9 100644 --- a/src/main/java/gregtech/api/capability/GregtechDataCodes.java +++ b/src/main/java/gregtech/api/capability/GregtechDataCodes.java @@ -135,12 +135,19 @@ public class GregtechDataCodes { // HPCA / Research Station public static final int DAMAGE_STATE = 222; public static final int LOCK_OBJECT_HOLDER = 223; + public static final int CACHED_CWU = 224; // NBT Keys // From MetaTileEntityHolder public static final String CUSTOM_NAME = "CustomName"; + // From MetaTileEntity + public static final String TAG_KEY_PAINTING_COLOR = "PaintingColor"; + public static final String TAG_KEY_FRAGILE = "Fragile"; + public static final String TAG_KEY_MUFFLED = "Muffled"; + + // MTE Trait Names public static final String ABSTRACT_WORKABLE_TRAIT = "RecipeMapWorkable"; diff --git a/src/main/java/gregtech/api/capability/IHPCAComponentHatch.java b/src/main/java/gregtech/api/capability/IHPCAComponentHatch.java index c3af93ebd92..617c3e74ea2 100644 --- a/src/main/java/gregtech/api/capability/IHPCAComponentHatch.java +++ b/src/main/java/gregtech/api/capability/IHPCAComponentHatch.java @@ -1,5 +1,7 @@ package gregtech.api.capability; +import gregtech.api.gui.resources.TextureArea; + public interface IHPCAComponentHatch { /** @@ -41,4 +43,9 @@ default void setDamaged(boolean damaged) { * If this component allows for bridging HPCAs to Network Switches. */ boolean isBridge(); + + /** + * The icon for this component in the HPCA's UI. Should be a 13x13 px sprite. + */ + TextureArea getComponentIcon(); } diff --git a/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java index 3decada9148..a9bda2de29d 100644 --- a/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java @@ -139,8 +139,7 @@ protected void updateRecipeProgress() { FluidStack drainedWater = getBoilerFluidFromContainer(getInputTank(), (int) amount); if (amount != 0 && (drainedWater == null || drainedWater.amount < amount)) { - //noinspection IntegerDivisionInFloatingPointContext - getMetaTileEntity().explodeMultiblock((currentHeat / getMaximumHeat()) * 8); + getMetaTileEntity().explodeMultiblock((1.0f * currentHeat / getMaximumHeat()) * 8.0f); } else { setLastTickSteam(generatedSteam); getOutputTank().fill(Materials.Steam.getFluid(generatedSteam), true); diff --git a/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java b/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java index cb029f7bf0a..5f1a92a70b6 100644 --- a/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java +++ b/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java @@ -100,6 +100,10 @@ private boolean acquireNewFluid() { return this.veinFluid != null; } + public Fluid getDrilledFluid() { + return veinFluid; + } + protected void depleteVein() { int chance = metaTileEntity.getDepletionChance(); @@ -108,7 +112,7 @@ protected void depleteVein() { BedrockFluidVeinHandler.depleteVein(metaTileEntity.getWorld(), getChunkX(), getChunkZ(), 0, false); } - private int getFluidToProduce() { + public int getFluidToProduce() { int depletedYield = BedrockFluidVeinHandler.getDepletedFluidYield(metaTileEntity.getWorld(), getChunkX(), getChunkZ()); int regularYield = BedrockFluidVeinHandler.getFluidYield(metaTileEntity.getWorld(), getChunkX(), getChunkZ()); int remainingOperations = BedrockFluidVeinHandler.getOperationsRemaining(metaTileEntity.getWorld(), getChunkX(), getChunkZ()); @@ -157,11 +161,11 @@ protected boolean checkCanDrain() { return false; } - private int getChunkX() { + public int getChunkX() { return metaTileEntity.getPos().getX() / 16; } - private int getChunkZ() { + public int getChunkZ() { return metaTileEntity.getPos().getZ() / 16; } diff --git a/src/main/java/gregtech/api/gui/GuiTextures.java b/src/main/java/gregtech/api/gui/GuiTextures.java index 02a8400adfd..beb43e2e14e 100644 --- a/src/main/java/gregtech/api/gui/GuiTextures.java +++ b/src/main/java/gregtech/api/gui/GuiTextures.java @@ -23,6 +23,7 @@ public class GuiTextures { public static final TextureArea CLIPBOARD_PAPER_BACKGROUND = TextureArea.fullImage("textures/gui/base/clipboard_paper_background.png"); public static final TextureArea BLANK = AdoptableTextureArea.fullImage("textures/gui/base/blank.png", 1, 1, 0, 0); + public static final TextureArea BLANK_TRANSPARENT = AdoptableTextureArea.fullImage("textures/gui/base/blank_transparent.png", 1, 1, 0, 0); public static final TextureArea DISPLAY = AdoptableTextureArea.fullImage("textures/gui/base/display.png", 143, 75, 2, 2); public static final SteamTexture DISPLAY_STEAM = SteamTexture.fullImage("textures/gui/base/display_%s.png", 143, 75, 2, 2); public static final TextureArea FLUID_SLOT = AdoptableTextureArea.fullImage("textures/gui/base/fluid_slot.png", 18, 18, 1, 1); @@ -225,6 +226,22 @@ public class GuiTextures { public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_1 = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_research_station_1.png"); public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_2 = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_research_station_2.png"); public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_BASE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_research_station_base.png"); + public static final TextureArea PROGRESS_BAR_FUSION_ENERGY = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_fusion_energy.png"); + public static final TextureArea PROGRESS_BAR_FUSION_HEAT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_fusion_heat.png"); + public static final TextureArea PROGRESS_BAR_MULTI_ENERGY_YELLOW = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_multi_energy_yellow.png"); + public static final TextureArea PROGRESS_BAR_HPCA_COMPUTATION = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_hpca_computation.png"); + public static final TextureArea PROGRESS_BAR_LCE_FUEL = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_lce_fuel.png"); + public static final TextureArea PROGRESS_BAR_LCE_LUBRICANT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_lce_lubricant.png"); + public static final TextureArea PROGRESS_BAR_LCE_OXYGEN = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_lce_oxygen.png"); + public static final TextureArea PROGRESS_BAR_TURBINE_ROTOR_SPEED = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_turbine_rotor_speed.png"); + public static final TextureArea PROGRESS_BAR_TURBINE_ROTOR_DURABILITY = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_turbine_rotor_durability.png"); + public static final TextureArea PROGRESS_BAR_FLUID_RIG_DEPLETION = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_fluid_rig_depletion.png"); + + // Fusion reactor diagram progress bar parts + public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BL = TextureArea.fullImage("textures/gui/progress_bar/fusion_diagram/bottom_left.png"); + public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BR = TextureArea.fullImage("textures/gui/progress_bar/fusion_diagram/bottom_right.png"); + public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_TL = TextureArea.fullImage("textures/gui/progress_bar/fusion_diagram/top_left.png"); + public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_TR = TextureArea.fullImage("textures/gui/progress_bar/fusion_diagram/top_right.png"); //JEI public static final TextureArea INFO_ICON = TextureArea.fullImage("textures/gui/widget/information.png"); @@ -282,4 +299,21 @@ public class GuiTextures { public static final TextureArea CONFIG_ARROW_DARK = TextureArea.fullImage("textures/gui/widget/config_arrow_dark.png"); public static final TextureArea SELECT_BOX = TextureArea.fullImage("textures/gui/widget/select_box.png"); + // Fusion Reactor custom images + public static final TextureArea FUSION_REACTOR_MK1_TITLE = TextureArea.fullImage("textures/gui/widget/fusion_reactor_mk1_title.png"); + public static final TextureArea FUSION_REACTOR_MK2_TITLE = TextureArea.fullImage("textures/gui/widget/fusion_reactor_mk2_title.png"); + public static final TextureArea FUSION_REACTOR_MK3_TITLE = TextureArea.fullImage("textures/gui/widget/fusion_reactor_mk3_title.png"); + public static final TextureArea FUSION_REACTOR_DIAGRAM = TextureArea.fullImage("textures/gui/widget/fusion_reactor_diagram.png"); + public static final TextureArea FUSION_REACTOR_LEGEND = TextureArea.fullImage("textures/gui/widget/fusion_reactor_legend.png"); + + // HPCA Component icons + public static final TextureArea HPCA_COMPONENT_OUTLINE = TextureArea.fullImage("textures/gui/widget/hpca/component_outline.png"); + public static final TextureArea HPCA_ICON_EMPTY_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/empty_component.png"); + public static final TextureArea HPCA_ICON_ADVANCED_COMPUTATION_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/advanced_computation_component.png"); + public static final TextureArea HPCA_ICON_BRIDGE_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/bridge_component.png"); + public static final TextureArea HPCA_ICON_COMPUTATION_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/computation_component.png"); + public static final TextureArea HPCA_ICON_ACTIVE_COOLER_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/active_cooler_component.png"); + public static final TextureArea HPCA_ICON_HEAT_SINK_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/heat_sink_component.png"); + public static final TextureArea HPCA_ICON_DAMAGED_ADVANCED_COMPUTATION_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/damaged_advanced_computation_component.png"); + public static final TextureArea HPCA_ICON_DAMAGED_COMPUTATION_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/damaged_computation_component.png"); } diff --git a/src/main/java/gregtech/api/gui/widgets/ImageWidget.java b/src/main/java/gregtech/api/gui/widgets/ImageWidget.java index c07a0dea2ef..7950da9568c 100644 --- a/src/main/java/gregtech/api/gui/widgets/ImageWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/ImageWidget.java @@ -64,8 +64,13 @@ public ImageWidget setIgnoreColor(boolean ignore) { return this; } + protected IGuiTexture getArea() { + return area; + } + @Override public void updateScreen() { + IGuiTexture area = getArea(); if (area != null) { area.updateTick(); } @@ -91,6 +96,7 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { @Override @SideOnly(Side.CLIENT) public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { + IGuiTexture area = getArea(); if (!this.isVisible || area == null) return; if (ignoreColor) GlStateManager.color(1, 1, 1, 1); Position position = getPosition(); @@ -103,6 +109,7 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender @Override public void drawInForeground(int mouseX, int mouseY) { + IGuiTexture area = getArea(); if (this.isVisible && tooltipText != null && area != null && isMouseOverElement(mouseX, mouseY)) { List hoverList = Arrays.asList(LocalizationUtils.formatLines(tooltipText)); drawHoveringText(ItemStack.EMPTY, hoverList, 300, mouseX, mouseY); diff --git a/src/main/java/gregtech/api/gui/widgets/ProgressWidget.java b/src/main/java/gregtech/api/gui/widgets/ProgressWidget.java index 7ed4e1682a5..ec13e57dc44 100644 --- a/src/main/java/gregtech/api/gui/widgets/ProgressWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/ProgressWidget.java @@ -6,8 +6,15 @@ import gregtech.api.util.Position; import gregtech.api.util.Size; import gregtech.common.ConfigHolder; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; +import net.minecraft.util.text.ITextComponent; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.function.Consumer; import java.util.function.DoubleSupplier; public class ProgressWidget extends Widget { @@ -22,7 +29,9 @@ public enum MoveType { /** Fills the progress bar clockwise in a circle, starting from the bottom left */ CIRCULAR, /** Fills the progress bar downwards, from the top */ - VERTICAL_DOWNWARDS + VERTICAL_DOWNWARDS, + /** Fills the progress bar right to left */ + HORIZONTAL_BACKWARDS } public final DoubleSupplier progressSupplier; @@ -32,6 +41,10 @@ public enum MoveType { private double lastProgressValue; + private List hoverText = new ArrayList<>(); + private Consumer> textSupplier; + private boolean ignoreColor; + // TODO Clean up these constructors when Steam Machine UIs are cleaned up public ProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height) { super(new Position(x, y), new Size(width, height)); @@ -74,10 +87,21 @@ public ProgressWidget setProgressBar(TextureArea emptyBarArea, TextureArea fille return this; } + public ProgressWidget setHoverTextConsumer(Consumer> supplier) { + this.textSupplier = supplier; + return this; + } + + public ProgressWidget setIgnoreColor(boolean ignore) { + this.ignoreColor = ignore; + return this; + } + @Override public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { Position pos = getPosition(); Size size = getSize(); + if (ignoreColor) GlStateManager.color(1, 1, 1, 1); if (emptyBarArea != null) { emptyBarArea.draw(pos.x, pos.y, size.width, size.height); } @@ -96,6 +120,19 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender 0.0, drawnWidth, 1.0); + } else if (moveType == MoveType.HORIZONTAL_BACKWARDS) { + double width = size.width * lastProgressValue; + if (!smooth) width = (int) width; + double drawnWidth = smooth ? lastProgressValue : width / (size.width * 1.0); + filledBarArea[0].drawSubArea( + pos.x + size.width - width, + pos.y, + width, + size.height, + 1.0 - drawnWidth, + 0.0, + drawnWidth, + 1.0); } else if (moveType == MoveType.VERTICAL) { double height = size.height * lastProgressValue; if (!smooth) height = (int) height; @@ -217,12 +254,47 @@ public void detectAndSendChanges() { this.lastProgressValue = actualValue; writeUpdateInfo(0, buffer -> buffer.writeDouble(actualValue)); } + + if (textSupplier != null) { + List textBuffer = new ArrayList<>(); + textSupplier.accept(textBuffer); + if (!hoverText.equals(textBuffer)) { + this.hoverText = textBuffer; + writeUpdateInfo(1, buffer -> { + buffer.writeVarInt(hoverText.size()); + for (ITextComponent textComponent : hoverText) { + buffer.writeString(ITextComponent.Serializer.componentToJson(textComponent)); + } + }); + } + } } @Override public void readUpdateInfo(int id, PacketBuffer buffer) { if (id == 0) { this.lastProgressValue = buffer.readDouble(); + } else if (id == 1) { + this.hoverText.clear(); + int count = buffer.readVarInt(); + for (int i = 0; i < count; i++) { + String jsonText = buffer.readString(32767); + this.hoverText.add(ITextComponent.Serializer.jsonToComponent(jsonText)); + } + } + } + + @Override + public void drawInForeground(int mouseX, int mouseY) { + super.drawInForeground(mouseX, mouseY); + if (isMouseOverElement(mouseX, mouseY) && hoverText != null && !hoverText.isEmpty()) { + List hoverList = new ArrayList<>(); + for (ITextComponent component : hoverText) { + Collections.addAll(hoverList, component.getFormattedText()); + } + if (!hoverList.isEmpty()) { + drawHoveringText(ItemStack.EMPTY, hoverList, 300, mouseX, mouseY); + } } } @@ -231,7 +303,7 @@ public static class TimedProgressSupplier implements DoubleSupplier { private final int msPerCycle; private final int maxValue; private final boolean countDown; - private final long startTime; + private long startTime; public TimedProgressSupplier(int ticksPerCycle, int maxValue, boolean countDown) { this.msPerCycle = ticksPerCycle * 50; @@ -240,6 +312,10 @@ public TimedProgressSupplier(int ticksPerCycle, int maxValue, boolean countDown) this.startTime = System.currentTimeMillis(); } + public void resetCountdown() { + startTime = System.currentTimeMillis(); + } + @Override public double getAsDouble() { return calculateTime(); diff --git a/src/main/java/gregtech/api/gui/widgets/RecipeProgressWidget.java b/src/main/java/gregtech/api/gui/widgets/RecipeProgressWidget.java index 1a5f817d965..485ed4f44be 100644 --- a/src/main/java/gregtech/api/gui/widgets/RecipeProgressWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/RecipeProgressWidget.java @@ -1,6 +1,5 @@ package gregtech.api.gui.widgets; -import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.gui.resources.TextureArea; import gregtech.api.recipes.RecipeMap; @@ -9,35 +8,33 @@ import gregtech.integration.jei.JustEnoughItemsModule; import gregtech.integration.jei.recipe.RecipeMapCategory; import gregtech.modules.GregTechModules; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.common.Loader; +import net.minecraft.util.text.TextComponentTranslation; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.List; import java.util.function.DoubleSupplier; public class RecipeProgressWidget extends ProgressWidget { private final RecipeMap recipeMap; - private static final int HOVER_TEXT_WIDTH = 200; public RecipeProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height, RecipeMap recipeMap) { super(progressSupplier, x, y, width, height); this.recipeMap = recipeMap; + setHoverTextConsumer(list -> list.add(new TextComponentTranslation("gui.widget.recipeProgressWidget.default_tooltip"))); } public RecipeProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height, TextureArea fullImage, MoveType moveType, RecipeMap recipeMap) { super(progressSupplier, x, y, width, height, fullImage, moveType); this.recipeMap = recipeMap; + setHoverTextConsumer(list -> list.add(new TextComponentTranslation("gui.widget.recipeProgressWidget.default_tooltip"))); } public RecipeProgressWidget(int ticksPerCycle, int x, int y, int width, int height, TextureArea fullImage, MoveType moveType, RecipeMap recipeMap) { super(ticksPerCycle, x, y, width, height, fullImage, moveType); this.recipeMap = recipeMap; + setHoverTextConsumer(list -> list.add(new TextComponentTranslation("gui.widget.recipeProgressWidget.default_tooltip"))); } @Override @@ -68,17 +65,4 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { } return false; } - - - @Override - public void drawInForeground(int mouseX, int mouseY) { - super.drawInForeground(mouseX, mouseY); - if (isMouseOverElement(mouseX, mouseY) && Loader.isModLoaded(GTValues.MODID_JEI)) { - Minecraft mc = Minecraft.getMinecraft(); - GuiUtils.drawHoveringText(Collections.singletonList(I18n.format("gui.widget.recipeProgressWidget.default_tooltip")), mouseX, mouseY, - sizes.getScreenWidth(), - sizes.getScreenHeight(), HOVER_TEXT_WIDTH, mc.fontRenderer); - } - } - } diff --git a/src/main/java/gregtech/api/gui/widgets/SuppliedImageWidget.java b/src/main/java/gregtech/api/gui/widgets/SuppliedImageWidget.java new file mode 100644 index 00000000000..834a519ee20 --- /dev/null +++ b/src/main/java/gregtech/api/gui/widgets/SuppliedImageWidget.java @@ -0,0 +1,20 @@ +package gregtech.api.gui.widgets; + +import gregtech.api.gui.resources.IGuiTexture; + +import java.util.function.Supplier; + +public class SuppliedImageWidget extends ImageWidget { + + private final Supplier areaSupplier; + + public SuppliedImageWidget(int xPosition, int yPosition, int width, int height, Supplier areaSupplier) { + super(xPosition, yPosition, width, height); + this.areaSupplier = areaSupplier; + } + + @Override + protected IGuiTexture getArea() { + return areaSupplier.get(); + } +} diff --git a/src/main/java/gregtech/api/items/OreDictNames.java b/src/main/java/gregtech/api/items/OreDictNames.java index 20fa0db39cb..488d5bc2078 100644 --- a/src/main/java/gregtech/api/items/OreDictNames.java +++ b/src/main/java/gregtech/api/items/OreDictNames.java @@ -6,9 +6,11 @@ public enum OreDictNames { string, chestWood, chestEnder, + fenceWood, cobblestone, // For just cobblestone. stoneCobble, // For any kind of cobblestone (e.g. mossy cobblestone). + stoneBricks, // For any kind of stone bricks craftingAnvil, craftingFurnace, diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 1c0f4059848..440b3bda6d4 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -75,6 +75,7 @@ import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -90,9 +91,6 @@ public abstract class MetaTileEntity implements ICoverable, IVoidable { public static final IndexedCuboid6 FULL_CUBE_COLLISION = new IndexedCuboid6(null, Cuboid6.full); - public static final String TAG_KEY_PAINTING_COLOR = "PaintingColor"; - public static final String TAG_KEY_FRAGILE = "Fragile"; - public static final String TAG_KEY_MUFFLED = "Muffled"; public final ResourceLocation metaTileEntityId; IGregTechTileEntity holder; @@ -1264,6 +1262,10 @@ public static void clearInventory(NonNullList itemBuffer, IItemHandle } } + public int getItemStackLimit(ItemStack stack) { + return 64; + } + /** * Called whenever a MetaTileEntity is placed in world by {@link Block#onBlockPlacedBy} *

@@ -1297,7 +1299,7 @@ public boolean isActive() { return false; } - public EnumFacing getFrontFacing() { + public @NotNull EnumFacing getFrontFacing() { return frontFacing; } diff --git a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java index 8892d94d709..fc165b64c1b 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java @@ -116,10 +116,14 @@ protected ModularUI.Builder createGuiTemplate(EntityPlayer player) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - this.renderer.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), workable.isActive(), workable.isWorkingEnabled()); + renderOverlays(renderState, translation, pipeline); Textures.ENERGY_OUT.renderSided(getFrontFacing(), renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])); } + protected void renderOverlays(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { + this.renderer.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), workable.isActive(), workable.isWorkingEnabled()); + } + @Override protected ModularUI createUI(EntityPlayer entityPlayer) { return createGuiTemplate(entityPlayer).build(getHolder(), entityPlayer); diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java index 94018b811fa..948eb95fcf5 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java @@ -2,10 +2,12 @@ import gregtech.api.GTValues; import gregtech.api.capability.IEnergyContainer; +import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.capability.impl.EnergyContainerList; import gregtech.api.capability.impl.MultiblockFuelRecipeLogic; import gregtech.api.recipes.RecipeMap; import gregtech.api.util.GTUtility; +import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; import gregtech.common.ConfigHolder; import net.minecraft.util.ResourceLocation; @@ -13,7 +15,6 @@ import net.minecraft.util.text.Style; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.event.HoverEvent; import net.minecraftforge.fluids.FluidStack; import javax.annotation.Nonnull; @@ -36,42 +37,13 @@ protected void initializeAbilities() { @Override protected void addDisplayText(List textList) { - if (!isStructureFormed()) { - ITextComponent tooltip = new TextComponentTranslation("gregtech.multiblock.invalid_structure.tooltip"); - tooltip.setStyle(new Style().setColor(TextFormatting.GRAY)); - textList.add(new TextComponentTranslation("gregtech.multiblock.invalid_structure") - .setStyle(new Style().setColor(TextFormatting.RED) - .setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)))); - } else { - - FluidStack fuelStack = ((MultiblockFuelRecipeLogic) recipeMapWorkable).getInputFluidStack(); - if (fuelStack != null && fuelStack.amount > 0) { - textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.fuel_amount", TextFormattingUtil.formatNumbers(fuelStack.amount), fuelStack.getLocalizedName())); - } - - String fluidName = ((MultiblockFuelRecipeLogic) recipeMapWorkable).getRecipeFluidInputInfo(); - if (fluidName != null && isActive()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.fuel_needed", - fluidName, TextFormatting.AQUA + TextFormattingUtil.formatNumbers(recipeMapWorkable.getPreviousRecipeDuration()))); - } - + MultiblockFuelRecipeLogic recipeLogic = (MultiblockFuelRecipeLogic) recipeMapWorkable; - long maxVoltage = getMaxVoltage(); - if (maxVoltage != 0 && maxVoltage >= -recipeMapWorkable.getRecipeEUt()) { - String voltageName = GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]; - textList.add(new TextComponentTranslation("gregtech.multiblock.max_energy_per_tick", TextFormattingUtil.formatNumbers(maxVoltage), voltageName)); - } - - if (!recipeMapWorkable.isWorkingEnabled()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.work_paused")); - } else if (recipeMapWorkable.isActive()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.running")); - int currentProgress = (int) (recipeMapWorkable.getProgressPercent() * 100); - textList.add(new TextComponentTranslation("gregtech.multiblock.progress", currentProgress)); - } else { - textList.add(new TextComponentTranslation("gregtech.multiblock.idling")); - } - } + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(recipeLogic.isWorkingEnabled(), recipeLogic.isActive()) + .addEnergyProductionLine(getMaxVoltage(), recipeLogic.getRecipeEUt()) + .addFuelNeededLine(recipeLogic.getRecipeFluidInputInfo(), recipeLogic.getPreviousRecipeDuration()) + .addWorkingStatusLine(); } protected long getMaxVoltage() { @@ -85,16 +57,20 @@ protected long getMaxVoltage() { @Override protected void addWarningText(List textList) { - super.addWarningText(textList); + MultiblockDisplayText.builder(textList, isStructureFormed(), false) + .addLowDynamoTierLine(isDynamoTierTooLow()) + .addMaintenanceProblemLines(getMaintenanceProblems()); + } + + protected boolean isDynamoTierTooLow() { if (isStructureFormed()) { IEnergyContainer energyContainer = recipeMapWorkable.getEnergyContainer(); if (energyContainer != null && energyContainer.getEnergyCapacity() > 0) { long maxVoltage = Math.max(energyContainer.getInputVoltage(), energyContainer.getOutputVoltage()); - if (maxVoltage < -recipeMapWorkable.getRecipeEUt()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.not_enough_energy_output")); - } + return maxVoltage < -recipeMapWorkable.getRecipeEUt(); } } + return false; } @Nonnull @@ -133,4 +109,51 @@ public List getDataInfo() { return list; } + + protected int[] getTotalFluidAmount(FluidStack testStack, IMultipleTankHandler multiTank) { + int fluidAmount = 0; + int fluidCapacity = 0; + for (var tank : multiTank) { + if (tank != null) { + FluidStack drainStack = tank.drain(testStack, false); + if (drainStack != null && drainStack.amount > 0) { + fluidAmount += drainStack.amount; + fluidCapacity += tank.getCapacity(); + } + } + } + return new int[]{fluidAmount, fluidCapacity}; + } + + protected void addFuelText(List textList) { + // Fuel + int fuelStored = 0; + int fuelCapacity = 0; + FluidStack fuelStack = null; + MultiblockFuelRecipeLogic recipeLogic = (MultiblockFuelRecipeLogic) recipeMapWorkable; + if (isStructureFormed() && recipeLogic.getInputFluidStack() != null && getInputFluidInventory() != null) { + fuelStack = recipeLogic.getInputFluidStack().copy(); + fuelStack.amount = Integer.MAX_VALUE; + int[] fuelAmount = getTotalFluidAmount(fuelStack, getInputFluidInventory()); + fuelStored = fuelAmount[0]; + fuelCapacity = fuelAmount[1]; + } + + if (fuelStack != null) { + ITextComponent fuelName = TextComponentUtil.translationWithColor(TextFormatting.GOLD, fuelStack.getUnlocalizedName()); + ITextComponent fuelInfo = new TextComponentTranslation("%s / %s L (%s)", + TextFormattingUtil.formatNumbers(fuelStored), + TextFormattingUtil.formatNumbers(fuelCapacity), + fuelName); + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.large_combustion_engine.fuel_amount", + TextComponentUtil.setColor(fuelInfo, TextFormatting.GOLD))); + } else { + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.large_combustion_engine.fuel_amount", + "0 / 0 L")); + } + } } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/IProgressBarMultiblock.java b/src/main/java/gregtech/api/metatileentity/multiblock/IProgressBarMultiblock.java new file mode 100644 index 00000000000..8a8a0e7ea8e --- /dev/null +++ b/src/main/java/gregtech/api/metatileentity/multiblock/IProgressBarMultiblock.java @@ -0,0 +1,35 @@ +package gregtech.api.metatileentity.multiblock; + +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.resources.TextureArea; +import net.minecraft.util.text.ITextComponent; + +import java.util.List; + +public interface IProgressBarMultiblock { + + default boolean showProgressBar() { + return true; + } + + /** Can optionally have two progress bars side-by-side. Can support up to 3 bars. Any other values will default to 1. */ + default int getNumProgressBars() { + return 1; + } + + /** Fill percentages, formatted as a double from [0, 1] of the progress bar(s). */ + double getFillPercentage(int index); + + /** Textures for the progress bar(s). */ + default TextureArea getProgressBarTexture(int index) { + return GuiTextures.PROGRESS_BAR_MULTI_ENERGY_YELLOW; + } + + /** + * Add hover text to your progress bar(s). + * + * @param index The index, 0, 1, or 2, of your progress bar. Only relevant if you have multiple bars. + */ + default void addBarHoverText(List hoverList, int index) { + } +} diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockDisplayText.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockDisplayText.java new file mode 100644 index 00000000000..89dbefb0111 --- /dev/null +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockDisplayText.java @@ -0,0 +1,438 @@ +package gregtech.api.metatileentity.multiblock; + +import gregtech.api.GTValues; +import gregtech.api.capability.IEnergyContainer; +import gregtech.api.util.GTUtility; +import gregtech.api.util.TextComponentUtil; +import gregtech.api.util.TextFormattingUtil; +import gregtech.common.ConfigHolder; +import net.minecraft.util.text.*; + +import java.util.List; +import java.util.function.Consumer; + +public class MultiblockDisplayText { + + private static final ITextComponent EMPTY_COMPONENT = new TextComponentString(""); + + /** + * Construct a new Multiblock Display Text builder. + *
+ * Automatically adds the "Invalid Structure" line if the structure is not formed. + */ + public static Builder builder(List textList, boolean isStructureFormed) { + return builder(textList, isStructureFormed, true); + } + + public static Builder builder(List textList, boolean isStructureFormed, boolean showIncompleteStructureWarning) { + return new Builder(textList, isStructureFormed, showIncompleteStructureWarning); + } + + public static class Builder { + + private final List textList; + private final boolean isStructureFormed; + + private boolean isWorkingEnabled, isActive; + + // Keys for the three-state working system, can be set custom by multiblocks. + private String idlingKey = "gregtech.multiblock.idling"; + private String pausedKey = "gregtech.multiblock.work_paused"; + private String runningKey = "gregtech.multiblock.running"; + + private Builder(List textList, boolean isStructureFormed, boolean showIncompleteStructureWarning) { + this.textList = textList; + this.isStructureFormed = isStructureFormed; + + if (!isStructureFormed && showIncompleteStructureWarning) { + ITextComponent base = TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.invalid_structure"); + ITextComponent hover = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.invalid_structure.tooltip"); + textList.add(TextComponentUtil.setHover(base, hover)); + } + } + + /** Set the current working enabled and active status of this multiblock, used by many line addition calls. */ + public Builder setWorkingStatus(boolean isWorkingEnabled, boolean isActive) { + this.isWorkingEnabled = isWorkingEnabled; + this.isActive = isActive; + return this; + } + + /** + * Set custom translation keys for the three-state "Idling", "Paused", "Running" display text. + * You still must call {@link Builder#addWorkingStatusLine()} for these to appear! + *
+ * Pass any key as null for it to continue to use the default key. + * + * @param idlingKey The translation key for the Idle state, or "!isActive && isWorkingEnabled". + * @param pausedKey The translation key for the Paused state, or "!isWorkingEnabled". + * @param runningKey The translation key for the Running state, or "isActive". + */ + public Builder setWorkingStatusKeys(String idlingKey, String pausedKey, String runningKey) { + if (idlingKey != null) this.idlingKey = idlingKey; + if (pausedKey != null) this.pausedKey = pausedKey; + if (runningKey != null) this.runningKey = runningKey; + return this; + } + + /** + * Adds the max EU/t that this multiblock can use. + *
+ * Added if the structure is formed and if the passed energy container has greater than zero capacity. + */ + public Builder addEnergyUsageLine(IEnergyContainer energyContainer) { + if (!isStructureFormed) return this; + if (energyContainer != null && energyContainer.getEnergyCapacity() > 0) { + long maxVoltage = Math.max(energyContainer.getInputVoltage(), energyContainer.getOutputVoltage()); + + String energyFormatted = TextFormattingUtil.formatNumbers(maxVoltage); + // wrap in text component to keep it from being formatted + ITextComponent voltageName = new TextComponentString(GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]); + + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.max_energy_per_tick", + energyFormatted, voltageName)); + } + return this; + } + + /** + * Adds the exact EU/t that this multiblock needs to run. + *
+ * Added if the structure is formed and if the passed value is greater than zero. + */ + public Builder addEnergyUsageExactLine(long energyUsage) { + if (!isStructureFormed) return this; + if (energyUsage > 0) { + String energyFormatted = TextFormattingUtil.formatNumbers(energyUsage); + // wrap in text component to keep it from being formatted + ITextComponent voltageName = new TextComponentString(GTValues.VNF[GTUtility.getTierByVoltage(energyUsage)]); + + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.energy_consumption", + energyFormatted, voltageName)); + } + return this; + } + + /** + * Adds the max EU/t that this multiblock can produce. + *
+ * Added if the structure is formed and if the max voltage is greater than zero and the recipe EU/t. + */ + public Builder addEnergyProductionLine(long maxVoltage, long recipeEUt) { + if (!isStructureFormed) return this; + if (maxVoltage != 0 && maxVoltage >= -recipeEUt) { + String energyFormatted = TextFormattingUtil.formatNumbers(maxVoltage); + // wrap in text component to keep it from being formatted + ITextComponent voltageName = new TextComponentString(GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]); + + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.max_energy_per_tick", + energyFormatted, voltageName)); + } + return this; + } + + /** + * Adds the max EU/t that this multiblock can produce, including how many amps. Recommended for multi-amp outputting multis. + *
+ * Added if the structure is formed, if the amperage is greater than zero and if the max voltage is greater than zero. + */ + public Builder addEnergyProductionAmpsLine(long maxVoltage, int amperage) { + if (!isStructureFormed) return this; + if (maxVoltage != 0 && amperage != 0) { + String energyFormatted = TextFormattingUtil.formatNumbers(maxVoltage); + // wrap in text component to keep it from being formatted + ITextComponent voltageName = new TextComponentString(GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]); + + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.max_energy_per_tick_amps", + energyFormatted, amperage, voltageName)); + } + return this; + } + + /** + * Adds the max CWU/t that this multiblock can use. + *
+ * Added if the structure is formed and if the max CWU/t is greater than zero. + */ + public Builder addComputationUsageLine(int maxCWUt) { + if (!isStructureFormed) return this; + if (maxCWUt > 0) { + ITextComponent computation = TextComponentUtil.stringWithColor(TextFormatting.AQUA, TextFormattingUtil.formatNumbers(maxCWUt)); + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.computation.max", + computation)); + } + return this; + } + + /** + * Adds a currently used CWU/t line. + *
+ * Added if the structure is formed, the machine is active, and the current CWU/t is greater than zero. + */ + public Builder addComputationUsageExactLine(int currentCWUt) { + if (!isStructureFormed) return this; + if (isActive && currentCWUt > 0) { + ITextComponent computation = TextComponentUtil.stringWithColor(TextFormatting.AQUA, TextFormattingUtil.formatNumbers(currentCWUt) + " CWU/t"); + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.computation.usage", + computation)); + } + return this; + } + + /** + * Adds a three-state indicator line, showing if the machine is running, paused, or idling. + *
+ * Added if the structure is formed. + */ + public Builder addWorkingStatusLine() { + if (!isStructureFormed) return this; + + if (!isWorkingEnabled) { + return addWorkPausedLine(false); + } else if (isActive) { + return addRunningPerfectlyLine(false); + } else { + return addIdlingLine(false); + } + } + + /** + * Adds the "Work Paused." line. + *
+ * Added if working is not enabled, or if the checkState passed parameter is false. + * Also added only if formed. + */ + public Builder addWorkPausedLine(boolean checkState) { + if (!isStructureFormed) return this; + if (!checkState || !isWorkingEnabled) { + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GOLD, pausedKey)); + } + return this; + } + + /** + * Adds the "Running Perfectly." line. + *
+ * Added if machine is active, or if the checkState passed parameter is false. + * Also added only if formed. + */ + public Builder addRunningPerfectlyLine(boolean checkState) { + if (!isStructureFormed) return this; + if (!checkState || isActive) { + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GREEN, runningKey)); + } + return this; + } + + /** + * Adds the "Idling." line. + *
+ * Added if the machine is not active and working is enabled, or if the checkState passed parameter is false. + * Also added only if formed. + */ + public Builder addIdlingLine(boolean checkState) { + if (!isStructureFormed) return this; + if (!checkState || (isWorkingEnabled && !isActive)) { + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, idlingKey)); + } + return this; + } + + /** + * Adds a simple progress line that displays progress as a percentage. + *
+ * Added if structure is formed and the machine is active. + * + * @param progressPercent Progress formatted as a range of [0,1] representing the progress of the recipe. + */ + public Builder addProgressLine(double progressPercent) { // todo + if (!isStructureFormed || !isActive) return this; + int currentProgress = (int) (progressPercent * 100); + textList.add(new TextComponentTranslation("gregtech.multiblock.progress", currentProgress)); + return this; + } + + /** Adds a line indicating how many parallels this multi can potentially perform. + *
+ * Added if structure is formed and the number of parallels is greater than one. + */ + public Builder addParallelsLine(int numParallels) { + if (!isStructureFormed) return this; + if (numParallels > 1) { + ITextComponent parallels = TextComponentUtil.stringWithColor( + TextFormatting.DARK_PURPLE, + TextFormattingUtil.formatNumbers(numParallels)); + + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.parallel", + parallels)); + } + return this; + } + + /** + * Adds a warning line when the machine is low on power. + *
+ * Added if the structure is formed and if the passed parameter is true. + */ + public Builder addLowPowerLine(boolean isLowPower) { + if (!isStructureFormed) return this; + if (isLowPower) { + textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.not_enough_energy")); + } + return this; + } + + /** + * Adds a warning line when the machine is low on computation. + *
+ * Added if the structure is formed and if the passed parameter is true. + */ + public Builder addLowComputationLine(boolean isLowComputation) { + if (!isStructureFormed) return this; + if (isLowComputation) { + textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.computation.not_enough_computation")); + } + return this; + } + + /** + * Adds a warning line when the machine's dynamo tier is too low for current conditions. + *
+ * Added if the structure is formed and if the passed parameter is true. + */ + public Builder addLowDynamoTierLine(boolean isTooLow) { + if (!isStructureFormed) return this; + if (isTooLow) { + textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.not_enough_energy_output")); + } + return this; + } + + /** + * Adds warning line(s) when the machine has maintenance problems. + *
+ * Added if there are any maintenance problems, one line per problem as well as a header.
+ * Will check the config setting for if maintenance is enabled automatically. + */ + public Builder addMaintenanceProblemLines(byte maintenanceProblems) { + if (!isStructureFormed || !ConfigHolder.machines.enableMaintenance) return this; + if (maintenanceProblems < 63) { + boolean hasAddedHeader = false; + + // Wrench + if ((maintenanceProblems & 1) == 0) { + hasAddedHeader = addMaintenanceProblemHeader(hasAddedHeader); + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.universal.problem.wrench")); + } + + // Screwdriver + if (((maintenanceProblems >> 1) & 1) == 0) { + hasAddedHeader = addMaintenanceProblemHeader(hasAddedHeader); + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.universal.problem.screwdriver")); + } + + // Soft Mallet + if (((maintenanceProblems >> 2) & 1) == 0) { + hasAddedHeader = addMaintenanceProblemHeader(hasAddedHeader); + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.universal.problem.soft_mallet")); + } + + // Hammer + if (((maintenanceProblems >> 3) & 1) == 0) { + hasAddedHeader = addMaintenanceProblemHeader(hasAddedHeader); + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.universal.problem.hard_hammer")); + } + + // Wire Cutters + if (((maintenanceProblems >> 4) & 1) == 0) { + hasAddedHeader = addMaintenanceProblemHeader(hasAddedHeader); + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.universal.problem.wire_cutter")); + } + + // Crowbar + if (((maintenanceProblems >> 5) & 1) == 0) { + addMaintenanceProblemHeader(hasAddedHeader); + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.universal.problem.crowbar")); + } + } + return this; + } + + private boolean addMaintenanceProblemHeader(boolean hasAddedHeader) { + if (!hasAddedHeader) { + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.YELLOW, + "gregtech.multiblock.universal.has_problems")); + } + return true; + } + + /** + * Adds two error lines when the machine's muffler hatch is obstructed. + *
+ * Added if the structure is formed and if the passed parameter is true. + */ + public Builder addMufflerObstructedLine(boolean isObstructed) { + if (!isStructureFormed) return this; + if (isObstructed) { + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.universal.muffler_obstructed")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.universal.muffler_obstructed_desc")); + } + return this; + } + + /** + * Adds a fuel consumption line showing the fuel name and the number of ticks per recipe run. + *
+ * Added if structure is formed, the machine is active, and the passed fuelName parameter is not null. + */ + public Builder addFuelNeededLine(String fuelName, int previousRecipeDuration) { + if (!isStructureFormed || !isActive) return this; + ITextComponent fuelNeeded = TextComponentUtil.stringWithColor(TextFormatting.RED, fuelName); + ITextComponent numTicks = TextComponentUtil.stringWithColor(TextFormatting.AQUA, TextFormattingUtil.formatNumbers(previousRecipeDuration)); + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.turbine.fuel_needed", + fuelNeeded, numTicks)); + return this; + } + + /** Insert an empty line into the text list. */ + public Builder addEmptyLine() { + textList.add(EMPTY_COMPONENT); + return this; + } + + /** Add custom text dynamically, allowing for custom application logic. */ + public Builder addCustom(Consumer> customConsumer) { + customConsumer.accept(textList); + return this; + } + } +} diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java index b37401d19d2..f036a3cc08e 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java @@ -12,6 +12,7 @@ import gregtech.api.gui.widgets.ImageCycleButtonWidget; import gregtech.api.gui.widgets.ImageWidget; import gregtech.api.gui.widgets.IndicatorImageWidget; +import gregtech.api.gui.widgets.ProgressWidget; import gregtech.api.pattern.PatternMatchContext; import gregtech.api.pattern.TraceabilityPredicate; import gregtech.api.unification.OreDictUnifier; @@ -25,11 +26,6 @@ import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextComponentTranslation; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.event.HoverEvent; -import net.minecraft.util.text.event.HoverEvent.Action; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fluids.capability.IFluidHandler; @@ -109,7 +105,7 @@ public void causeMaintenanceProblems() { */ @Override public byte getMaintenanceProblems() { - return ConfigHolder.machines.enableMaintenance ? maintenance_problems : 0b111111; + return ConfigHolder.machines.enableMaintenance && hasMaintenanceMechanics() ? maintenance_problems : 0b111111; } /** @@ -117,7 +113,7 @@ public byte getMaintenanceProblems() { */ @Override public int getNumMaintenanceProblems() { - return ConfigHolder.machines.enableMaintenance ? 6 - Integer.bitCount(maintenance_problems) : 0; + return ConfigHolder.machines.enableMaintenance && hasMaintenanceMechanics() ? 6 - Integer.bitCount(maintenance_problems) : 0; } /** @@ -125,7 +121,7 @@ public int getNumMaintenanceProblems() { */ @Override public boolean hasMaintenanceProblems() { - return ConfigHolder.machines.enableMaintenance && this.maintenance_problems < 63; + return ConfigHolder.machines.enableMaintenance && hasMaintenanceMechanics() && this.maintenance_problems < 63; } /** @@ -353,39 +349,7 @@ protected TraceabilityPredicate maintenancePredicate() { * to use translation, use TextComponentTranslation */ protected void addDisplayText(List textList) { - if (!isStructureFormed()) { - ITextComponent tooltip = new TextComponentTranslation("gregtech.multiblock.invalid_structure.tooltip"); - tooltip.setStyle(new Style().setColor(TextFormatting.GRAY)); - textList.add(new TextComponentTranslation("gregtech.multiblock.invalid_structure") - .setStyle(new Style().setColor(TextFormatting.RED) - .setHoverEvent(new HoverEvent(Action.SHOW_TEXT, tooltip)))); - } - } - - protected void addMaintenanceText(List textList) { - if (hasMaintenanceProblems()) { - ITextComponent hoverEventTranslation = new TextComponentTranslation("gregtech.multiblock.universal.has_problems"); - - if (((this.maintenance_problems) & 1) == 0) - hoverEventTranslation.appendSibling(new TextComponentTranslation("gregtech.multiblock.universal.problem.wrench", "\n")); - - if (((this.maintenance_problems >> 1) & 1) == 0) - hoverEventTranslation.appendSibling(new TextComponentTranslation("gregtech.multiblock.universal.problem.screwdriver", "\n")); - - if (((this.maintenance_problems >> 2) & 1) == 0) - hoverEventTranslation.appendSibling(new TextComponentTranslation("gregtech.multiblock.universal.problem.soft_mallet", "\n")); - - if (((this.maintenance_problems >> 3) & 1) == 0) - hoverEventTranslation.appendSibling(new TextComponentTranslation("gregtech.multiblock.universal.problem.hard_hammer", "\n")); - - if (((this.maintenance_problems >> 4) & 1) == 0) - hoverEventTranslation.appendSibling(new TextComponentTranslation("gregtech.multiblock.universal.problem.wire_cutter", "\n")); - - if (((this.maintenance_problems >> 5) & 1) == 0) - hoverEventTranslation.appendSibling(new TextComponentTranslation("gregtech.multiblock.universal.problem.crowbar", "\n")); - - textList.add(hoverEventTranslation.setStyle(new Style().setColor(TextFormatting.RED))); - } + MultiblockDisplayText.builder(textList, isStructureFormed()); } /** @@ -400,7 +364,65 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 198, 208); // Display - builder.image(4, 4, 190, 117, GuiTextures.DISPLAY); + if (this instanceof IProgressBarMultiblock progressMulti && progressMulti.showProgressBar()) { + builder.image(4, 4, 190, 109, GuiTextures.DISPLAY); + + if (progressMulti.getNumProgressBars() == 3) { + // triple bar + ProgressWidget progressBar = new ProgressWidget( + () -> progressMulti.getFillPercentage(0), + 4, 115, 62, 7, + progressMulti.getProgressBarTexture(0), ProgressWidget.MoveType.HORIZONTAL) + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 0)); + builder.widget(progressBar); + + progressBar = new ProgressWidget( + () -> progressMulti.getFillPercentage(1), + 68, 115, 62, 7, + progressMulti.getProgressBarTexture(1), ProgressWidget.MoveType.HORIZONTAL) + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 1)); + builder.widget(progressBar); + + progressBar = new ProgressWidget( + () -> progressMulti.getFillPercentage(2), + 132, 115, 62, 7, + progressMulti.getProgressBarTexture(2), ProgressWidget.MoveType.HORIZONTAL) + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 2)); + builder.widget(progressBar); + } else if (progressMulti.getNumProgressBars() == 2) { + // double bar + ProgressWidget progressBar = new ProgressWidget( + () -> progressMulti.getFillPercentage(0), + 4, 115, 94, 7, + progressMulti.getProgressBarTexture(0), ProgressWidget.MoveType.HORIZONTAL) + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 0)); + builder.widget(progressBar); + + progressBar = new ProgressWidget( + () -> progressMulti.getFillPercentage(1), + 100, 115, 94, 7, + progressMulti.getProgressBarTexture(1), ProgressWidget.MoveType.HORIZONTAL) + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 1)); + builder.widget(progressBar); + } else { + // single bar + ProgressWidget progressBar = new ProgressWidget( + () -> progressMulti.getFillPercentage(0), + 4, 115, 190, 7, + progressMulti.getProgressBarTexture(0), ProgressWidget.MoveType.HORIZONTAL) + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 0)); + builder.widget(progressBar); + } + builder.widget(new IndicatorImageWidget(174, 93, 17, 17, getLogo()) + .setWarningStatus(getWarningLogo(), this::addWarningText) + .setErrorStatus(getErrorLogo(), this::addErrorText)); + } else { + builder.image(4, 4, 190, 117, GuiTextures.DISPLAY); + builder.widget(new IndicatorImageWidget(174, 101, 17, 17, getLogo()) + .setWarningStatus(getWarningLogo(), this::addWarningText) + .setErrorStatus(getErrorLogo(), this::addErrorText)); + } + builder.label(9, 9, getMetaFullName(), 0xFFFFFF); builder.widget(new AdvancedTextWidget(9, 20, this::addDisplayText, 0xFFFFFF) .setMaxWidthLimit(181) @@ -435,12 +457,7 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { } // Flex Button - builder.widget(getFlexButton(173, 124, 18, 18)); - - // Logo / Indicator Widget - builder.widget(new IndicatorImageWidget(174, 101, 17, 17, getLogo()) - .setWarningStatus(getWarningLogo(), this::addWarningText) - .setErrorStatus(getErrorLogo(), this::addErrorText)); + builder.widget(getFlexButton(173, 125, 18, 18)); builder.bindPlayerInventory(entityPlayer.inventory, 125); return builder; @@ -476,11 +493,8 @@ protected Widget getFlexButton(int x, int y, int width, int height) { * Recommended to only display warnings if the structure is already formed. */ protected void addWarningText(List textList) { - if (isStructureFormed()) { - if (hasMaintenanceMechanics() && ConfigHolder.machines.enableMaintenance) { - addMaintenanceText(textList); - } - } + MultiblockDisplayText.builder(textList, isStructureFormed(), false) + .addMaintenanceProblemLines(getMaintenanceProblems()); } /** @@ -488,14 +502,8 @@ protected void addWarningText(List textList) { * Prioritized over any warnings provided by {@link MultiblockWithDisplayBase#addWarningText}. */ protected void addErrorText(List textList) { - if (!isStructureFormed()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.invalid_structure") - .setStyle(new Style().setColor(TextFormatting.RED))); - } else { - if (hasMufflerMechanics() && !isMufflerFaceFree()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.universal.muffler_obstructed")); - } - } + MultiblockDisplayText.builder(textList, isStructureFormed()) + .addMufflerObstructedLine(hasMufflerMechanics() && !isMufflerFaceFree()); } protected boolean shouldShowVoidingModeButton() { diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java index b6dfaadbea4..a4d711c8b5c 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java @@ -137,43 +137,19 @@ protected boolean allowSameFluidFillForOutputs() { @Override protected void addDisplayText(List textList) { - super.addDisplayText(textList); - if (isStructureFormed()) { - IEnergyContainer energyContainer = recipeMapWorkable.getEnergyContainer(); - if (energyContainer != null && energyContainer.getEnergyCapacity() > 0) { - long maxVoltage = Math.max(energyContainer.getInputVoltage(), energyContainer.getOutputVoltage()); - String voltageName = GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]; - textList.add(new TextComponentTranslation("gregtech.multiblock.max_energy_per_tick", TextFormattingUtil.formatNumbers(maxVoltage), voltageName)); - } - - addExtraDisplayInfo(textList); - - if (!recipeMapWorkable.isWorkingEnabled()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.work_paused")); - - } else if (recipeMapWorkable.isActive()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.running")); - int currentProgress = (int) (recipeMapWorkable.getProgressPercent() * 100); - if (this.recipeMapWorkable.getParallelLimit() != 1) { - textList.add(new TextComponentTranslation("gregtech.multiblock.parallel", this.recipeMapWorkable.getParallelLimit())); - } - textList.add(new TextComponentTranslation("gregtech.multiblock.progress", currentProgress)); - } else { - textList.add(new TextComponentTranslation("gregtech.multiblock.idling")); - } - - if (recipeMapWorkable.isHasNotEnoughEnergy()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.not_enough_energy").setStyle(new Style().setColor(TextFormatting.RED))); - } - } + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive()) + .addEnergyUsageLine(recipeMapWorkable.getEnergyContainer()) + .addParallelsLine(recipeMapWorkable.getParallelLimit()) + .addWorkingStatusLine() + .addProgressLine(recipeMapWorkable.getProgressPercent()); } @Override protected void addWarningText(List textList) { - super.addWarningText(textList); - if (isStructureFormed() && recipeMapWorkable.isHasNotEnoughEnergy()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.not_enough_energy")); - } + MultiblockDisplayText.builder(textList, isStructureFormed(), false) + .addLowPowerLine(recipeMapWorkable.isHasNotEnoughEnergy()) + .addMaintenanceProblemLines(getMaintenanceProblems()); } /** diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java index ee1eecefd3b..732d21f00a0 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java @@ -16,13 +16,13 @@ import gregtech.api.pattern.TraceabilityPredicate; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; +import gregtech.api.util.TextComponentUtil; +import gregtech.api.util.TextFormattingUtil; import gregtech.common.ConfigHolder; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.items.IItemHandlerModifiable; @@ -99,38 +99,41 @@ private void resetTileAbilities() { @Override protected void addDisplayText(List textList) { - super.addDisplayText(textList); - if (isStructureFormed()) { - IFluidTank steamFluidTank = recipeMapWorkable.getSteamFluidTankCombined(); - if (steamFluidTank != null && steamFluidTank.getCapacity() > 0) { - int steamStored = steamFluidTank.getFluidAmount(); - textList.add(new TextComponentTranslation("gregtech.multiblock.steam.steam_stored", steamStored, steamFluidTank.getCapacity())); - } - - if (!recipeMapWorkable.isWorkingEnabled()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.work_paused")); - - } else if (recipeMapWorkable.isActive()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.running")); - int currentProgress = (int) (recipeMapWorkable.getProgressPercent() * 100); - if (this.recipeMapWorkable.getParallelLimit() != 1) { - textList.add(new TextComponentTranslation("gregtech.multiblock.parallel", this.recipeMapWorkable.getParallelLimit())); - } - textList.add(new TextComponentTranslation("gregtech.multiblock.progress", currentProgress)); - } else { - textList.add(new TextComponentTranslation("gregtech.multiblock.idling")); - } - } + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive()) + .addCustom(tl -> { + // custom steam tank line + IFluidTank steamFluidTank = recipeMapWorkable.getSteamFluidTankCombined(); + if (steamFluidTank != null && steamFluidTank.getCapacity() > 0) { + String stored = TextFormattingUtil.formatNumbers(steamFluidTank.getFluidAmount()); + String capacity = TextFormattingUtil.formatNumbers(steamFluidTank.getCapacity()); + + ITextComponent steamInfo = TextComponentUtil.stringWithColor( + TextFormatting.BLUE, + stored + " / " + capacity + " L"); + + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.steam.steam_stored", + steamInfo)); + } + }) + .addParallelsLine(recipeMapWorkable.getParallelLimit()) + .addWorkingStatusLine() + .addProgressLine(recipeMapWorkable.getProgressPercent()); } @Override protected void addWarningText(List textList) { - super.addWarningText(textList); - if (isStructureFormed()) { - if (recipeMapWorkable.isHasNotEnoughEnergy()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.steam.low_steam").setStyle(new Style().setColor(TextFormatting.RED))); - } - } + MultiblockDisplayText.builder(textList, isStructureFormed(), false) + .addCustom(tl -> { + if (isStructureFormed() && recipeMapWorkable.isHasNotEnoughEnergy()) { + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.YELLOW, + "gregtech.multiblock.steam.low_steam")); + } + }) + .addMaintenanceProblemLines(getMaintenanceProblems()); } @Override diff --git a/src/main/java/gregtech/api/modules/GregTechModule.java b/src/main/java/gregtech/api/modules/GregTechModule.java index c9f2b56cf95..d2e44d3127c 100644 --- a/src/main/java/gregtech/api/modules/GregTechModule.java +++ b/src/main/java/gregtech/api/modules/GregTechModule.java @@ -5,23 +5,47 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * All of your {@link IGregTechModule} classes must be annotated with this to be registered. + */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface GregTechModule { + /** + * The ID of this module. Must be unique within its container. + */ String moduleID(); + /** + * The ID of the container to associate this module with. + */ String containerID(); + /** + * A human-readable name for this module. + */ String name(); + /** + * A list of mod IDs that this module depends on. If any mods specified are not present, the module will not load. + */ String[] modDependencies() default {}; + /** + * Whether this module is the "core" module for its container. + * Each container must have exactly one core module, which will be loaded before all other modules in the container. + *

+ * Core modules should not have mod dependencies. + */ boolean coreModule() default false; String author() default ""; String version() default ""; - String descriptionKey() default ""; + /** + * A description of this module in the module configuration file. + */ + String description() default ""; } diff --git a/src/main/java/gregtech/api/modules/IGregTechModule.java b/src/main/java/gregtech/api/modules/IGregTechModule.java index 6f18de4d837..f767e09471f 100644 --- a/src/main/java/gregtech/api/modules/IGregTechModule.java +++ b/src/main/java/gregtech/api/modules/IGregTechModule.java @@ -9,8 +9,18 @@ import java.util.List; import java.util.Set; +/** + * All modules must implement this interface. + *

+ * Provides methods for responding to FML lifecycle events, adding event bus subscriber classes, and processing IMC messages. + */ public interface IGregTechModule { + /** + * What other modules this module depends on. + *

+ * e.g. new ResourceLocation("gregtech", "foo_module") represents a dependency on the module "foo_module" in the container "gregtech" + */ @Nonnull default Set getDependencyUids() { return Collections.emptySet(); @@ -46,9 +56,16 @@ default void serverStopping(FMLServerStoppingEvent event) { default void serverStopped(FMLServerStoppedEvent event) { } + /** + * Register packets using GregTech's packet handling API here. + */ default void registerPackets() { } + /** + * @return A list of classes to subscribe to the Forge event bus. + * As the class gets subscribed, not any specific instance, event handlers must be static! + */ @Nonnull default List> getEventBusSubscribers() { return Collections.emptyList(); @@ -58,6 +75,9 @@ default boolean processIMC(FMLInterModComms.IMCMessage message) { return false; } + /** + * @return A logger to use for this module. + */ @Nonnull Logger getLogger(); } diff --git a/src/main/java/gregtech/api/modules/IModuleContainer.java b/src/main/java/gregtech/api/modules/IModuleContainer.java index e25aa9713fe..05e779b90ac 100644 --- a/src/main/java/gregtech/api/modules/IModuleContainer.java +++ b/src/main/java/gregtech/api/modules/IModuleContainer.java @@ -2,5 +2,8 @@ public interface IModuleContainer { + /** + * The ID of this container. If this is your mod's only container, you should use your mod ID to prevent collisions. + */ String getID(); } diff --git a/src/main/java/gregtech/api/modules/ModuleContainer.java b/src/main/java/gregtech/api/modules/ModuleContainer.java new file mode 100644 index 00000000000..dd66e14d4fa --- /dev/null +++ b/src/main/java/gregtech/api/modules/ModuleContainer.java @@ -0,0 +1,14 @@ +package gregtech.api.modules; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotate your {@link IModuleContainer} with this for it to be automatically registered. + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface ModuleContainer { +} diff --git a/src/main/java/gregtech/api/pipenet/longdist/BlockLongDistancePipe.java b/src/main/java/gregtech/api/pipenet/longdist/BlockLongDistancePipe.java index 9cca36aab3e..9f6c8756699 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/BlockLongDistancePipe.java +++ b/src/main/java/gregtech/api/pipenet/longdist/BlockLongDistancePipe.java @@ -16,13 +16,15 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.ArrayList; +import java.util.Collections; import java.util.List; -public class BlockLongDistancePipe extends Block { +public class BlockLongDistancePipe extends Block implements ILDNetworkPart { private final LongDistancePipeType pipeType; @@ -43,8 +45,21 @@ public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonn BlockPos.PooledMutableBlockPos offsetPos = BlockPos.PooledMutableBlockPos.retain(); for (EnumFacing facing : EnumFacing.VALUES) { offsetPos.setPos(pos).move(facing); - LongDistanceNetwork network = LongDistanceNetwork.get(worldIn, offsetPos); - if (network != null && pipeType == network.getPipeType()) { + IBlockState neighborState = worldIn.getBlockState(offsetPos); + ILDNetworkPart networkPart = ILDNetworkPart.tryGet(worldIn, offsetPos, neighborState); + if (networkPart != null && networkPart.getPipeType() == getPipeType()) { + // neighbor is a valid pipe block + LongDistanceNetwork network = LongDistanceNetwork.get(worldIn, offsetPos); + if (network == null) { + // if for some reason there is not a network at the neighbor, create one + network = networkPart.getPipeType().createNetwork(worldIn); + network.recalculateNetwork(Collections.singleton(offsetPos.toImmutable())); + return; + } + if (!network.getPipeType().isValidPart(networkPart)) { + throw new IllegalStateException("NetworkPart " + networkPart + " pipeType " + + network.getPipeType() + " is not valid for network type " + network.getPipeType()); + } ILDEndpoint endpoint = ILDEndpoint.tryGet(worldIn, offsetPos); // only count the network as connected if it's not an endpoint or the endpoints input or output face is connected if (endpoint == null || endpoint.getFrontFacing().getAxis() == facing.getAxis()) { @@ -98,4 +113,8 @@ public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @N super.addInformation(stack, worldIn, tooltip, flagIn); tooltip.add(I18n.format("gregtech.block.tooltip.no_mob_spawning")); } + + public @NotNull LongDistancePipeType getPipeType() { + return pipeType; + } } diff --git a/src/main/java/gregtech/api/pipenet/longdist/ILDEndpoint.java b/src/main/java/gregtech/api/pipenet/longdist/ILDEndpoint.java index 3683aeb4b0b..98cd68c6965 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/ILDEndpoint.java +++ b/src/main/java/gregtech/api/pipenet/longdist/ILDEndpoint.java @@ -1,37 +1,38 @@ package gregtech.api.pipenet.longdist; -import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public interface ILDEndpoint { +public interface ILDEndpoint extends ILDNetworkPart{ /** * @return the current type of this endpoint (input, output or none) */ - Type getType(); + @NotNull + IOType getIoType(); /** - * @param type new active type + * @param ioType new active type */ - void setType(Type type); + void setIoType(IOType ioType); /** * @return true if this endpoint is considered a network input */ default boolean isInput() { - return getType() == Type.INPUT; + return getIoType() == IOType.INPUT; } /** * @return true if this endpoint is considered a network output */ default boolean isOutput() { - return getType() == Type.OUTPUT; + return getIoType() == IOType.OUTPUT; } /** @@ -48,16 +49,20 @@ default boolean isOutput() { /** * @return the front facing, usually the input face */ + @NotNull EnumFacing getFrontFacing(); /** * @return the output facing */ + @NotNull EnumFacing getOutputFacing(); /** * @return the ld pipe type for this endpoint */ + @Override + @NotNull LongDistancePipeType getPipeType(); /** @@ -65,18 +70,20 @@ default boolean isOutput() { */ BlockPos getPos(); + World getWorld(); + + boolean isValid(); + + @Nullable static ILDEndpoint tryGet(World world, BlockPos pos) { TileEntity te = world.getTileEntity(pos); - if (te instanceof IGregTechTileEntity) { - MetaTileEntity mte = ((IGregTechTileEntity) te).getMetaTileEntity(); - if (mte instanceof ILDEndpoint) { - return (ILDEndpoint) mte; - } + if (te instanceof IGregTechTileEntity gte && gte.getMetaTileEntity() instanceof ILDEndpoint endpoint) { + return endpoint; } return null; } - enum Type { + enum IOType { NONE, INPUT, OUTPUT } } diff --git a/src/main/java/gregtech/api/pipenet/longdist/ILDNetworkPart.java b/src/main/java/gregtech/api/pipenet/longdist/ILDNetworkPart.java new file mode 100644 index 00000000000..0a3b9ad9805 --- /dev/null +++ b/src/main/java/gregtech/api/pipenet/longdist/ILDNetworkPart.java @@ -0,0 +1,29 @@ +package gregtech.api.pipenet.longdist; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Blocks or {@link ILDEndpoint}'s that can be part of a ld network should implement this interface. + */ +public interface ILDNetworkPart { + + /** + * @return the long distance pipe type of this part (f.e. item or fluid) + */ + @NotNull + LongDistancePipeType getPipeType(); + + @Nullable + static ILDNetworkPart tryGet(World world, BlockPos pos) { + return tryGet(world, pos, world.getBlockState(pos)); + } + + @Nullable + static ILDNetworkPart tryGet(World world, BlockPos pos, IBlockState blockState) { + return blockState.getBlock() instanceof ILDNetworkPart part ? part : ILDEndpoint.tryGet(world, pos); + } +} diff --git a/src/main/java/gregtech/api/pipenet/longdist/LongDistanceNetwork.java b/src/main/java/gregtech/api/pipenet/longdist/LongDistanceNetwork.java index 2fb834fe0a1..52a6981ca76 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/LongDistanceNetwork.java +++ b/src/main/java/gregtech/api/pipenet/longdist/LongDistanceNetwork.java @@ -23,6 +23,7 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; public class LongDistanceNetwork { @@ -52,16 +53,9 @@ public static LongDistanceNetwork get(World world, BlockPos pos) { * For this it will start a new thread to keep the main thread free. */ protected void recalculateNetwork(Collection starts) { - // remove the every pipe from the network - for (BlockPos pos : this.longDistancePipeBlocks) { - this.world.removeNetwork(pos); - } - invalidateEndpoints(); - this.endpoints.clear(); - this.longDistancePipeBlocks.clear(); + invalidateNetwork(true); // start a new thread where all given starting points are being walked - Thread thread = new Thread(new NetworkBuilder(world, this, starts)); - thread.start(); + new NetworkBuilder(world, this, starts).start(); } /** @@ -69,18 +63,14 @@ protected void recalculateNetwork(Collection starts) { */ protected void setData(Collection pipes, List endpoints) { invalidateEndpoints(); - boolean wasEmpty = this.longDistancePipeBlocks.isEmpty(); this.longDistancePipeBlocks.clear(); this.longDistancePipeBlocks.addAll(pipes); this.endpoints.clear(); this.endpoints.addAll(endpoints); if (this.longDistancePipeBlocks.isEmpty()) { - invalidateNetwork(); + invalidateNetwork(false); return; } - if (wasEmpty) { - this.world.networkList.add(this); - } for (BlockPos pos : this.longDistancePipeBlocks) { this.world.putNetwork(pos, this); } @@ -94,12 +84,12 @@ public void onRemovePipe(BlockPos pos) { this.longDistancePipeBlocks.remove(pos); this.world.removeNetwork(pos); if (this.longDistancePipeBlocks.isEmpty()) { - invalidateNetwork(); + invalidateNetwork(false); return; } // find amount of neighbour networks List neighbours = new ArrayList<>(); - BlockPos.PooledMutableBlockPos offsetPos = BlockPos.PooledMutableBlockPos.retain(); + BlockPos.MutableBlockPos offsetPos = new BlockPos.MutableBlockPos(); for (EnumFacing facing : EnumFacing.VALUES) { offsetPos.setPos(pos).move(facing); LongDistanceNetwork network = world.getNetwork(offsetPos); @@ -107,7 +97,6 @@ public void onRemovePipe(BlockPos pos) { neighbours.add(offsetPos.toImmutable()); } } - offsetPos.release(); if (neighbours.size() > 1) { // the pipe had more than 1 neighbour // the network might need to be recalculated for each neighbour @@ -170,20 +159,25 @@ protected void mergePipeNet(LongDistanceNetwork network) { for (ILDEndpoint endpoint1 : this.endpoints) { endpoint1.invalidateLink(); } - network.invalidateNetwork(); + network.invalidateNetwork(false); } /** * invalidate this network */ - protected void invalidateNetwork() { + protected void invalidateNetwork(boolean removeFromWorld) { + if (removeFromWorld) { + for (BlockPos pos : this.longDistancePipeBlocks) { + this.world.removeNetwork(pos); + } + } this.longDistancePipeBlocks.clear(); this.world.networkList.remove(this); invalidateEndpoints(); this.endpoints.clear(); } - protected void invalidateEndpoints() { + public void invalidateEndpoints() { this.activeInputIndex = -1; this.activeOutputIndex = -1; for (ILDEndpoint endpoint : this.endpoints) { @@ -202,7 +196,16 @@ public ILDEndpoint getOtherEndpoint(ILDEndpoint endpoint) { // return null for invalid network configurations if (!isValid() || (!endpoint.isInput() && !endpoint.isOutput())) return null; + // check if endpoint really exists in this network + int thisIndex = this.endpoints.indexOf(endpoint); + if (thisIndex < 0) { + // endpoint not found in this network, something is wrong, recalculate network + recalculateNetwork(Collections.singleton(endpoint.getPos())); + return null; + } + if (isIOIndexInvalid()) { + // current endpoint indexes are invalid invalidateEndpoints(); } else if (this.activeInputIndex >= 0) { // there is an active input and output endpoint @@ -229,9 +232,6 @@ public ILDEndpoint getOtherEndpoint(ILDEndpoint endpoint) { int otherIndex = find(endpoint); if (otherIndex >= 0) { // found other endpoint - int thisIndex = this.endpoints.indexOf(endpoint); - if (thisIndex < 0) - throw new IllegalStateException("Tried to get endpoint that is not part of this network. Something is seriously wrong!"); ILDEndpoint other = this.endpoints.get(otherIndex); // set active endpoints this.activeOutputIndex = endpoint.isOutput() ? thisIndex : otherIndex; @@ -244,6 +244,11 @@ public ILDEndpoint getOtherEndpoint(ILDEndpoint endpoint) { private int find(ILDEndpoint endpoint) { for (int i = 0; i < this.endpoints.size(); i++) { ILDEndpoint other = this.endpoints.get(i); + if (!other.isValid()) { + other.invalidateLink(); + this.endpoints.remove(i--); + continue; + } if (endpoint != other && (other.isOutput() || other.isInput()) && other.isInput() != endpoint.isInput() && diff --git a/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java b/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java index 973a7e30b89..0a67ad9530d 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java +++ b/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java @@ -3,12 +3,10 @@ import gregtech.common.pipelike.fluidpipe.longdistance.LDFluidPipeType; import gregtech.common.pipelike.itempipe.longdistance.LDItemPipeType; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import javax.annotation.Nonnull; -import java.util.Collections; import java.util.Objects; /** @@ -18,9 +16,6 @@ public abstract class LongDistancePipeType { private static final Object2ObjectOpenHashMap PIPE_TYPES = new Object2ObjectOpenHashMap<>(); - private static LDFluidPipeType FLUID; - private static LDItemPipeType ITEM; - private final String name; protected LongDistancePipeType(String name) { @@ -36,38 +31,21 @@ protected LongDistancePipeType(String name) { PIPE_TYPES.put(name, this); } - public static void init() { - FLUID = LDFluidPipeType.INSTANCE; - ITEM = LDItemPipeType.INSTANCE; - } - public static LDFluidPipeType fluid() { - return FLUID; + return LDFluidPipeType.INSTANCE; } public static LDItemPipeType item() { - return ITEM; + return LDItemPipeType.INSTANCE; } public static LongDistancePipeType getPipeType(String name) { return PIPE_TYPES.get(name); } - /** - * Checks if the given block state is a valid ld pipe block for this type - * - * @param blockState potential ld pipe block - * @return if the given block state is a valid ld pipe block for this type - */ - public abstract boolean isValidBlock(IBlockState blockState); - - /** - * Checks if the given endpoint is a valid endpoint for this type - * - * @param endpoint potential endpoint - * @return if the given endpoint is a valid endpoint for this type - */ - public abstract boolean isValidEndpoint(ILDEndpoint endpoint); + public boolean isValidPart(ILDNetworkPart networkPart) { + return networkPart != null && networkPart.getPipeType() == this; + } /** * @return The minimum required distance (not pipe count between endpoints) between to endpoints to work. diff --git a/src/main/java/gregtech/api/pipenet/longdist/NetworkBuilder.java b/src/main/java/gregtech/api/pipenet/longdist/NetworkBuilder.java index b61e85d5051..5c90d866122 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/NetworkBuilder.java +++ b/src/main/java/gregtech/api/pipenet/longdist/NetworkBuilder.java @@ -1,40 +1,42 @@ package gregtech.api.pipenet.longdist; -import gregtech.common.metatileentities.storage.MetaTileEntityLongDistanceEndpoint; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectList; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.ChunkProviderServer; import java.util.ArrayList; import java.util.Collection; -import java.util.LinkedList; import java.util.List; +import java.util.Objects; /** * This bad boy is responsible for building the network */ -public class NetworkBuilder implements Runnable { +public class NetworkBuilder extends Thread { - private final LinkedList starts = new LinkedList<>(); + private final ObjectList starts = new ObjectArrayList<>(); private final LongDistanceNetwork.WorldData worldData; + private final LongDistanceNetwork originalNetwork; private LongDistanceNetwork network; private final World world; - private final LinkedList currentPoints = new LinkedList<>(); + private final ObjectList currentPoints = new ObjectArrayList<>(); private final ObjectOpenHashSet walked = new ObjectOpenHashSet<>(); private final List pipes = new ArrayList<>(); private final List endpoints = new ArrayList<>(); - - public NetworkBuilder(LongDistanceNetwork.WorldData worldData, LongDistanceNetwork network, BlockPos start) { - this.worldData = worldData; - this.network = network; - this.world = worldData.getWorld(); - this.starts.add(start); - } + private final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(); + private final ObjectOpenHashSet loadedChunks = new ObjectOpenHashSet<>(); public NetworkBuilder(LongDistanceNetwork.WorldData worldData, LongDistanceNetwork network, Collection starts) { - this.worldData = worldData; + this.worldData = Objects.requireNonNull(worldData); + this.originalNetwork = Objects.requireNonNull(network); this.network = network; this.world = worldData.getWorld(); this.starts.addAll(starts); @@ -42,72 +44,89 @@ public NetworkBuilder(LongDistanceNetwork.WorldData worldData, LongDistanceNetwo @Override public void run() { + if (this.starts.isEmpty()) return; + BlockPos start = this.starts.remove(0); + checkNetwork(start); // iterate over each given starting point and try to build a network - boolean first = true; - while (!starts.isEmpty()) { - BlockPos start = starts.pollFirst(); - if (first) { - first = false; - checkNetwork(start); - } else { - LongDistanceNetwork ldn = worldData.getNetwork(start); - if (ldn != null) { - // this starting point was caught during a previous iteration, so we don't need to create another network here - continue; - } - // create a new network, since the current was already calculated - this.network = this.network.getPipeType().createNetwork(this.worldData); - this.currentPoints.clear(); - this.walked.clear(); - this.pipes.clear(); - this.endpoints.clear(); - checkNetwork(start); + while (!this.starts.isEmpty()) { + start = this.starts.remove(0); + LongDistanceNetwork ldn = this.worldData.getNetwork(start); + if (ldn == this.originalNetwork) { + // this starting point was caught during a previous iteration, so we don't need to create another network here + continue; } + // create a new network, since the current was already calculated + this.network = this.network.getPipeType().createNetwork(this.worldData); + this.currentPoints.clear(); + this.walked.clear(); + this.pipes.clear(); + this.endpoints.clear(); + checkNetwork(start); + } + IChunkProvider chunkProvider = this.world.getChunkProvider(); + if (chunkProvider instanceof ChunkProviderServer chunkProviderServer) { + this.loadedChunks.forEach(chunkProviderServer::queueUnload); } } private void checkNetwork(BlockPos start) { // current points stores all current branches of the network - this.currentPoints.add(start); - checkPos(world.getBlockState(start), start); - BlockPos.PooledMutableBlockPos pos = BlockPos.PooledMutableBlockPos.retain(); - while (!currentPoints.isEmpty()) { + checkPos(this.world.getBlockState(start), start); + while (!this.currentPoints.isEmpty()) { // get and remove the first stored branch - BlockPos current = currentPoints.pollFirst(); + BlockPos current = this.currentPoints.remove(0); for (EnumFacing facing : EnumFacing.VALUES) { - pos.setPos(current).move(facing); - if (walked.contains(pos)) { + this.pos.setPos(current).move(facing); + if (this.walked.contains(this.pos)) { continue; } - IBlockState blockState = world.getBlockState(pos); - if (blockState.getBlock().isAir(blockState, world, pos)) { + IBlockState blockState = getBlockState(this.pos); + if (blockState.getBlock().isAir(blockState, this.world, this.pos)) { continue; } - checkPos(blockState, pos); + checkPos(blockState, this.pos); } } - pos.release(); // the whole net was checked // now send the data to the given network - network.setData(pipes, endpoints); + this.network.setData(this.pipes, this.endpoints); } /** * Checks a pos for a pipe or a endpoint */ private void checkPos(IBlockState blockState, BlockPos pos) { + LongDistanceNetwork network = LongDistanceNetwork.get(this.world, pos); + if (network != null && network != this.network) { + network.invalidateNetwork(true); + } BlockPos bp = pos.toImmutable(); - if (blockState.getBlock() instanceof BlockLongDistancePipe && network.getPipeType().isValidBlock(blockState)) { - pipes.add(bp); - // add another branch/block for processing - currentPoints.addLast(bp); - } else { - ILDEndpoint endpoint = ILDEndpoint.tryGet(world, pos); - if (endpoint != null && network.getPipeType().isValidEndpoint(endpoint)) { - pipes.add(bp); - endpoints.add(endpoint); + this.walked.add(bp); + ILDNetworkPart part = ILDNetworkPart.tryGet(this.world, pos, blockState); + if (part != null) { + this.pipes.add(bp); + if (part instanceof ILDEndpoint endpoint) this.endpoints.add(endpoint); + else this.currentPoints.add(bp); + } + } + + /** + * Special method which can get block state which are far away. It temporarily loads the chunk for that. + */ + private IBlockState getBlockState(BlockPos pos) { + if (this.world.isOutsideBuildHeight(pos)) return Blocks.AIR.getDefaultState(); + IChunkProvider chunkProvider = this.world.getChunkProvider(); + Chunk chunk = chunkProvider.getLoadedChunk(pos.getX() >> 4, pos.getZ() >> 4); + // chunk is not loaded, try to load it + if (chunk == null) { + // don't force generate a chunk + if (!chunkProvider.isChunkGeneratedAt(pos.getX() >> 4, pos.getZ() >> 4)) { + return Blocks.AIR.getDefaultState(); } + chunk = chunkProvider.provideChunk(pos.getX() >> 4, pos.getZ() >> 4); + // add loaded chunk to list to unload it later + this.loadedChunks.add(chunk); } - walked.add(bp); + return chunk.getBlockState(pos); } } diff --git a/src/main/java/gregtech/api/recipes/machines/IScannerRecipeMap.java b/src/main/java/gregtech/api/recipes/machines/IScannerRecipeMap.java index 99b56858cfa..f213e2c96b4 100644 --- a/src/main/java/gregtech/api/recipes/machines/IScannerRecipeMap.java +++ b/src/main/java/gregtech/api/recipes/machines/IScannerRecipeMap.java @@ -1,4 +1,40 @@ package gregtech.api.recipes.machines; +import gregtech.api.recipes.Recipe; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; + public interface IScannerRecipeMap { + + /** + * @return A list of all representative recipes detailed by registered {@link ICustomScannerLogic} implementations. + */ + @NotNull + default List getRepresentativeRecipes() { + return Collections.emptyList(); + } + + interface ICustomScannerLogic { + + /** + * @return A custom recipe to run given the current Scanner's inputs. Will be called only if a registered + * recipe is not found to run. Return null if no recipe should be run by your logic. + */ + @Nullable + Recipe createCustomRecipe(long voltage, List inputs, List fluidInputs, boolean exactVoltage); + + /** + * @return A list of Recipes that are never registered, but are added to JEI to demonstrate the custom logic. + * Not required, can return empty or null to not add any. + */ + @Nullable + default List getRepresentativeRecipes() { + return null; + } + } } diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java index 8c1e962f371..c404b7d173a 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java @@ -2,55 +2,53 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; -import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.builders.SimpleRecipeBuilder; -import gregtech.api.util.AssemblyLineManager; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.util.ArrayList; import java.util.List; public class RecipeMapScanner extends RecipeMap implements IScannerRecipeMap { + private static final List CUSTOM_SCANNER_LOGICS = new ArrayList<>(); + public RecipeMapScanner(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipe, isHidden); } + @Override + public @NotNull List getRepresentativeRecipes() { + List recipes = new ArrayList<>(); + for (ICustomScannerLogic logic : CUSTOM_SCANNER_LOGICS) { + List logicRecipes = logic.getRepresentativeRecipes(); + if (logicRecipes != null && !logicRecipes.isEmpty()) { + recipes.addAll(logicRecipes); + } + } + return recipes; + } + + /** + * + * @param logic A function which is passed the normal findRecipe() result. Returns null if no valid recipe for + * the custom logic is found, + */ + public static void registerCustomScannerLogic(ICustomScannerLogic logic) { + CUSTOM_SCANNER_LOGICS.add(logic); + } + @Override @Nullable public Recipe findRecipe(long voltage, List inputs, List fluidInputs, boolean exactVoltage) { Recipe recipe = super.findRecipe(voltage, inputs, fluidInputs, exactVoltage); + if (recipe != null) return recipe; - // Data stick copying - min of 2 inputs required - if (recipe == null && inputs.size() > 1) { - // try the data recipe both ways, prioritizing overwriting the first - recipe = createDataRecipe(inputs.get(0), inputs.get(1)); + for (ICustomScannerLogic logic : CUSTOM_SCANNER_LOGICS) { + recipe = logic.createCustomRecipe(voltage, inputs, fluidInputs, exactVoltage); if (recipe != null) return recipe; - - return createDataRecipe(inputs.get(1), inputs.get(0)); - } - return recipe; - } - - @Nullable - private static Recipe createDataRecipe(@Nonnull ItemStack first, @Nonnull ItemStack second) { - NBTTagCompound compound = second.getTagCompound(); - if (compound == null) return null; - - boolean isFirstDataItem = AssemblyLineManager.isStackDataItem(first, true); - if (!isFirstDataItem) return null; - boolean isSecondDataItem = AssemblyLineManager.isStackDataItem(second, true); - if (isSecondDataItem) { - ItemStack output = first.copy(); - output.setTagCompound(compound.copy()); - return RecipeMaps.SCANNER_RECIPES.recipeBuilder() - .inputs(first) - .notConsumable(second) - .outputs(output) - .duration(100).EUt(2).build().getResult(); } return null; } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/ScanProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/ScanProperty.java new file mode 100644 index 00000000000..fda3bf83599 --- /dev/null +++ b/src/main/java/gregtech/api/recipes/recipeproperties/ScanProperty.java @@ -0,0 +1,30 @@ +package gregtech.api.recipes.recipeproperties; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; + +import javax.annotation.Nonnull; + +public class ScanProperty extends RecipeProperty { + + public static final String KEY = "scan"; + + private static ScanProperty INSTANCE; + + private ScanProperty() { + super(KEY, Boolean.class); + } + + @Nonnull + public static ScanProperty getInstance() { + if (INSTANCE == null) { + INSTANCE = new ScanProperty(); + } + return INSTANCE; + } + + @Override + public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) { + minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.scan_for_research"), x, y, color); + } +} diff --git a/src/main/java/gregtech/api/terminal/TerminalRegistry.java b/src/main/java/gregtech/api/terminal/TerminalRegistry.java index eba07610601..b23bfbae207 100644 --- a/src/main/java/gregtech/api/terminal/TerminalRegistry.java +++ b/src/main/java/gregtech/api/terminal/TerminalRegistry.java @@ -74,6 +74,7 @@ public static void init() { AppRegistryBuilder.create(new TutorialGuideApp()).defaultApp().build(); AppRegistryBuilder.create(new GuideEditorApp()).defaultApp().build(); AppRegistryBuilder.create(new SettingsApp()).defaultApp().build(); + AppRegistryBuilder.create(new CapeSelectorApp()).defaultApp().build(); AppRegistryBuilder.create(new TeleportApp()) .battery(GTValues.ZPM, 10000) @@ -156,9 +157,6 @@ public static void init() { .battery(GTValues.MV, 500) .device(DeviceHardware.DEVICE.WIRELESS) .build(); - AppRegistryBuilder.create(new CapeSelectorApp()) - .battery(GTValues.ULV, 8) - .build(); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/gregtech/api/unification/material/info/MaterialFlags.java b/src/main/java/gregtech/api/unification/material/info/MaterialFlags.java index 85fe5715c39..26d60ad2ce2 100644 --- a/src/main/java/gregtech/api/unification/material/info/MaterialFlags.java +++ b/src/main/java/gregtech/api/unification/material/info/MaterialFlags.java @@ -94,6 +94,11 @@ public String toString() { .requireProps(PropertyKey.INGOT) .build(); + public static final MaterialFlag GENERATE_DENSE = new MaterialFlag.Builder("generate_dense") + .requireFlags(GENERATE_PLATE) + .requireProps(PropertyKey.DUST) + .build(); + public static final MaterialFlag GENERATE_ROD = new MaterialFlag.Builder("generate_rod") .requireProps(PropertyKey.DUST) .build(); @@ -234,11 +239,6 @@ public String toString() { .requireProps(PropertyKey.INGOT) .build(); - public static final MaterialFlag GENERATE_DENSE = new MaterialFlag.Builder("generate_dense") - .requireFlags(GENERATE_PLATE) - .requireProps(PropertyKey.INGOT) - .build(); - public static final MaterialFlag GENERATE_ROUND = new MaterialFlag.Builder("generate_round") .requireProps(PropertyKey.INGOT) .build(); @@ -273,4 +273,11 @@ public String toString() { public static final MaterialFlag HIGH_SIFTER_OUTPUT = new MaterialFlag.Builder("high_sifter_output") .requireProps(PropertyKey.GEM, PropertyKey.ORE) .build(); + + /** + * If this material should generate ore processing items, but no ore block. + */ + public static final MaterialFlag DISABLE_ORE_BLOCK = new MaterialFlag.Builder("disable_ore_block") + .requireProps(PropertyKey.ORE) + .build(); } diff --git a/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java b/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java index f81b03d64db..93d7c508721 100644 --- a/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java @@ -148,7 +148,7 @@ public static void register() { .build(); Cinnabar = new Material.Builder(268, gregtechId("cinnabar")) - .gem(1).ore() + .dust(1).ore() .color(0x960000).iconSet(EMERALD) .flags(CRYSTALLIZABLE, DECOMPOSITION_BY_CENTRIFUGING) .components(Mercury, 1, Sulfur, 1) @@ -380,7 +380,7 @@ public static void register() { Obsidian = new Material.Builder(297, gregtechId("obsidian")) .dust(3) .color(0x503264) - .flags(NO_SMASHING, EXCLUDE_BLOCK_CRAFTING_RECIPES, GENERATE_PLATE) + .flags(NO_SMASHING, EXCLUDE_BLOCK_CRAFTING_RECIPES, GENERATE_PLATE, GENERATE_DENSE) .components(Magnesium, 1, Iron, 1, Silicon, 2, Oxygen, 4) .build(); diff --git a/src/main/java/gregtech/api/unification/material/materials/HigherDegreeMaterials.java b/src/main/java/gregtech/api/unification/material/materials/HigherDegreeMaterials.java index 276800fa5a2..1e5b16c936a 100644 --- a/src/main/java/gregtech/api/unification/material/materials/HigherDegreeMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/HigherDegreeMaterials.java @@ -25,7 +25,7 @@ public static void register() { EnderEye = new Material.Builder(2508, gregtechId("ender_eye")) .gem(1) .color(0x66FF66) - .flags(NO_SMASHING, NO_SMELTING, DECOMPOSITION_BY_CENTRIFUGING) + .flags(GENERATE_PLATE, NO_SMASHING, NO_SMELTING, DECOMPOSITION_BY_CENTRIFUGING) .build(); Diatomite = new Material.Builder(2509, gregtechId("diatomite")) diff --git a/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java b/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java index e39cc7cbebb..c9a484c745b 100644 --- a/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java @@ -19,7 +19,8 @@ public static void register() { .flags(GENERATE_GEAR, GENERATE_RING, GENERATE_FOIL) .components(Carbon, 2, Hydrogen, 6, Oxygen, 1, Silicon, 1) .fluidTemp(900) - .build(); + .build() + .setFormula("Si(CH3)2O", true); Nitrobenzene = new Material.Builder(1001, gregtechId("nitrobenzene")) .fluid(FluidTypes.GAS) @@ -104,7 +105,8 @@ public static void register() { .color(0xF5F5F5) .flags(DISABLE_DECOMPOSITION, FLAMMABLE) .components(Carbon, 2, Hydrogen, 6, Oxygen, 1, Silicon, 1) - .build(); + .build() + .setFormula("Si(CH3)2O", true); Polyethylene = new Material.Builder(1012, gregtechId("plastic")) //todo add polyethylene oredicts .polymer(1) @@ -300,7 +302,8 @@ public static void register() { .color(0x441650) .flags(DISABLE_DECOMPOSITION) .components(Carbon, 2, Hydrogen, 6, Chlorine, 2, Silicon, 1) - .build(); + .build() + .setFormula("Si(CH3)2Cl2", true); Styrene = new Material.Builder(1041, gregtechId("styrene")) .fluid() diff --git a/src/main/java/gregtech/api/unification/ore/OrePrefix.java b/src/main/java/gregtech/api/unification/ore/OrePrefix.java index c8cdf283076..345e8c9be78 100644 --- a/src/main/java/gregtech/api/unification/ore/OrePrefix.java +++ b/src/main/java/gregtech/api/unification/ore/OrePrefix.java @@ -101,7 +101,7 @@ public class OrePrefix { public static final OrePrefix nugget = new OrePrefix("nugget", M / 9, null, MaterialIconType.nugget, ENABLE_UNIFICATION, hasIngotProperty); // 9 Plates combined in one Item. - public static final OrePrefix plateDense = new OrePrefix("plateDense", M * 9, null, MaterialIconType.plateDense, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_DENSE) && !mat.hasFlag(NO_SMASHING)); + public static final OrePrefix plateDense = new OrePrefix("plateDense", M * 9, null, MaterialIconType.plateDense, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_DENSE)); // 2 Plates combined in one Item public static final OrePrefix plateDouble = new OrePrefix("plateDouble", M * 2, null, MaterialIconType.plateDouble, ENABLE_UNIFICATION, hasIngotProperty.and(mat -> mat.hasFlags(GENERATE_PLATE, GENERATE_DOUBLE_PLATE) && !mat.hasFlag(NO_SMASHING))); // Regular Plate made of one Ingot/Dust. Introduced by Calclavia diff --git a/src/main/java/gregtech/api/util/AssemblyLineManager.java b/src/main/java/gregtech/api/util/AssemblyLineManager.java index 6a739b52758..ae1459842db 100644 --- a/src/main/java/gregtech/api/util/AssemblyLineManager.java +++ b/src/main/java/gregtech/api/util/AssemblyLineManager.java @@ -3,18 +3,27 @@ import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.metaitem.stats.IDataItem; import gregtech.api.items.metaitem.stats.IItemBehaviour; +import gregtech.api.recipes.Recipe; +import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.builders.AssemblyLineRecipeBuilder; import gregtech.api.recipes.ingredients.nbtmatch.NBTCondition; import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher; +import gregtech.api.recipes.machines.IScannerRecipeMap; +import gregtech.api.recipes.machines.RecipeMapScanner; +import gregtech.api.recipes.recipeproperties.ScanProperty; import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.Constants; +import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.ApiStatus; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.util.Collections; +import java.util.List; public final class AssemblyLineManager { @@ -36,6 +45,11 @@ public static ItemStack getDefaultResearchStationItem(int cwut) { private AssemblyLineManager() {} + @ApiStatus.Internal + public static void registerScannerLogic() { + RecipeMapScanner.registerCustomScannerLogic(new DataStickCopyScannerLogic()); + } + /** * @param stackCompound the compound contained on the ItemStack to write to * @param researchId the research id @@ -124,13 +138,68 @@ public static void createDefaultResearchRecipe(@Nonnull String researchId, @Nonn .totalCWU(duration) .buildAndRegister(); } else { - RecipeMaps.SCANNER_RECIPES.recipeBuilder() + RecipeBuilder builder = RecipeMaps.SCANNER_RECIPES.recipeBuilder() .inputNBT(dataItem.getItem(), 1, dataItem.getMetadata(), NBTMatcher.ANY, NBTCondition.ANY) .inputs(researchItem) .outputs(dataItem) .duration(duration) - .EUt(EUt) - .buildAndRegister(); + .EUt(EUt); + builder.applyProperty(ScanProperty.getInstance(), true); + builder.buildAndRegister(); + } + } + + public static class DataStickCopyScannerLogic implements IScannerRecipeMap.ICustomScannerLogic { + + private static final int EUT = 2; + private static final int DURATION = 100; + + @Override + public Recipe createCustomRecipe(long voltage, List inputs, List fluidInputs, boolean exactVoltage) { + if (inputs.size() > 1) { + // try the data recipe both ways, prioritizing overwriting the first + Recipe recipe = createDataRecipe(inputs.get(0), inputs.get(1)); + if (recipe != null) return recipe; + + return createDataRecipe(inputs.get(1), inputs.get(0)); + } + return null; + } + + @Nullable + private Recipe createDataRecipe(@Nonnull ItemStack first, @Nonnull ItemStack second) { + NBTTagCompound compound = second.getTagCompound(); + if (compound == null) return null; + + // Both must be data items + if (!isStackDataItem(first, true)) return null; + if (!isStackDataItem(second, true)) return null; + + ItemStack output = first.copy(); + output.setTagCompound(compound.copy()); + return RecipeMaps.SCANNER_RECIPES.recipeBuilder() + .inputs(first) + .notConsumable(second) + .outputs(output) + .duration(DURATION).EUt(EUT).build().getResult(); + } + + @Nullable + @Override + public List getRepresentativeRecipes() { + ItemStack copiedStick = MetaItems.TOOL_DATA_STICK.getStackForm(); + copiedStick.setTranslatableName("gregtech.scanner.copy_stick_from"); + ItemStack emptyStick = MetaItems.TOOL_DATA_STICK.getStackForm(); + emptyStick.setTranslatableName("gregtech.scanner.copy_stick_empty"); + ItemStack resultStick = MetaItems.TOOL_DATA_STICK.getStackForm(); + resultStick.setTranslatableName("gregtech.scanner.copy_stick_to"); + return Collections.singletonList( + RecipeMaps.SCANNER_RECIPES.recipeBuilder() + .inputs(emptyStick) + .notConsumable(copiedStick) + .outputs(resultStick) + .duration(DURATION).EUt(EUT) + .build().getResult()); } } } diff --git a/src/main/java/gregtech/api/util/CapesRegistry.java b/src/main/java/gregtech/api/util/CapesRegistry.java index 158d571f332..2f92b017ea6 100644 --- a/src/main/java/gregtech/api/util/CapesRegistry.java +++ b/src/main/java/gregtech/api/util/CapesRegistry.java @@ -36,24 +36,28 @@ public class CapesRegistry { private static final Map> UNLOCKED_CAPES = new HashMap<>(); private static final Map WORN_CAPES = new HashMap<>(); private static final Map CAPE_ADVANCEMENTS = new HashMap<>(); + private static final Set FREE_CAPES = new HashSet<>(); public static void registerDevCapes() { - unlockCape(UUID.fromString("2fa297a6-7803-4629-8360-7059155cf43e"), Textures.GREGTECH_CAPE_TEXTURE); // KilaBash - unlockCape(UUID.fromString("a82fb558-64f9-4dd6-a87d-84040e84bb43"), Textures.GREGTECH_CAPE_TEXTURE); // serenibyss - unlockCape(UUID.fromString("5c2933b3-5340-4356-81e7-783c53bd7845"), Textures.GREGTECH_CAPE_TEXTURE); // Tech22 - unlockCape(UUID.fromString("56bd41d0-06ef-4ed7-ab48-926ce45651f9"), Textures.GREGTECH_CAPE_TEXTURE); // Zalgo239 - unlockCape(UUID.fromString("aaf70ec1-ac70-494f-9966-ea5933712750"), Textures.GREGTECH_CAPE_TEXTURE); // Bruberu unlockCape(UUID.fromString("a24a9108-23d2-43fc-8db7-43f809d017db"), Textures.GREGTECH_CAPE_TEXTURE); // ALongStringOfNumbers unlockCape(UUID.fromString("77e2129d-8f68-4025-9394-df946f1f3aee"), Textures.GREGTECH_CAPE_TEXTURE); // Brachy84 - unlockCape(UUID.fromString("5d7073e3-882f-4c4a-94b3-0e5ba1c11e02"), Textures.GREGTECH_CAPE_TEXTURE); // htmlcsjs - unlockCape(UUID.fromString("4a57640e-c1b1-4413-a6ab-e9a8b60ec167"), Textures.GREGTECH_CAPE_TEXTURE); // PrototypeTrouser unlockCape(UUID.fromString("c1377a67-4585-46b6-b70e-dfaa419f1e71"), Textures.GREGTECH_CAPE_TEXTURE); // BraggestSage833 + unlockCape(UUID.fromString("aaf70ec1-ac70-494f-9966-ea5933712750"), Textures.GREGTECH_CAPE_TEXTURE); // Bruberu unlockCape(UUID.fromString("77c0be85-2619-4ab7-96e8-627b45682e04"), Textures.GREGTECH_CAPE_TEXTURE); // Exaxxion4096 - unlockCape(UUID.fromString("12892f29-9eef-47ed-b8fb-df3e0e90db0c"), Textures.GREGTECH_CAPE_TEXTURE); // Quarri6343 + unlockCape(UUID.fromString("88374b6a-4710-46cd-bb04-a1580905a918"), Textures.GREGTECH_CAPE_TEXTURE); // Ghzdude + unlockCape(UUID.fromString("5d7073e3-882f-4c4a-94b3-0e5ba1c11e02"), Textures.GREGTECH_CAPE_TEXTURE); // htmlcsjs + unlockCape(UUID.fromString("30628e4c-f7ac-427f-8ca7-aab2c0572be8"), Textures.GREGTECH_CAPE_TEXTURE); // TheLastKumquat unlockCape(UUID.fromString("44f38ff8-aad7-49c3-acb3-d92317af9078"), Textures.GREGTECH_CAPE_TEXTURE); // LAGIdiot - unlockCape(UUID.fromString("e6e784af-bd04-46ad-8141-47b8b9102cb9"), Textures.GREGTECH_CAPE_TEXTURE); // Tictim + // todo Mikerooni (when he gets a new account) + unlockCape(UUID.fromString("4a57640e-c1b1-4413-a6ab-e9a8b60ec167"), Textures.GREGTECH_CAPE_TEXTURE); // PrototypeTrousers + unlockCape(UUID.fromString("12892f29-9eef-47ed-b8fb-df3e0e90db0c"), Textures.GREGTECH_CAPE_TEXTURE); // Quarri6343 unlockCape(UUID.fromString("1184eb79-5831-4f7d-b8f4-3a46fccf7a1d"), Textures.GREGTECH_CAPE_TEXTURE); // screret - unlockCape(UUID.fromString("88374b6a-4710-46cd-bb04-a1580905a918"), Textures.GREGTECH_CAPE_TEXTURE); // Ghzdude + unlockCape(UUID.fromString("a82fb558-64f9-4dd6-a87d-84040e84bb43"), Textures.GREGTECH_CAPE_TEXTURE); // serenibyss + unlockCape(UUID.fromString("fbd96f69-60f9-481c-b71e-4b190cd5fc72"), Textures.GREGTECH_CAPE_TEXTURE); // Anne-Marie + unlockCape(UUID.fromString("5c2933b3-5340-4356-81e7-783c53bd7845"), Textures.GREGTECH_CAPE_TEXTURE); // Tech22 + unlockCape(UUID.fromString("e6e784af-bd04-46ad-8141-47b8b9102cb9"), Textures.GREGTECH_CAPE_TEXTURE); // Tictim + unlockCape(UUID.fromString("2fa297a6-7803-4629-8360-7059155cf43e"), Textures.GREGTECH_CAPE_TEXTURE); // KilaBash + unlockCape(UUID.fromString("56bd41d0-06ef-4ed7-ab48-926ce45651f9"), Textures.GREGTECH_CAPE_TEXTURE); // Zalgo239 save(); } @@ -148,6 +152,19 @@ public static void checkAdvancements(World world) { for (Tuple tuple : ctRegisterCapes) { registerCape(tuple.getFirst(), tuple.getSecond(), world); } + FREE_CAPES.addAll(ctFreeCapes); + FREE_CAPES.add(Textures.ACE_CAPE_TEXTURE); + FREE_CAPES.add(Textures.AGENDER_CAPE_TEXTURE); + FREE_CAPES.add(Textures.AROMANTIC_CAPE_TEXTURE); + FREE_CAPES.add(Textures.BI_CAPE_TEXTURE); + FREE_CAPES.add(Textures.GENDERFLUID_CAPE_TEXTURE); + FREE_CAPES.add(Textures.GENDERQUEER_CAPE_TEXTURE); + FREE_CAPES.add(Textures.INTERSEX_CAPE_TEXTURE); + FREE_CAPES.add(Textures.LESBIAN_CAPE_TEXTURE); + FREE_CAPES.add(Textures.NONBINARY_CAPE_TEXTURE); + FREE_CAPES.add(Textures.PAN_CAPE_TEXTURE); + FREE_CAPES.add(Textures.RAINBOW_CAPE_TEXTURE); + FREE_CAPES.add(Textures.TRANS_CAPE_TEXTURE); } /** @@ -177,7 +194,16 @@ public static void registerCape(ResourceLocation advancement, ResourceLocation c } } - private static List> ctRegisterCapes = new ArrayList<>(); + /** + * Adds a cape that will always be unlocked for all players. + * @param cape A ResourceLocation pointing to the cape texture. + */ + public static void addFreeCape(ResourceLocation cape) { + FREE_CAPES.add(cape); + } + + private static final List> ctRegisterCapes = new ArrayList<>(); + private static final List ctFreeCapes = new ArrayList<>(); @Optional.Method(modid = GTValues.MODID_CT) @ZenMethod @@ -185,6 +211,12 @@ public static void registerCape(String advancement, String cape) { ctRegisterCapes.add(new Tuple<>(new ResourceLocation(advancement), new ResourceLocation(cape))); } + @Optional.Method(modid = GTValues.MODID_CT) + @ZenMethod + public static void registerFreeCape(String cape) { + ctFreeCapes.add(new ResourceLocation(cape)); + } + /** * Automatically gives a cape to a player, which may be used for a reward for something other than an advancement * DOES NOT SAVE AUTOMATICALLY; PLEASE CALL SAVE AFTER THIS FUNCTION IS USED IF THIS DATA IS MEANT TO PERSIST. @@ -246,6 +278,12 @@ public static void detectNewCapes(EntityPlayer player) { unlockCapeOnAdvancement(player, capeEntry.getKey()); } } + if (UNLOCKED_CAPES.get(player.getPersistentID()) == null || !new HashSet<>(UNLOCKED_CAPES.get(player.getPersistentID())).containsAll(FREE_CAPES)) { + for (ResourceLocation cape : FREE_CAPES) { + unlockCape(player.getPersistentID(), cape); + } + save(); + } } } diff --git a/src/main/java/gregtech/api/util/TextComponentUtil.java b/src/main/java/gregtech/api/util/TextComponentUtil.java new file mode 100644 index 00000000000..3a1d51d97c5 --- /dev/null +++ b/src/main/java/gregtech/api/util/TextComponentUtil.java @@ -0,0 +1,50 @@ +package gregtech.api.util; + +import net.minecraft.util.text.*; +import net.minecraft.util.text.event.HoverEvent; + +/** + * Helper class to make working with {@link ITextComponent} implementations more readable. + */ +public class TextComponentUtil { + + /** + * Create a {@link TextComponentString} with specified color format. + */ + public static TextComponentString stringWithColor(TextFormatting color, String string) { + return (TextComponentString) new TextComponentString(string).setStyle(new Style().setColor(color)); + } + + /** + * Create a {@link TextComponentTranslation} with specified color format and args. + */ + public static TextComponentTranslation translationWithColor(TextFormatting color, String key, Object... args) { + return (TextComponentTranslation) new TextComponentTranslation(key, args).setStyle(new Style().setColor(color)); + } + + /** + * Add hover text to a Text Component. Each hover component will be on a new line. + */ + public static ITextComponent setHover(ITextComponent base, ITextComponent... hover) { + if (hover == null || hover.length == 0) return base; + + ITextComponent hoverText = hover[0]; + if (hover.length > 1) { + for (int i = 1; i < hover.length; i++) { + hoverText.appendText("\n").appendSibling(hover[i]); + } + } + + // getStyle() always returns non-null, if there is no style it will create a new one. + base.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverText)); + return base; + } + + /** + * Set the color of a Text Component. + */ + public static ITextComponent setColor(ITextComponent base, TextFormatting color) { + base.getStyle().setColor(color); + return base; + } +} diff --git a/src/main/java/gregtech/api/util/oreglob/OreGlob.java b/src/main/java/gregtech/api/util/oreglob/OreGlob.java index 17f4abec925..0d3470faf1c 100644 --- a/src/main/java/gregtech/api/util/oreglob/OreGlob.java +++ b/src/main/java/gregtech/api/util/oreglob/OreGlob.java @@ -2,7 +2,9 @@ import gregtech.api.unification.OreDictUnifier; import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.ApiStatus; +import javax.annotation.Nonnull; import java.util.List; import java.util.Set; import java.util.function.Function; @@ -26,12 +28,14 @@ public abstract class OreGlob { * @return Compilation result * @throws IllegalStateException If compiler is not provided yet */ - public static OreGlobCompileResult compile(String expression) { + @Nonnull + public static OreGlobCompileResult compile(@Nonnull String expression) { if (compiler == null) throw new IllegalStateException("Compiler unavailable"); return compiler.apply(expression); } - public static void setCompiler(Function compiler) { + @ApiStatus.Internal + public static void setCompiler(@Nonnull Function compiler) { OreGlob.compiler = compiler; } @@ -42,7 +46,8 @@ public static void setCompiler(Function compiler) * @param Type of visualizer * @return Visualizer */ - public abstract V visualize(V visualizer); + @Nonnull + public abstract V visualize(@Nonnull V visualizer); /** * Tries to match the given input. @@ -50,7 +55,7 @@ public static void setCompiler(Function compiler) * @param input String input * @return Whether this instance matches the input */ - public abstract boolean matches(String input); + public abstract boolean matches(@Nonnull String input); /** * Tries to match each ore dictionary entries associated with given item. @@ -62,7 +67,7 @@ public static void setCompiler(Function compiler) * @param stack Item input * @return Whether this instance matches the input */ - public final boolean matches(ItemStack stack) { + public final boolean matches(@Nonnull ItemStack stack) { Set oreDicts = OreDictUnifier.getOreDictionaryNames(stack); if (oreDicts.isEmpty()) { return matches(""); @@ -81,8 +86,9 @@ public final boolean matches(ItemStack stack) { * @return Formatted visualization * @see OreGlob#toFormattedString(String) */ + @Nonnull public final List toFormattedString() { - return toFormattedString(" "); + return visualize(new OreGlobTextBuilder(OreGlobTextFormatting.DEFAULT_FORMATTING)).getLines(); } /** @@ -91,8 +97,9 @@ public final List toFormattedString() { * @return Formatted visualization * @see OreGlob#toFormattedString() */ - public final List toFormattedString(String indent) { - return visualize(new OreGlobFormattedStringVisualizer(indent)).getLines(); + @Nonnull + public final List toFormattedString(@Nonnull String indent) { + return visualize(new OreGlobTextBuilder(OreGlobTextFormatting.DEFAULT_FORMATTING, indent)).getLines(); } /** @@ -102,41 +109,6 @@ public final List toFormattedString(String indent) { */ @Override public final String toString() { - return visualize(new OreGlobStringVisualizer()).toString(); - } - - /** - * Visualizer accepts text components from OreGlob implementation to create text representation. - */ - public interface Visualizer { - - void newLine(int indents); - - void text(String text, VisualizationHint hint); - - void number(int number, VisualizationHint hint); - - void text(int codePoint, VisualizationHint hint); - - default void text(String text) { - text(text, VisualizationHint.PLAINTEXT); - } - - default void number(int number) { - number(number, VisualizationHint.VALUE); - } - - default void text(int codePoint) { - text(codePoint, VisualizationHint.PLAINTEXT); - } - } - - public enum VisualizationHint { - PLAINTEXT, // Plain text - NODE, // Text indicating part of a node - VALUE, // Text indicating some kind of value, whether it's string or number - NEGATION, // Text indicating logical negation of the statement - LABEL, // Text indication for each label in group nodes - ERROR // Text indicating a syntax error; you shouldn't be able to see this + return String.join("\n", visualize(new OreGlobTextBuilder(OreGlobTextFormatting.NO_FORMATTING)).getLines()); } } diff --git a/src/main/java/gregtech/api/util/oreglob/OreGlobCompileResult.java b/src/main/java/gregtech/api/util/oreglob/OreGlobCompileResult.java index 8e59301b228..426f5efe4ec 100644 --- a/src/main/java/gregtech/api/util/oreglob/OreGlobCompileResult.java +++ b/src/main/java/gregtech/api/util/oreglob/OreGlobCompileResult.java @@ -40,6 +40,7 @@ public boolean hasError() { } public static final class Report implements Comparable { + private final String message; private final boolean error; private final int start; diff --git a/src/main/java/gregtech/api/util/oreglob/OreGlobFormattedStringVisualizer.java b/src/main/java/gregtech/api/util/oreglob/OreGlobFormattedStringVisualizer.java deleted file mode 100644 index 9f844d8b346..00000000000 --- a/src/main/java/gregtech/api/util/oreglob/OreGlobFormattedStringVisualizer.java +++ /dev/null @@ -1,87 +0,0 @@ -package gregtech.api.util.oreglob; - -import gregtech.api.util.oreglob.OreGlob.VisualizationHint; -import gregtech.api.util.oreglob.OreGlob.Visualizer; -import net.minecraft.util.text.TextFormatting; - -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; - -/** - * Implementation of oreGlob visualizer that outputs list of formatted strings as result. - */ -public class OreGlobFormattedStringVisualizer implements Visualizer { - - private final StringBuilder stb = new StringBuilder(); - private final List lines = new ArrayList<>(); - private final String indent; - - @Nullable - private TextFormatting lastFormatting; - - public OreGlobFormattedStringVisualizer(String indent) { - this.indent = indent; - } - - @Override - public void newLine(int indents) { - finishLine(); - for (int i = 0; i < indents; i++) { - this.stb.append(this.indent); - } - } - - @Override - public void text(String text, VisualizationHint hint) { - format(hint); - this.stb.append(text); - } - - @Override - public void number(int number, VisualizationHint hint) { - format(hint); - this.stb.append(number); - } - - @Override - public void text(int codePoint, VisualizationHint hint) { - format(hint); - this.stb.appendCodePoint(codePoint); - } - - public List getLines() { - finishLine(); - return this.lines; - } - - private void finishLine() { - this.lines.add(this.stb.append(TextFormatting.RESET).toString()); - this.stb.delete(0, this.stb.length()); - this.lastFormatting = null; - } - - private void format(VisualizationHint hint) { - TextFormatting fmt = textFormatting(hint); - if (this.lastFormatting == fmt) return; - this.lastFormatting = fmt; - this.stb.append(fmt); - } - - private TextFormatting textFormatting(VisualizationHint hint) { - switch (hint) { - case PLAINTEXT: - case LABEL: - return TextFormatting.GRAY; - case NODE: - return TextFormatting.WHITE; - case VALUE: - return TextFormatting.YELLOW; - case NEGATION: - case ERROR: - return TextFormatting.RED; - default: - throw new IllegalStateException("Unknown VisualizationHint value '" + hint + "'"); - } - } -} diff --git a/src/main/java/gregtech/api/util/oreglob/OreGlobStringVisualizer.java b/src/main/java/gregtech/api/util/oreglob/OreGlobStringVisualizer.java deleted file mode 100644 index ac852cd25e6..00000000000 --- a/src/main/java/gregtech/api/util/oreglob/OreGlobStringVisualizer.java +++ /dev/null @@ -1,49 +0,0 @@ -package gregtech.api.util.oreglob; - -import gregtech.api.util.oreglob.OreGlob.VisualizationHint; -import gregtech.api.util.oreglob.OreGlob.Visualizer; - -/** - * Implementation of oreGlob visualizer that outputs String as result. - */ -public class OreGlobStringVisualizer implements Visualizer { - - private final StringBuilder stb = new StringBuilder(); - private final String indent; - - public OreGlobStringVisualizer() { - this(" "); - } - - public OreGlobStringVisualizer(String indent) { - this.indent = indent; - } - - @Override - public void newLine(int indents) { - this.stb.append('\n'); - for (int i = 0; i < indents; i++) { - this.stb.append(this.indent); - } - } - - @Override - public void text(String text, VisualizationHint hint) { - this.stb.append(text); - } - - @Override - public void number(int number, VisualizationHint hint) { - this.stb.append(number); - } - - @Override - public void text(int codePoint, VisualizationHint hint) { - this.stb.appendCodePoint(codePoint); - } - - @Override - public String toString() { - return this.stb.toString(); - } -} diff --git a/src/main/java/gregtech/api/util/oreglob/OreGlobTextBuilder.java b/src/main/java/gregtech/api/util/oreglob/OreGlobTextBuilder.java new file mode 100644 index 00000000000..adc4b760df6 --- /dev/null +++ b/src/main/java/gregtech/api/util/oreglob/OreGlobTextBuilder.java @@ -0,0 +1,58 @@ +package gregtech.api.util.oreglob; + +import javax.annotation.Nonnull; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +/** + * Builder for OreGlob instance visualization. + */ +public class OreGlobTextBuilder { + + private final List finishedLines = new ArrayList<>(); + private final StringBuilder builder = new StringBuilder(); + private final OreGlobTextFormatting formatting; + private final String indent; + + public OreGlobTextBuilder(@Nonnull OreGlobTextFormatting formatting) { + this(formatting, " "); + } + + public OreGlobTextBuilder(@Nonnull OreGlobTextFormatting formatting, @Nonnull String indent) { + this.formatting = Objects.requireNonNull(formatting, "formatting == null"); + this.indent = Objects.requireNonNull(indent, "indent == null"); + } + + public void newLine(int indents) { + finishLine(); + // it's not intellij please shut up + // noinspection StringRepeatCanBeUsed + for (int i = 0; i < indents; i++) { + this.builder.append(this.indent); + } + } + + @Nonnull + public StringBuilder getStringBuilder() { + return this.builder; + } + + private void finishLine() { + this.finishedLines.add(this.builder.toString()); + this.builder.delete(0, this.builder.length()); + } + + @Nonnull + public OreGlobTextFormatting getFormatting() { + return formatting; + } + + @Nonnull + public List getLines() { + finishLine(); + return Collections.unmodifiableList(finishedLines); + } + +} diff --git a/src/main/java/gregtech/api/util/oreglob/OreGlobTextFormatting.java b/src/main/java/gregtech/api/util/oreglob/OreGlobTextFormatting.java new file mode 100644 index 00000000000..87fbb395e93 --- /dev/null +++ b/src/main/java/gregtech/api/util/oreglob/OreGlobTextFormatting.java @@ -0,0 +1,31 @@ +package gregtech.api.util.oreglob; + +import net.minecraft.util.text.TextFormatting; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Formatting function for OreGlob visualization. + */ +@FunctionalInterface +public interface OreGlobTextFormatting { + + /** + * Plaintext formatting. + */ + OreGlobTextFormatting NO_FORMATTING = h -> null; + /** + * Default color scheme for tooltip display. + */ + OreGlobTextFormatting DEFAULT_FORMATTING = h -> switch (h) { + case TEXT, LABEL -> TextFormatting.GRAY; + case NODE -> TextFormatting.WHITE; + case VALUE -> TextFormatting.YELLOW; + case LOGIC -> TextFormatting.GOLD; + case NOT, ERROR -> TextFormatting.RED; + }; + + @Nullable + TextFormatting getFormat(@Nonnull VisualizationHint hint); +} diff --git a/src/main/java/gregtech/api/util/oreglob/VisualizationHint.java b/src/main/java/gregtech/api/util/oreglob/VisualizationHint.java new file mode 100644 index 00000000000..83be1aa3ba8 --- /dev/null +++ b/src/main/java/gregtech/api/util/oreglob/VisualizationHint.java @@ -0,0 +1,32 @@ +package gregtech.api.util.oreglob; + +public enum VisualizationHint { + /** + * Plain text + */ + TEXT, + /** + * Text indicating part of a node + */ + NODE, + /** + * Text indicating some kind of value, whether it's string or number + */ + VALUE, + /** + * Text indicating logical negation of the statement + */ + NOT, + /** + * Text indication for each label in group nodes + */ + LABEL, + /** + * Text indication for logical operation excluding negation + */ + LOGIC, + /** + * Text indicating a syntax error; you shouldn't be able to see this + */ + ERROR +} diff --git a/src/main/java/gregtech/api/worldgen/config/BedrockFluidDepositDefinition.java b/src/main/java/gregtech/api/worldgen/config/BedrockFluidDepositDefinition.java index cc8406b326d..0fd7ad18398 100644 --- a/src/main/java/gregtech/api/worldgen/config/BedrockFluidDepositDefinition.java +++ b/src/main/java/gregtech/api/worldgen/config/BedrockFluidDepositDefinition.java @@ -2,6 +2,7 @@ import com.google.gson.JsonObject; import gregtech.api.util.GTLog; +import gregtech.api.util.LocalizationUtils; import gregtech.api.worldgen.bedrockFluids.BedrockFluidVeinHandler; import net.minecraft.world.WorldProvider; import net.minecraft.world.biome.Biome; @@ -55,7 +56,7 @@ public boolean initializeFromConfig(@Nonnull JsonObject configRoot) { } // vein name for JEI display if (configRoot.has("name")) { - this.assignedName = configRoot.get("name").getAsString(); + this.assignedName = LocalizationUtils.format(configRoot.get("name").getAsString()); } // vein description for JEI display if (configRoot.has("description")) { diff --git a/src/main/java/gregtech/api/worldgen/config/OreDepositDefinition.java b/src/main/java/gregtech/api/worldgen/config/OreDepositDefinition.java index 73a65c0f86c..dd1da1463f2 100644 --- a/src/main/java/gregtech/api/worldgen/config/OreDepositDefinition.java +++ b/src/main/java/gregtech/api/worldgen/config/OreDepositDefinition.java @@ -2,6 +2,7 @@ import com.google.gson.JsonObject; import gregtech.api.unification.ore.StoneType; +import gregtech.api.util.LocalizationUtils; import gregtech.api.util.WorldBlockPredicate; import gregtech.api.worldgen.filler.BlockFiller; import gregtech.api.worldgen.populator.IVeinPopulator; @@ -46,7 +47,7 @@ public boolean initializeFromConfig(@Nonnull JsonObject configRoot) { this.weight = configRoot.get("weight").getAsInt(); this.density = configRoot.get("density").getAsFloat(); if (configRoot.has("name")) { - this.assignedName = configRoot.get("name").getAsString(); + this.assignedName = LocalizationUtils.format(configRoot.get("name").getAsString()); } if (configRoot.has("description")) { this.description = configRoot.get("description").getAsString(); diff --git a/src/main/java/gregtech/client/renderer/texture/Textures.java b/src/main/java/gregtech/client/renderer/texture/Textures.java index d2e26042cce..70be7ff33f7 100644 --- a/src/main/java/gregtech/client/renderer/texture/Textures.java +++ b/src/main/java/gregtech/client/renderer/texture/Textures.java @@ -207,6 +207,7 @@ public class Textures { public static final SimpleOverlayRenderer FLUID_HATCH_INPUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_fluid_hatch_input"); public static final SimpleOverlayRenderer ITEM_HATCH_OUTPUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_item_hatch_output"); public static final SimpleOverlayRenderer ITEM_HATCH_INPUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_item_hatch_input"); + public static final SimpleOverlayRenderer WATER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_water"); public static final ICubeRenderer BRONZE_FIREBOX = new SidedCubeRenderer("casings/firebox/overlay/bronze"); public static final ICubeRenderer BRONZE_FIREBOX_ACTIVE = new FireboxActiveRenderer("casings/firebox/overlay/bronze/active"); @@ -286,6 +287,8 @@ public class Textures { public static final SimpleOverlayRenderer HPCA_ADVANCED_DAMAGED_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/damaged_advanced_active"); public static final SimpleOverlayRenderer HPCA_EMPTY_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/empty"); public static final SimpleOverlayRenderer HPCA_HEAT_SINK_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/heat_sink"); + public static final SimpleOverlayRenderer TAPED_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_ducttape"); + public static final SimpleOverlayRenderer COVER_INTERFACE_FLUID = new SimpleOverlayRenderer("cover/cover_interface_fluid"); public static final SimpleOverlayRenderer COVER_INTERFACE_FLUID_GLASS = new SimpleOverlayRenderer("cover/cover_interface_fluid_glass"); @@ -303,11 +306,23 @@ public class Textures { public static final SimpleOverlayRenderer ME_INPUT_HATCH = new SimpleOverlayRenderer("overlay/appeng/me_input_hatch"); public static final SimpleOverlayRenderer ME_OUTPUT_BUS = new SimpleOverlayRenderer("overlay/appeng/me_output_bus"); public static final SimpleOverlayRenderer ME_INPUT_BUS = new SimpleOverlayRenderer("overlay/appeng/me_input_bus"); - + + public static final ResourceLocation ACE_CAPE_TEXTURE = gregtechId("textures/capes/acecape.png"); + public static final ResourceLocation AGENDER_CAPE_TEXTURE = gregtechId("textures/capes/agendercape.png"); + public static final ResourceLocation AROMANTIC_CAPE_TEXTURE = gregtechId("textures/capes/aromanticcape.png"); + public static final ResourceLocation BI_CAPE_TEXTURE = gregtechId("textures/capes/bicape.png"); + public static final ResourceLocation GENDERFLUID_CAPE_TEXTURE = gregtechId("textures/capes/genderfluidcape.png"); + public static final ResourceLocation GENDERQUEER_CAPE_TEXTURE = gregtechId("textures/capes/genderqueercape.png"); + public static final ResourceLocation GREEN_CAPE_TEXTURE = gregtechId("textures/capes/greencape.png"); public static final ResourceLocation GREGTECH_CAPE_TEXTURE = gregtechId("textures/capes/gregtechcape.png"); + public static final ResourceLocation INTERSEX_CAPE_TEXTURE = gregtechId("textures/capes/intersexcape.png"); + public static final ResourceLocation LESBIAN_CAPE_TEXTURE = gregtechId("textures/capes/lesbiancape.png"); + public static final ResourceLocation NONBINARY_CAPE_TEXTURE = gregtechId("textures/capes/nonbinarycape.png"); + public static final ResourceLocation PAN_CAPE_TEXTURE = gregtechId("textures/capes/pancape.png"); + public static final ResourceLocation RAINBOW_CAPE_TEXTURE = gregtechId("textures/capes/rainbowcape.png"); public static final ResourceLocation RED_CAPE_TEXTURE = gregtechId("textures/capes/redcape.png"); + public static final ResourceLocation TRANS_CAPE_TEXTURE = gregtechId("textures/capes/transcape.png"); public static final ResourceLocation YELLOW_CAPE_TEXTURE = gregtechId("textures/capes/yellowcape.png"); - public static final ResourceLocation GREEN_CAPE_TEXTURE = gregtechId("textures/capes/greencape.png"); @SideOnly(Side.CLIENT) public static TextureAtlasSprite RESTRICTIVE_OVERLAY; diff --git a/src/main/java/gregtech/client/renderer/texture/cube/OrientedOverlayRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/OrientedOverlayRenderer.java index d9d6c89282c..a4fad1705ba 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/OrientedOverlayRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/OrientedOverlayRenderer.java @@ -16,11 +16,14 @@ import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.lang3.ArrayUtils; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; import java.util.EnumMap; import java.util.Map; @@ -60,12 +63,12 @@ public static class ActivePredicate { private final TextureAtlasSprite activeSpriteEmissive; private final TextureAtlasSprite pausedSpriteEmissive; - public ActivePredicate(TextureAtlasSprite normalSprite, - TextureAtlasSprite activeSprite, - TextureAtlasSprite pausedSprite, - TextureAtlasSprite normalSpriteEmissive, - TextureAtlasSprite activeSpriteEmissive, - TextureAtlasSprite pausedSpriteEmissive) { + public ActivePredicate(@NotNull TextureAtlasSprite normalSprite, + @NotNull TextureAtlasSprite activeSprite, + @Nullable TextureAtlasSprite pausedSprite, + @Nullable TextureAtlasSprite normalSpriteEmissive, + @Nullable TextureAtlasSprite activeSpriteEmissive, + @Nullable TextureAtlasSprite pausedSpriteEmissive) { this.normalSprite = normalSprite; this.activeSprite = activeSprite; @@ -75,7 +78,7 @@ public ActivePredicate(TextureAtlasSprite normalSprite, this.pausedSpriteEmissive = pausedSpriteEmissive; } - public TextureAtlasSprite getSprite(boolean active, boolean workingEnabled) { + public @Nullable TextureAtlasSprite getSprite(boolean active, boolean workingEnabled) { if (active) { if (workingEnabled) { return activeSprite; @@ -86,7 +89,7 @@ public TextureAtlasSprite getSprite(boolean active, boolean workingEnabled) { return normalSprite; } - public TextureAtlasSprite getEmissiveSprite(boolean active, boolean workingEnabled) { + public @Nullable TextureAtlasSprite getEmissiveSprite(boolean active, boolean workingEnabled) { if (active) { if (workingEnabled) { return activeSpriteEmissive; @@ -98,7 +101,7 @@ public TextureAtlasSprite getEmissiveSprite(boolean active, boolean workingEnabl } } - public OrientedOverlayRenderer(@Nonnull String basePath) { + public OrientedOverlayRenderer(@NotNull String basePath) { this.basePath = basePath; Textures.CUBE_RENDERER_REGISTRY.put(basePath, this); Textures.iconRegisters.add(this); @@ -116,6 +119,7 @@ public void registerIcons(TextureMap textureMap) { basePath = split[1]; } + boolean foundTexture = false; for (OverlayFace overlayFace : OverlayFace.VALUES) { final String faceName = overlayFace.name().toLowerCase(); final String overlayPath = String.format("blocks/%s/overlay_%s", basePath, faceName); @@ -125,11 +129,18 @@ public void registerIcons(TextureMap textureMap) { // require the normal texture to get the rest if (normalSprite == null) continue; + foundTexture = true; + // normal final String active = String.format("%s_active", overlayPath); TextureAtlasSprite activeSprite = ICubeRenderer.getResource(textureMap, modID, active); + if (activeSprite == null) { + FMLClientHandler.instance().trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/overlay_" + overlayFace.toString().toLowerCase() + "_active")); + continue; + } + final String paused = String.format("%s_paused", overlayPath); TextureAtlasSprite pausedSprite = ICubeRenderer.getResource(textureMap, modID, paused); @@ -144,6 +155,10 @@ public void registerIcons(TextureMap textureMap) { sprites.put(overlayFace, new ActivePredicate(normalSprite, activeSprite, pausedSprite, normalSpriteEmissive, activeSpriteEmissive, pausedSpriteEmissive)); } + + if (!foundTexture) { + FMLClientHandler.instance().trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/overlay_OVERLAY_FACE")); + } } @Override diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SidedCubeRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SidedCubeRenderer.java index eb02e1f9c39..6f7e64df9c5 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SidedCubeRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SidedCubeRenderer.java @@ -15,6 +15,8 @@ import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.lang3.ArrayUtils; @@ -53,6 +55,7 @@ public void registerIcons(TextureMap textureMap) { this.sprites = new EnumMap<>(OverlayFace.class); this.spritesEmissive = new EnumMap<>(OverlayFace.class); + boolean foundTexture = false; for (OverlayFace overlayFace : OverlayFace.VALUES) { final String faceName = overlayFace.name().toLowerCase(); final String overlayPath = String.format(BASE_DIR, basePath, faceName); @@ -61,10 +64,16 @@ public void registerIcons(TextureMap textureMap) { // require the normal texture to get the rest if (normalSprite == null) continue; + foundTexture = true; + sprites.put(overlayFace, normalSprite); spritesEmissive.put(overlayFace, ICubeRenderer.getResource(textureMap, modID, overlayPath + EMISSIVE)); } + + if (!foundTexture) { + FMLClientHandler.instance().trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/OVERLAY_FACE")); + } } @Override diff --git a/src/main/java/gregtech/common/CommonProxy.java b/src/main/java/gregtech/common/CommonProxy.java index 9fc541afbbf..c2bc6e6dd0a 100644 --- a/src/main/java/gregtech/common/CommonProxy.java +++ b/src/main/java/gregtech/common/CommonProxy.java @@ -11,12 +11,14 @@ import gregtech.api.recipes.recipeproperties.FusionEUToStartProperty; import gregtech.api.terminal.TerminalRegistry; import gregtech.api.unification.material.Material; +import gregtech.api.unification.material.info.MaterialFlags; import gregtech.api.unification.material.properties.DustProperty; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.material.registry.MaterialRegistry; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.ore.StoneType; import gregtech.api.unification.stack.ItemMaterialInfo; +import gregtech.api.util.AssemblyLineManager; import gregtech.api.util.GTLog; import gregtech.common.blocks.*; import gregtech.common.items.MetaItems; @@ -76,7 +78,7 @@ public static void registerBlocks(RegistryEvent.Register event) { for (MaterialRegistry materialRegistry : GregTechAPI.materialManager.getRegistries()) { for (Material material : materialRegistry) { - if (material.hasProperty(PropertyKey.ORE)) { + if (material.hasProperty(PropertyKey.ORE) && !material.hasFlag(MaterialFlags.DISABLE_ORE_BLOCK)) { createOreBlock(material); } @@ -286,6 +288,9 @@ public static void registerRecipes(RegistryEvent.Register event) { FusionEUToStartProperty.registerFusionTier(7, "(MK2)"); FusionEUToStartProperty.registerFusionTier(8, "(MK3)"); + // Register data stick copying custom scanner logic + AssemblyLineManager.registerScannerLogic(); + GTLog.logger.info("Registering ore dictionary..."); MetaItems.registerOreDict(); diff --git a/src/main/java/gregtech/common/ConfigHolder.java b/src/main/java/gregtech/common/ConfigHolder.java index fe16de9b446..ecfd6aeda49 100644 --- a/src/main/java/gregtech/common/ConfigHolder.java +++ b/src/main/java/gregtech/common/ConfigHolder.java @@ -4,7 +4,7 @@ import gregtech.api.GregTechAPI; import net.minecraftforge.common.config.Config; -@Config(modid = GTValues.MODID) +@Config(modid = GTValues.MODID, name = GTValues.MODID + '/' + GTValues.MODID) public class ConfigHolder { @Config.Comment("Config options for client-only features") @@ -31,6 +31,7 @@ public class ConfigHolder { @Config.RequiresMcRestart public static RecipeOptions recipes = new RecipeOptions(); + //TODO move to ToolsModule config @Config.Comment("Config options for Tools and Armor") @Config.Name("Tool and Armor Options") @Config.RequiresMcRestart @@ -238,11 +239,15 @@ public static class RecipeOptions { @Config.Comment({"Whether to remove Vanilla Block Recipes from the Crafting Table.", "Default: false"}) public boolean removeVanillaBlockRecipes = false; - @Config.Comment({"Whether to make crafting recipes for Bricks, Firebricks, and Coke Bricks harder.", "Default: false"}) + @Config.Comment({"Whether to make crafting recipes for Bricks, Nether Bricks, Firebricks, and Coke Bricks harder.", "Default: false"}) public boolean harderBrickRecipes = false; @Config.Comment({"Whether to make the recipe for the EBF Controller harder.", "Default: false"}) public boolean harderEBFControllerRecipe = false; + + @Config.Comment({"How many Multiblock Casings to make per craft. Either 1, 2, or 3.", "Default: 2"}) + @Config.RangeInt(min = 1, max = 3) + public int casingsPerCraft = 2; } public static class CompatibilityOptions { diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergy.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergy.java index 4ca57ecb0ac..489a5679da4 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergy.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergy.java @@ -9,18 +9,41 @@ import gregtech.api.cover.ICoverable; import gregtech.api.util.RedstoneUtil; import gregtech.client.renderer.texture.Textures; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityPowerSubstation; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; public class CoverDetectorEnergy extends CoverDetectorBase implements ITickable { + public CoverDetectorEnergy(ICoverable coverHolder, EnumFacing attachedSide) { super(coverHolder, attachedSide); } @Override public boolean canAttach() { - return coverHolder.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null) != null; + return coverHolder.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null) != null + || coverHolder instanceof MetaTileEntityPowerSubstation; + } + + public long getCoverHolderCapacity() { + if (coverHolder instanceof MetaTileEntityPowerSubstation pss) { + return pss.getCapacityLong(); + } else { + IEnergyContainer energyContainer = coverHolder.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); + if (energyContainer != null) return energyContainer.getEnergyCapacity(); + } + return 0; + } + + public long getCoverHolderStored() { + if (coverHolder instanceof MetaTileEntityPowerSubstation pss) { + return pss.getStoredLong(); + } else { + IEnergyContainer energyContainer = coverHolder.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); + if (energyContainer != null) return energyContainer.getEnergyStored(); + } + return 0; } @Override @@ -33,15 +56,11 @@ public void update() { if (this.coverHolder.getOffsetTimer() % 20 != 0) return; - IEnergyContainer energyContainer = coverHolder.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); - if (energyContainer != null) { - long storedEnergy = energyContainer.getEnergyStored(); - long energyCapacity = energyContainer.getEnergyCapacity(); + long storedEnergy = getCoverHolderStored(); + long energyCapacity = getCoverHolderCapacity(); - if (energyCapacity == 0) - return; + if (energyCapacity == 0) return; - setRedstoneSignalOutput(RedstoneUtil.computeRedstoneValue(storedEnergy, energyCapacity, isInverted())); - } + setRedstoneSignalOutput(RedstoneUtil.computeRedstoneValue(storedEnergy, energyCapacity, isInverted())); } } diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java index 94011497d54..8c626a28295 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java @@ -5,8 +5,6 @@ import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Cuboid6; import codechicken.lib.vec.Matrix4; -import gregtech.api.capability.GregtechCapabilities; -import gregtech.api.capability.IEnergyContainer; import gregtech.api.cover.CoverWithUI; import gregtech.api.cover.ICoverable; import gregtech.api.gui.GuiTextures; @@ -63,19 +61,19 @@ public EnumActionResult onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, public void update() { if (coverHolder.getOffsetTimer() % 20 != 0) return; - IEnergyContainer energyContainer = coverHolder.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); - if (energyContainer != null) { - if (usePercent) { - if (energyContainer.getEnergyCapacity() > 0) { - float ratio = (float) energyContainer.getEnergyStored() / energyContainer.getEnergyCapacity(); - this.outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(ratio * 100, this.maxValue, this.minValue, isInverted(), this.outputAmount); - } else { - this.outputAmount = isInverted() ? 0 : 15; - } + long storedEnergy = getCoverHolderStored(); + long energyCapacity = getCoverHolderCapacity(); + + if (usePercent) { + if (energyCapacity > 0) { + float ratio = (float) storedEnergy / energyCapacity; + this.outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(ratio * 100, this.maxValue, this.minValue, isInverted(), this.outputAmount); } else { - this.outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(energyContainer.getEnergyStored(), - this.maxValue, this.minValue, isInverted(), this.outputAmount); + this.outputAmount = isInverted() ? 0 : 15; } + } else { + this.outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(storedEnergy, + this.maxValue, this.minValue, isInverted(), this.outputAmount); } setRedstoneSignalOutput(outputAmount); } diff --git a/src/main/java/gregtech/common/covers/filter/OreDictionaryItemFilter.java b/src/main/java/gregtech/common/covers/filter/OreDictionaryItemFilter.java index aaed2e95e9b..095e27ce06d 100644 --- a/src/main/java/gregtech/common/covers/filter/OreDictionaryItemFilter.java +++ b/src/main/java/gregtech/common/covers/filter/OreDictionaryItemFilter.java @@ -85,35 +85,29 @@ public void initUI(Consumer widgetGroup) { String t = h.getOriginalText(); for (int i = 0; i < t.length(); i++) { switch (t.charAt(i)) { - case '|': case '&': case '^': case '(': case ')': - h.format(i, TextFormatting.GOLD); - break; - case '*': case '?': - h.format(i, TextFormatting.GREEN); - break; - case '!': - h.format(i, TextFormatting.RED); - break; - case '\\': - h.format(i++, TextFormatting.YELLOW); - break; - case '$': { + case '|', '&', '^', '(', ')' -> h.format(i, TextFormatting.GOLD); + case '*', '?' -> h.format(i, TextFormatting.GREEN); + case '!' -> h.format(i, TextFormatting.RED); + case '\\' -> h.format(i++, TextFormatting.YELLOW); + case '$' -> { h.format(i, TextFormatting.DARK_GREEN); for (; i < t.length(); i++) { switch (t.charAt(i)) { - case ' ': case '\t': case '\n': case '\r': - break; - case '\\': + case ' ', '\t', '\n', '\r' -> {} + case '\\' -> { i++; - default: continue; + } + default -> { + continue; + } } break; } - break; } - default: + default -> { continue; + } } h.format(i + 1, TextFormatting.RESET); } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/ImpossibleOreGlob.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/ImpossibleOreGlob.java index bf925694e71..ac8b668d1d4 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/ImpossibleOreGlob.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/ImpossibleOreGlob.java @@ -1,6 +1,9 @@ package gregtech.common.covers.filter.oreglob.impl; import gregtech.api.util.oreglob.OreGlob; +import gregtech.api.util.oreglob.OreGlobTextBuilder; + +import javax.annotation.Nonnull; /** * Simple implementation of oreglob that doesn't match anything. @@ -13,14 +16,15 @@ public static ImpossibleOreGlob getInstance() { return INSTANCE; } + @Nonnull @Override - public V visualize(V visualizer) { + public V visualize(@Nonnull V visualizer) { NodeVisualizer.impossible(visualizer); return visualizer; } @Override - public boolean matches(String input) { + public boolean matches(@Nonnull String input) { return false; } } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeInterpreter.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeInterpreter.java index f8b7b9b6fee..c2ddfd701d4 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeInterpreter.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeInterpreter.java @@ -1,6 +1,6 @@ package gregtech.common.covers.filter.oreglob.impl; -import gregtech.common.covers.filter.oreglob.node.BranchNode.BranchType; +import gregtech.common.covers.filter.oreglob.node.BranchType; import gregtech.common.covers.filter.oreglob.node.NodeVisitor; import gregtech.common.covers.filter.oreglob.node.OreGlobNode; import it.unimi.dsi.fastutil.ints.*; @@ -55,9 +55,10 @@ NodeInterpreter evaluate(OreGlobNode root) { while (root != null) { if (first) first = false; else swapStateBuffer(); - root = root.visit(this); + root.visit(this); if (this.outputStates.isEmpty()) break; // If no output states are provided after visiting, the match is aborted + root = root.getNext(); } return this; } @@ -138,7 +139,7 @@ public void group(OreGlobNode node, boolean not) { @Override public void branch(BranchType type, List nodes, boolean not) { switch (type) { - case OR: { + case OR -> { // Compute max possible state for short circuit - if outputState of one branch is equal to U then // the entire set of possible output state is covered. // Max amount of states possible from current input states is equal to @@ -149,9 +150,8 @@ public void branch(BranchType type, List nodes, boolean not) { this.outputStates.addAll(branchState.outputStates); if (this.outputStates.size() >= maxPossibleBranches) break; // Already max } - break; } - case AND: { + case AND -> { boolean first = true; for (OreGlobNode node : nodes) { NodeInterpreter branchState = new NodeInterpreter(this.input, this.inputStates).evaluate(node); @@ -163,9 +163,8 @@ public void branch(BranchType type, List nodes, boolean not) { } if (this.outputStates.isEmpty()) break; // Short circuit } - break; } - case XOR: + case XOR -> { for (OreGlobNode node : nodes) { NodeInterpreter branchState = new NodeInterpreter(this.input, this.inputStates).evaluate(node); @@ -174,9 +173,8 @@ public void branch(BranchType type, List nodes, boolean not) { this.outputStates.removeAll(branchState.outputStates); // out = { x in out AND x !in out2 } this.outputStates.addAll(out2); // out = { ( x in out AND x !in out2 ) OR ( x in out2 AND x !in out ) } } - break; - default: - throw new IllegalStateException("Unknown BranchType '" + type + "'"); + } + default -> throw new IllegalStateException("Unknown BranchType '" + type + "'"); } if (not) negate(); } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeOreGlob.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeOreGlob.java index e133c5f5d0e..8af400e4b7b 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeOreGlob.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeOreGlob.java @@ -2,8 +2,11 @@ import com.google.common.annotations.VisibleForTesting; import gregtech.api.util.oreglob.OreGlob; +import gregtech.api.util.oreglob.OreGlobTextBuilder; import gregtech.common.covers.filter.oreglob.node.OreGlobNode; +import javax.annotation.Nonnull; + /** * Node-based implementation of oreglob. */ @@ -11,7 +14,7 @@ public final class NodeOreGlob extends OreGlob { private final OreGlobNode root; - public NodeOreGlob(OreGlobNode root) { + public NodeOreGlob(@Nonnull OreGlobNode root) { this.root = root; } @@ -20,14 +23,15 @@ public OreGlobNode getRoot() { return root; } + @Nonnull @Override - public V visualize(V visualizer) { + public V visualize(@Nonnull V visualizer) { new NodeVisualizer(visualizer).visit(this.root); return visualizer; } @Override - public boolean matches(String input) { + public boolean matches(@Nonnull String input) { return new NodeInterpreter(input).evaluate(this.root).isMatch(); } } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualXMLHandler.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualXMLHandler.java new file mode 100644 index 00000000000..8475fe47572 --- /dev/null +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualXMLHandler.java @@ -0,0 +1,137 @@ +package gregtech.common.covers.filter.oreglob.impl; + +import gregtech.api.util.oreglob.OreGlobTextBuilder; +import gregtech.api.util.oreglob.VisualizationHint; +import net.minecraft.util.text.TextFormatting; +import org.xml.sax.Attributes; +import org.xml.sax.helpers.DefaultHandler; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.List; + +final class NodeVisualXMLHandler extends DefaultHandler { + + private final OreGlobTextBuilder builder; + private final List formatStack = new ArrayList<>(); + private boolean start; + @Nullable + private Formatting lastAppliedFormatting; + + NodeVisualXMLHandler(@Nonnull OreGlobTextBuilder builder) { + this.builder = builder; + } + + @Override + public void startElement(String uri, String localName, String qName, Attributes attributes) { + switch (qName) { + case "text" -> pushFormatting(VisualizationHint.TEXT); + case "node" -> pushFormatting(VisualizationHint.NODE); + case "value" -> pushFormatting(VisualizationHint.VALUE); + case "not" -> pushFormatting(VisualizationHint.NOT); + case "label" -> pushFormatting(VisualizationHint.LABEL); + case "logic" -> pushFormatting(VisualizationHint.LOGIC); + case "error" -> pushFormatting(VisualizationHint.ERROR); + case "root" -> { + if (!start) start = true; + else appendXmlError("Unknown element: "); + } + default -> appendXmlError("Unknown element: <" + qName + ">"); + } + } + + @Override + public void endElement(String uri, String localName, String qName) { + if (!switch (qName) { + case "text" -> popFormatting(VisualizationHint.TEXT); + case "node" -> popFormatting(VisualizationHint.NODE); + case "value" -> popFormatting(VisualizationHint.VALUE); + case "not" -> popFormatting(VisualizationHint.NOT); + case "label" -> popFormatting(VisualizationHint.LABEL); + case "logic" -> popFormatting(VisualizationHint.LOGIC); + case "error" -> popFormatting(VisualizationHint.ERROR); + default -> true; + }) { + appendXmlError("Cannot end formatting: <" + qName + ">"); + } + } + + @Override + public void characters(char[] ch, int start, int length) { + applyFormatting(); + this.builder.getStringBuilder().append(ch, start, length); + } + + @Override + public void ignorableWhitespace(char[] ch, int start, int length) { + this.builder.getStringBuilder().append(ch, start, length); // respect whitespaces + } + + @Nullable + private Formatting getActiveFormatting() { + return this.formatStack.isEmpty() ? null : this.formatStack.get(this.formatStack.size() - 1); + } + + private void pushFormatting(@Nonnull VisualizationHint hint) { + Formatting prev = getActiveFormatting(); + + TextFormatting color = this.builder.getFormatting().getFormat(hint); + this.formatStack.add(new Formatting(hint, + color != null ? color : prev != null ? prev.format : null)); + } + + private boolean popFormatting(@Nullable VisualizationHint hint) { + Formatting activeFormatting = getActiveFormatting(); + if (activeFormatting != null && activeFormatting.visualizationHint == hint) { + this.formatStack.remove(this.formatStack.size() - 1); + return true; + } else { + return false; + } + } + + private void applyFormatting() { + Formatting formatting = getActiveFormatting(); + if (formatting == null ? + this.lastAppliedFormatting == null || this.lastAppliedFormatting.isSame(null) : + formatting.isSame(this.lastAppliedFormatting)) { + return; // same formatting, no need to update + } + if (formatting != null) { + formatting.apply(this.builder.getStringBuilder()); + } else { + this.builder.getStringBuilder().append(TextFormatting.RESET); + } + this.lastAppliedFormatting = formatting; + } + + private void appendXmlError(@Nonnull String text) { + pushFormatting(VisualizationHint.ERROR); + applyFormatting(); + this.builder.getStringBuilder().append("** ").append(text).append(" **"); + popFormatting(VisualizationHint.ERROR); + } + + private static final class Formatting { + + @Nullable + final VisualizationHint visualizationHint; + + @Nullable + final TextFormatting format; + + private Formatting(@Nullable VisualizationHint visualizationHint, @Nullable TextFormatting format) { + this.visualizationHint = visualizationHint; + this.format = format; + } + + public void apply(@Nonnull StringBuilder stringBuilder) { + stringBuilder.append(format); + } + + public boolean isSame(@Nullable Formatting other) { + return other == null ? this.format == null : this.format == other.format; + } + } +} diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualizer.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualizer.java index d6cafe3e6bc..24365e243aa 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualizer.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualizer.java @@ -1,23 +1,34 @@ package gregtech.common.covers.filter.oreglob.impl; -import gregtech.api.util.oreglob.OreGlob; -import gregtech.common.covers.filter.oreglob.node.BranchNode.BranchType; +import gregtech.api.util.GTLog; +import gregtech.api.util.LocalizationUtils; +import gregtech.api.util.oreglob.OreGlobTextBuilder; +import gregtech.common.covers.filter.oreglob.node.BranchType; import gregtech.common.covers.filter.oreglob.node.NodeVisitor; import gregtech.common.covers.filter.oreglob.node.OreGlobNode; - +import org.xml.sax.SAXException; + +import javax.annotation.Nullable; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.List; -import static gregtech.api.util.oreglob.OreGlob.VisualizationHint.*; - class NodeVisualizer implements NodeVisitor { - private final OreGlob.Visualizer visualizer; + + private static boolean xmlParserErrorReported; + + private final OreGlobTextBuilder visualizer; private final int indents; - NodeVisualizer(OreGlob.Visualizer visualizer) { + NodeVisualizer(OreGlobTextBuilder visualizer) { this(visualizer, 0); } - NodeVisualizer(OreGlob.Visualizer visualizer, int indents) { + NodeVisualizer(OreGlobTextBuilder visualizer, int indents) { this.visualizer = visualizer; this.indents = indents; } @@ -28,44 +39,36 @@ void visit(OreGlobNode node) { if (first) first = false; else { visualizer.newLine(indents); - visualizer.text("... followed by "); + appendNodeXML(visualizer, OreGlobMessages.PREVIEW_NEXT); } - node = node.visit(this); + node.visit(this); + node = node.getNext(); } } @Override public void match(String match, boolean ignoreCase, boolean not) { - if (not) visualizer.text("not ", NEGATION); - visualizer.text("'", NODE); - visualizer.text(match, VALUE); - visualizer.text("'", NODE); + appendNodeXML(visualizer, not ? OreGlobMessages.PREVIEW_MATCH_NOT : OreGlobMessages.PREVIEW_MATCH, match); } @Override public void chars(int amount, boolean not) { - if (not) visualizer.text("either more or less than ", NEGATION); - visualizer.number(amount, VALUE); - visualizer.text(amount == 1 ? " character" : " characters", NODE); + if (amount == 1) { + appendNodeXML(visualizer, not ? OreGlobMessages.PREVIEW_CHAR_NOT : OreGlobMessages.PREVIEW_CHAR); + } else { + appendNodeXML(visualizer, not ? OreGlobMessages.PREVIEW_CHARS_NOT : OreGlobMessages.PREVIEW_CHARS, amount); + } } @Override public void charsOrMore(int amount, boolean not) { - if (not) { - visualizer.text("less than ", NODE); - visualizer.number(amount); - visualizer.text(" characters", NODE); - } else { - visualizer.number(amount); - visualizer.text(" or more characters", NODE); - } + appendNodeXML(visualizer, not ? OreGlobMessages.PREVIEW_CHARS_OR_MORE_NOT : OreGlobMessages.PREVIEW_CHARS_OR_MORE, amount); } @Override public void group(OreGlobNode node, boolean not) { if (not) { - visualizer.text("not", NEGATION); - visualizer.text(":", NODE); + appendNodeXML(visualizer, OreGlobMessages.PREVIEW_GROUP_NOT); visualizer.newLine(indents + 1); new NodeVisualizer(visualizer, indents + 1).visit(node); } else { @@ -76,67 +79,42 @@ public void group(OreGlobNode node, boolean not) { @Override public void branch(BranchType type, List nodes, boolean not) { switch (type) { - case OR: - if (not) { - visualizer.text("anything that ", NODE); - visualizer.text("isn't", NEGATION); - visualizer.text(" one of...", NODE); - } else { - visualizer.text("one of...", NODE); - } + case OR -> { + appendNodeXML(visualizer, not ? OreGlobMessages.PREVIEW_NOR : OreGlobMessages.PREVIEW_OR); for (int i = 0; i < nodes.size(); i++) { OreGlobNode node = nodes.get(i); visualizer.newLine(indents); - if (i == 0) { - visualizer.text("> ", LABEL); - } else { - visualizer.text("> or ", LABEL); - } + appendNodeXML(visualizer, i == 0 ? OreGlobMessages.PREVIEW_OR_ENTRY_START : OreGlobMessages.PREVIEW_OR_ENTRY); new NodeVisualizer(visualizer, indents + 1).visit(node); } - return; - case AND: - if (not) { - visualizer.text("anything that ", NODE); - visualizer.text("isn't", NEGATION); - visualizer.text("...", NODE); - } else { - visualizer.text("anything that is...", NODE); - } + } + case AND -> { + appendNodeXML(visualizer, not ? OreGlobMessages.PREVIEW_NAND : OreGlobMessages.PREVIEW_AND); for (int i = 0; i < nodes.size(); i++) { OreGlobNode node = nodes.get(i); visualizer.newLine(indents); - if (i == 0) { - visualizer.text("> ", LABEL); - } else { - visualizer.text("> and ", LABEL); - } + appendNodeXML(visualizer, i == 0 ? OreGlobMessages.PREVIEW_AND_ENTRY_START : OreGlobMessages.PREVIEW_AND_ENTRY); new NodeVisualizer(visualizer, indents + 1).visit(node); } - return; - case XOR: - if (not) { - visualizer.text("either both or none of...", NEGATION); - } else { - visualizer.text("only one of...", NODE); - } + } + case XOR -> { + appendNodeXML(visualizer, not ? OreGlobMessages.PREVIEW_XNOR : OreGlobMessages.PREVIEW_XOR); // Needs to do special things because the cursed nature of XOR makes it // impossible to display them in neat, organized fashion for (int i = 0; i < nodes.size() - 1; i++) { visualizer.newLine(indents + i); - visualizer.text("> ", LABEL); + appendNodeXML(visualizer, OreGlobMessages.PREVIEW_XOR_ENTRY); new NodeVisualizer(visualizer, indents + i + 1).visit(nodes.get(i)); visualizer.newLine(indents + i); - visualizer.text("> ", LABEL); + appendNodeXML(visualizer, OreGlobMessages.PREVIEW_XOR_ENTRY); if (i == nodes.size() - 2) { // append last entry new NodeVisualizer(visualizer, indents + i + 1).visit(nodes.get(nodes.size() - 1)); } else { // append another XOR text - visualizer.text("only one of...", NODE); + appendNodeXML(visualizer, OreGlobMessages.PREVIEW_XOR); } } - return; - default: - throw new IllegalStateException("Unknown BranchType '" + type + "'"); + } + default -> throw new IllegalStateException("Unknown BranchType '" + type + "'"); } } @@ -165,23 +143,104 @@ public void error() { error(this.visualizer); } - public static void everything(OreGlob.Visualizer visualizer) { - visualizer.text("anything", NODE); + public static void everything(OreGlobTextBuilder visualizer) { + appendNodeXML(visualizer, OreGlobMessages.PREVIEW_EVERYTHING); + } + + public static void impossible(OreGlobTextBuilder visualizer) { + appendNodeXML(visualizer, OreGlobMessages.PREVIEW_IMPOSSIBLE); } - public static void impossible(OreGlob.Visualizer visualizer) { - visualizer.text("(impossible to match)", NEGATION); + public static void nonempty(OreGlobTextBuilder visualizer) { + appendNodeXML(visualizer, OreGlobMessages.PREVIEW_NONEMPTY); } - public static void nonempty(OreGlob.Visualizer visualizer) { - visualizer.text("something", NODE); + public static void empty(OreGlobTextBuilder visualizer) { + appendNodeXML(visualizer, OreGlobMessages.PREVIEW_EMPTY); } - public static void empty(OreGlob.Visualizer visualizer) { - visualizer.text("nothing", NEGATION); + public static void error(OreGlobTextBuilder visualizer) { + appendNodeXML(visualizer, OreGlobMessages.PREVIEW_ERROR); } - public static void error(OreGlob.Visualizer visualizer) { - visualizer.text("ERROR!", ERROR); + // To provide flexible localization option while keeping benefits of + // dynamic text highlighting, a domain specific language is used. + // The translated result will be parsed as XML document, which will + // be subsequently translated to string representation using color + // scheme defined by visualizer. Visualization hint is expressed using + // tags, and the inner contents of tags are appended to the builder + // with appropriate formatting applied. + private static void appendNodeXML(OreGlobTextBuilder visualizer, String key, Object... args) { + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setNamespaceAware(false); + factory.setXIncludeAware(false); + factory.setValidating(false); + try { + // great naming as always + SAXParser saxParser = factory.newSAXParser(); + + Object[] args2 = new Object[args.length]; + for (int i = 0; i < args.length; i++) { + args2[i] = toSanitizedString(args[i]); + } + + String xml = "" + LocalizationUtils.format(key, args2) + ""; + + saxParser.parse(new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)), + new NodeVisualXMLHandler(visualizer)); + return; + } catch (ParserConfigurationException | SAXException ex) { + // building parser can fail and i should expect that in code??? bruh + if (!xmlParserErrorReported) { + xmlParserErrorReported = true; + GTLog.logger.error("Unable to create XML parser", ex); + } + } catch (IOException impossible) { + // no-op + } + // fallback: just append localization result + visualizer.getStringBuilder().append(LocalizationUtils.format(key, args)); + } + + @Nullable + private static String toSanitizedString(@Nullable Object o) { + if (o == null) return null; + String s = o.toString(); + // most of the strings are XML-compatible, so lazy-initialize StringBuilder to minimize resource usage + StringBuilder stb = null; + + for (int i = 0; i < s.length(); i += Character.isSurrogate(s.charAt(i)) ? 2 : 1) { + int codePoint = s.codePointAt(i); + + // valid XML chars + if (codePoint == '\t' || + codePoint == '\n' || + codePoint == '\r' || + (codePoint >= 0x20 && codePoint <= 0xD7FF) || + (codePoint >= 0xE000 && codePoint <= 0xFFFD) || + (codePoint >= 0x10000 && codePoint <= 0x10FFFF)) { + switch (codePoint) { + case '<', '>', '&' -> { // special characters + if (stb == null) { + stb = new StringBuilder(); + stb.append(s, 0, i); + } + stb.append(switch (codePoint) { + case '<' -> "<"; + case '>' -> ">"; + case '&' -> "&"; + default -> throw new IllegalStateException("Unreachable"); + }); + } + default -> { + if (stb != null) { + stb.appendCodePoint(codePoint); + } + } + } + } + } + + return stb == null ? s : stb.toString(); } } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobMessages.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobMessages.java new file mode 100644 index 00000000000..6b3da3ca6fd --- /dev/null +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobMessages.java @@ -0,0 +1,146 @@ +package gregtech.common.covers.filter.oreglob.impl; + +import gregtech.api.util.LocalizationUtils; + +import java.util.Locale; + +interface OreGlobMessages { + + String PREFIX = "cover.ore_dictionary_filter."; + + String COMPILE_PREFIX = PREFIX + "compile."; + String COMPILE_ERROR_PREFIX = COMPILE_PREFIX + "error."; + String COMPILE_WARN_PREFIX = COMPILE_PREFIX + "warn."; + String PREVIEW_PREFIX = PREFIX + "preview."; + + // ... followed by + String PREVIEW_NEXT = PREVIEW_PREFIX + "next"; + + // '%s' + String PREVIEW_MATCH = PREVIEW_PREFIX + "match"; + // not '%s' + String PREVIEW_MATCH_NOT = PREVIEW_PREFIX + "match.not"; + + // 1 character + String PREVIEW_CHAR = PREVIEW_PREFIX + "char"; + // either more than 1 character or nothing + String PREVIEW_CHAR_NOT = PREVIEW_PREFIX + "char.not"; + + // %s characters + String PREVIEW_CHARS = PREVIEW_PREFIX + "chars"; + // either more or less than %s characters + String PREVIEW_CHARS_NOT = PREVIEW_PREFIX + "chars.not"; + + // %s or more characters + String PREVIEW_CHARS_OR_MORE = PREVIEW_PREFIX + "chars_or_more"; + // less than %s characters + String PREVIEW_CHARS_OR_MORE_NOT = PREVIEW_PREFIX + "chars_or_more.not"; + + // not: + String PREVIEW_GROUP_NOT = PREVIEW_PREFIX + "group"; + + // one of... + String PREVIEW_OR = PREVIEW_PREFIX + "or"; + // anything that isn't one of... + String PREVIEW_NOR = PREVIEW_PREFIX + "nor"; + + // + String PREVIEW_OR_ENTRY = PREVIEW_PREFIX + "or.entry"; + // + String PREVIEW_OR_ENTRY_START = PREVIEW_PREFIX + "or.entry.start"; + + // anything that is... + String PREVIEW_AND = PREVIEW_PREFIX + "and"; + // anything that isn't... + String PREVIEW_NAND = PREVIEW_PREFIX + "nand"; + + // + String PREVIEW_AND_ENTRY = PREVIEW_PREFIX + "and.entry"; + // + String PREVIEW_AND_ENTRY_START = PREVIEW_PREFIX + "and.entry.start"; + + // only one of... + String PREVIEW_XOR = PREVIEW_PREFIX + "xor"; + // either both or none of... + String PREVIEW_XNOR = PREVIEW_PREFIX + "xnor"; + + // + String PREVIEW_XOR_ENTRY = PREVIEW_PREFIX + "xor.entry"; + + // anything + String PREVIEW_EVERYTHING = PREVIEW_PREFIX + "everything"; + + // (impossible to match) + String PREVIEW_IMPOSSIBLE = PREVIEW_PREFIX + "impossible"; + + // something + String PREVIEW_NONEMPTY = PREVIEW_PREFIX + "nonempty"; + + // nothing + String PREVIEW_EMPTY = PREVIEW_PREFIX + "empty"; + + // ERROR! + String PREVIEW_ERROR = PREVIEW_PREFIX + "error"; + + static String compileEOF() { + // ** End of line ** + return LocalizationUtils.format(COMPILE_PREFIX + "eof"); + } + + static String compileErrorUnexpectedEOF() { + // Unexpected end of expression + return LocalizationUtils.format(COMPILE_ERROR_PREFIX + "unexpected_eof"); + } + + static String compileErrorUnexpectedToken(String token) { + // Unexpected token '%s' + return LocalizationUtils.format(COMPILE_ERROR_PREFIX + "unexpected_token", token); + } + + static String compileErrorUnexpectedTokenAfterEOF(String token) { + // Unexpected token '%s' after end of expression + return LocalizationUtils.format(COMPILE_ERROR_PREFIX + "unexpected_token_after_eof", token); + } + + static String compileErrorUnexpectedCompilationFlag() { + // Compilation flags in the middle of expression + return LocalizationUtils.format(COMPILE_ERROR_PREFIX + "unexpected_compilation_flag"); + } + + static String compileErrorEmptyCompilationFlag() { + // No compilation flags given + return LocalizationUtils.format(COMPILE_ERROR_PREFIX + "empty_compilation_flag"); + } + + static String compileErrorUnknownCompilationFlag(String flag) { + // Unknown compilation flag '%s' + return LocalizationUtils.format(COMPILE_ERROR_PREFIX + "unknown_compilation_flag", flag); + } + + static String compileErrorRedundantCompilationFlag(String flag) { + // Compilation flag '%s' written twice + return LocalizationUtils.format(COMPILE_ERROR_PREFIX + "redundant_compilation_flag", flag); + } + + static String compileErrorEOFAfterEscape() { + // End of file after escape character ('\\') + return LocalizationUtils.format(COMPILE_ERROR_PREFIX + "eof_after_escape"); + } + + static String compileErrorInvalidChar(int codepoint) { + // Invalid character U+%s('%s') + return LocalizationUtils.format(COMPILE_ERROR_PREFIX + "invalid_char", + Integer.toHexString(codepoint).toUpperCase(Locale.ROOT), + new StringBuilder().appendCodePoint(codepoint).toString()); + } + + static String compileWarnNestedNegation() { + // Nested negations can be unintuitive. Consider using groups ( () ) to eliminate ambiguity. + return LocalizationUtils.format(COMPILE_WARN_PREFIX + "nested_negation"); + } + + static String compileWarnConsecutiveNegation() { + // Consecutive negations can be unintuitive. Please check if the evaluation result is desirable. + return LocalizationUtils.format(COMPILE_WARN_PREFIX + "consecutive_negation"); + } +} diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobParser.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobParser.java index 105754cea30..48bb123464b 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobParser.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobParser.java @@ -2,7 +2,6 @@ import gregtech.api.util.oreglob.OreGlobCompileResult; import gregtech.api.util.oreglob.OreGlobCompileResult.Report; -import gregtech.common.covers.filter.oreglob.node.MatchNode; import gregtech.common.covers.filter.oreglob.node.OreGlobNode; import gregtech.common.covers.filter.oreglob.node.OreGlobNodes; @@ -72,48 +71,33 @@ private void advance() { while (true) { int start = this.inputIndex; switch (readNextChar()) { - case ' ': case '\t': case '\n': case '\r': + case ' ', '\t', '\n', '\r' -> { continue; - case '(': - setCurrentToken(LPAR, start, 1); - return; - case ')': - setCurrentToken(RPAR, start, 1); - return; - case '|': - setCurrentToken(OR, start, 1); - return; - case '&': - setCurrentToken(AND, start, 1); - return; - case '!': - setCurrentToken(NOT, start, 1); - return; - case '^': - setCurrentToken(XOR, start, 1); - return; - case '*': - setCurrentToken(ANY, start, 1); - return; - case '?': - setCurrentToken(ANY_CHAR, start, 1); - return; - case '$': + } + case '(' -> setCurrentToken(LPAR, start, 1); + case ')' -> setCurrentToken(RPAR, start, 1); + case '|' -> setCurrentToken(OR, start, 1); + case '&' -> setCurrentToken(AND, start, 1); + case '!' -> setCurrentToken(NOT, start, 1); + case '^' -> setCurrentToken(XOR, start, 1); + case '*' -> setCurrentToken(ANY, start, 1); + case '?' -> setCurrentToken(ANY_CHAR, start, 1); + case '$' -> { if (!first) { - error("Compilation flags in the middle of expression", start, 1); + error(OreGlobMessages.compileErrorUnexpectedCompilationFlag(), start, 1); } gatherFlags(first); first = false; continue; - case CHAR_EOF: - setCurrentToken(EOF, input.length(), 0); - return; - default: + } + case CHAR_EOF -> setCurrentToken(EOF, input.length(), 0); + default -> { this.inputIndex = start; String literalValue = gatherLiteralValue(); setCurrentToken(LITERAL, start, inputIndex - start, literalValue); - return; + } } + return; } } @@ -129,8 +113,7 @@ private void setCurrentToken(TokenType type, int start, int len, @Nullable Strin } private String getTokenSection() { - return tokenType == EOF ? - "** End of line **" : + return this.tokenType == EOF ? OreGlobMessages.compileEOF() : this.input.substring(this.tokenStart, this.tokenStart + this.tokenLength); } @@ -140,20 +123,20 @@ private String gatherLiteralValue() { int i = this.inputIndex; int c = readNextChar(); switch (c) { - case '\\': + case '\\' -> { c = readNextChar(); if (c == CHAR_EOF) { - error("End of file after escape character ('\\')", i, 1); + error(OreGlobMessages.compileErrorEOFAfterEscape(), i, 1); return stb.toString(); - } else break; - case ' ': case '\t': case '\n': case '\r': case '(': case ')': - case '|': case '&': case '!': case '^': case '*': case '?': case '$': - case CHAR_EOF: + } + } + case ' ', '\t', '\n', '\r', '(', ')', '|', '&', '!', '^', '*', '?', '$', CHAR_EOF -> { this.inputIndex = i; return stb.toString(); + } } if (c > 0xFFFF) { - error("Characters above 0xFFFF can't be used", i, 1); + error(OreGlobMessages.compileErrorInvalidChar(c), i, 1); c = '?'; } stb.appendCodePoint(c); @@ -166,28 +149,27 @@ private void gatherFlags(boolean add) { int i = this.inputIndex; int c = readNextChar(); switch (c) { - case '\\': + case '\\' -> { c = readNextChar(); if (c == CHAR_EOF) { - error("End of file after escape character ('\\')", i, 1); - break; + error(OreGlobMessages.compileErrorEOFAfterEscape(), i, 1); } else if (add) { addFlag(c, i); flagsAdded = true; continue; } - case ' ': case '\t': case '\n': case '\r': - case CHAR_EOF: - break; - default: + } + case ' ', '\t', '\n', '\r', CHAR_EOF -> {} + default -> { if (add) { addFlag(c, i); flagsAdded = true; } continue; + } } if (!flagsAdded && add) { - error("No compilation flags given", i, 1); + error(OreGlobMessages.compileErrorEmptyCompilationFlag(), i, 1); } return; } @@ -195,15 +177,16 @@ private void gatherFlags(boolean add) { private void addFlag(int flag, int index) { switch (flag) { - case 'c': case 'C': + case 'c', 'C' -> { if (this.caseSensitive) { - warn("Compilation flag 'c' written twice", index, 1); + warn(OreGlobMessages.compileErrorRedundantCompilationFlag("c"), index, 1); } else { this.caseSensitive = true; } - break; - default: - warn(new StringBuilder("Unknown compilation flag '").appendCodePoint(flag).append('\'').toString(), index, 1); + } + default -> warn(OreGlobMessages.compileErrorUnknownCompilationFlag( + new StringBuilder().appendCodePoint(flag).toString() + ), index, 1); } } @@ -218,7 +201,7 @@ public OreGlobCompileResult compile() { if (tokenType != EOF) { OreGlobNode expr = or(); if (tokenType != EOF) { // likely caused by program error, not user issue - error("Unexpected token " + getTokenSection() + " after end of expression"); + error(OreGlobMessages.compileErrorUnexpectedTokenAfterEOF(getTokenSection())); } if (!error) { return new OreGlobCompileResult(new NodeOreGlob(expr), this.reports); @@ -258,22 +241,18 @@ private OreGlobNode and() { } private OreGlobNode xor() { - OreGlobNode expr = not(); + OreGlobNode expr = not(false); if (!advanceIf(XOR)) return expr; List nodes = new ArrayList<>(); nodes.add(expr); do { // XOR token redundancy is not checked because it doesn't make any sense - nodes.add(not()); + nodes.add(not(false)); } while (advanceIf(XOR)); return OreGlobNodes.xor(nodes); } - private OreGlobNode not() { - return not(false); - } - - private OreGlobNode not(boolean insideNegation) { + private OreGlobNode not(boolean nested) { boolean not = false; while (advanceIf(NOT)) not = !not; OreGlobNode root; @@ -285,90 +264,89 @@ private OreGlobNode not(boolean insideNegation) { } else { root = OreGlobNodes.not(or()); switch (tokenType) { - case RPAR: - advance(); - case EOF: - break; - default: // likely caused by program error, not user issue - error("Unexpected token " + getTokenSection() + " after end of expression"); + case RPAR -> advance(); + case EOF -> {} + // likely caused by program error, not user issue + default -> error(OreGlobMessages.compileErrorUnexpectedToken(getTokenSection())); } } } else { - if (not && insideNegation) { - warn("Nested negations can be unintuitive. Consider using groups ( () ) to eliminate ambiguity."); + if (not && nested) { + warn(OreGlobMessages.compileWarnNestedNegation()); } root = primary(); } - switch (tokenType) { - case NOT: case LITERAL: case LPAR: case ANY: case ANY_CHAR: // lookahead for not ruleset + switch (tokenType) { // lookahead for not ruleset + case NOT, LITERAL, LPAR, ANY, ANY_CHAR -> { int tokenStart = this.tokenStart; - OreGlobNode node = not(insideNegation || not); - if (root instanceof MatchNode && root.isNegated() && - node instanceof MatchNode && node.isNegated()) { - warn("Consecutive negations can be unintuitive. Please check if the evaluation result is desirable.", tokenStart, this.tokenStart + this.tokenLength - tokenStart); + OreGlobNode node = not(nested || not); + if (OreGlobNodes.isNegatedMatch(root) && OreGlobNodes.isNegatedMatch(node)) { + warn(OreGlobMessages.compileWarnConsecutiveNegation(), tokenStart, tokenStart + tokenLength - tokenStart); } root = OreGlobNodes.append(root, node); - default: - return not ? OreGlobNodes.not(root) : root; + } } + return not ? OreGlobNodes.not(root) : root; } private OreGlobNode primary() { - switch (tokenType) { - case LITERAL: + return switch (tokenType) { + case LITERAL -> { if (tokenLiteralValue != null) { OreGlobNode result = OreGlobNodes.match(tokenLiteralValue, !this.caseSensitive); advance(); - return result; + yield result; } else { // likely caused by program error, not user issue error("Literal token without value"); advance(); - return OreGlobNodes.error(); + yield OreGlobNodes.error(); } - case LPAR: + } + case LPAR -> { advance(); - switch (tokenType) { - case RPAR: // Empty group, i.e. nothing + yield switch (tokenType) { + // Empty group, i.e. nothing + case RPAR -> { advance(); - case EOF: - // To preserve consistency between grouped expression below, enclosing parenthesis of nothing match is also optional - // For example, this is totally valid ore expression - // ( - // ...in the same logic the ore expression below is valid - // ( ore* | ingot* - return OreGlobNodes.empty(); - default: + yield OreGlobNodes.empty(); + } + // To preserve consistency between grouped expression below, enclosing parenthesis of nothing match is also optional + // For example, this is totally valid ore expression + // ( + // ...in the same logic the ore expression below is valid + // ( ore* | ingot* + case EOF -> OreGlobNodes.empty(); + default -> { OreGlobNode result = or(); advanceIf(RPAR); // optional enclosing parenthesis - return result; - } - case ANY: - return nOrMore(0, true); - case ANY_CHAR: - return nOrMore(1, false); - case EOF: - error("Unexpected end of expression"); - return OreGlobNodes.error(); - default: - error("Unexpected token '" + getTokenSection() + "'"); + yield result; + } + }; + } + case ANY -> nOrMore(0, true); + case ANY_CHAR -> nOrMore(1, false); + case EOF -> { + error(OreGlobMessages.compileErrorUnexpectedEOF()); + yield OreGlobNodes.error(); + } + default -> { + error(OreGlobMessages.compileErrorUnexpectedToken(getTokenSection())); advance(); - return OreGlobNodes.error(); - } + yield OreGlobNodes.error(); + } + }; } private OreGlobNode nOrMore(int n, boolean more) { while (true) { advance(); switch (tokenType) { - case ANY_CHAR: - n++; - break; - case ANY: - more = true; - break; - default: + case ANY_CHAR -> n++; + case ANY -> more = true; + default -> { return OreGlobNodes.chars(n, more); + } } } } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/AnyCharNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/AnyCharNode.java index 9ec522de158..173153d242d 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/AnyCharNode.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/AnyCharNode.java @@ -2,7 +2,7 @@ import javax.annotation.Nonnull; -public class AnyCharNode extends OreGlobNode { +class AnyCharNode extends OreGlobNode { int amount; boolean more; @@ -13,7 +13,7 @@ public class AnyCharNode extends OreGlobNode { } @Override - protected void visitInternal(NodeVisitor visitor) { + public void visit(NodeVisitor visitor) { if (more) { visitor.charsOrMore(amount, isNegated()); } else { @@ -23,19 +23,11 @@ protected void visitInternal(NodeVisitor visitor) { @Override public boolean isPropertyEqualTo(@Nonnull OreGlobNode node) { - if (!(node instanceof AnyCharNode)) return false; - AnyCharNode o = (AnyCharNode) node; - return this.amount == o.amount && this.more == o.more; + return node instanceof AnyCharNode o && this.amount == o.amount && this.more == o.more; } @Override protected MatchDescription getIndividualNodeMatchDescription() { - if (this.more) { - if (this.amount == 0) return MatchDescription.EVERYTHING; - if (this.amount == 1) return MatchDescription.NONEMPTY; - } else { - if (this.amount == 0) return MatchDescription.EMPTY; - } - return MatchDescription.OTHER_EXCLUDING_EMPTY; + return isNegated() ? MatchDescription.OTHER_INCLUDING_EMPTY : MatchDescription.OTHER_EXCLUDING_EMPTY; } } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchNode.java index ac9ee6dd7e9..7eddaeafd5f 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchNode.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchNode.java @@ -3,7 +3,7 @@ import javax.annotation.Nonnull; import java.util.List; -public class BranchNode extends OreGlobNode { +class BranchNode extends OreGlobNode { final BranchType type; final List expressions; @@ -14,7 +14,7 @@ public class BranchNode extends OreGlobNode { } @Override - protected void visitInternal(NodeVisitor visitor) { + public void visit(NodeVisitor visitor) { if (expressions.size() == 1) { visitor.group(expressions.get(0), isNegated()); } else { @@ -24,54 +24,39 @@ protected void visitInternal(NodeVisitor visitor) { @Override protected MatchDescription getIndividualNodeMatchDescription() { - switch (this.expressions.size()) { - case 0: - return this.type == BranchType.AND ? MatchDescription.EVERYTHING : MatchDescription.NOTHING; - case 1: - return this.expressions.get(0).getIndividualNodeMatchDescription(); - } - switch (this.type) { - case OR: { - MatchDescription union = MatchDescription.NOTHING; - for (OreGlobNode node : this.expressions) { - MatchDescription desc = node.getMatchDescription(); - if (desc == MatchDescription.NOTHING) continue; - union = union.or(desc); - if (union == MatchDescription.EVERYTHING) { - return MatchDescription.EVERYTHING; + MatchDescription description = switch (this.expressions.size()) { + case 0 -> this.type == BranchType.AND ? MatchDescription.EVERYTHING : MatchDescription.NOTHING; + case 1 -> this.expressions.get(0).getMatchDescription(); + default -> switch (this.type) { + case OR -> { + MatchDescription union = MatchDescription.NOTHING; + for (OreGlobNode node : this.expressions) { + union = union.or(node.getMatchDescription()); } + yield union; } - return union; - } - case AND: { - MatchDescription intersection = MatchDescription.EVERYTHING; - for (OreGlobNode node : this.expressions) { - MatchDescription desc = node.getMatchDescription(); - if (desc == MatchDescription.EVERYTHING) continue; - intersection = intersection.and(desc); - if (intersection == MatchDescription.EMPTY) { - return MatchDescription.EMPTY; + case AND -> { + MatchDescription intersection = MatchDescription.EVERYTHING; + for (OreGlobNode node : this.expressions) { + intersection = intersection.and(node.getMatchDescription()); } + yield intersection; } - return intersection; - } - case XOR: { - MatchDescription disjunction = MatchDescription.NOTHING; - for (OreGlobNode node : this.expressions) { - MatchDescription desc = node.getMatchDescription(); - disjunction = disjunction.xor(desc); + case XOR -> { + MatchDescription disjunction = MatchDescription.NOTHING; + for (OreGlobNode node : this.expressions) { + disjunction = disjunction.xor(node.getMatchDescription()); + } + yield disjunction; } - return disjunction; - } - default: - throw new IllegalStateException("Unreachable"); - } + }; + }; + return isNegated() ? description.complement() : description; } @Override public boolean isPropertyEqualTo(@Nonnull OreGlobNode node) { - if (!(node instanceof BranchNode)) return false; - BranchNode br = (BranchNode) node; + if (!(node instanceof BranchNode br)) return false; if (this.type != br.type) return false; if (this.expressions.size() != br.expressions.size()) return false; @@ -92,8 +77,4 @@ public boolean isPropertyEqualTo(@Nonnull OreGlobNode node) { } return true; } - - public enum BranchType { - OR, AND, XOR - } } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchType.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchType.java new file mode 100644 index 00000000000..d75481e7934 --- /dev/null +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchType.java @@ -0,0 +1,5 @@ +package gregtech.common.covers.filter.oreglob.node; + +public enum BranchType { + OR, AND, XOR +} diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/EmptyNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/EmptyNode.java new file mode 100644 index 00000000000..0e230a89fbf --- /dev/null +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/EmptyNode.java @@ -0,0 +1,22 @@ +package gregtech.common.covers.filter.oreglob.node; + +import javax.annotation.Nonnull; + +class EmptyNode extends OreGlobNode { + + @Override + public void visit(NodeVisitor visitor) { + if (isNegated()) visitor.nonempty(); + else visitor.empty(); + } + + @Override + public boolean isPropertyEqualTo(@Nonnull OreGlobNode node) { + return node instanceof EmptyNode; + } + + @Override + protected MatchDescription getIndividualNodeMatchDescription() { + return isNegated() ? MatchDescription.NONEMPTY : MatchDescription.EMPTY; + } +} diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/ErrorNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/ErrorNode.java index 2332c9de5aa..9512c963b3a 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/ErrorNode.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/ErrorNode.java @@ -1,22 +1,11 @@ package gregtech.common.covers.filter.oreglob.node; import javax.annotation.Nonnull; -import javax.annotation.Nullable; -public class ErrorNode extends OreGlobNode { - - ErrorNode() { - } - - @Nullable - @Override - public OreGlobNode visit(NodeVisitor visitor) { - visitor.error(); - return getNext(); - } +class ErrorNode extends OreGlobNode { @Override - protected void visitInternal(NodeVisitor visitor) { + public void visit(NodeVisitor visitor) { visitor.error(); } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/EverythingNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/EverythingNode.java new file mode 100644 index 00000000000..eb82a23d985 --- /dev/null +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/EverythingNode.java @@ -0,0 +1,22 @@ +package gregtech.common.covers.filter.oreglob.node; + +import javax.annotation.Nonnull; + +class EverythingNode extends OreGlobNode { + + @Override + public void visit(NodeVisitor visitor) { + if (isNegated()) visitor.nothing(); + else visitor.everything(); + } + + @Override + public boolean isPropertyEqualTo(@Nonnull OreGlobNode node) { + return node instanceof EverythingNode; + } + + @Override + protected MatchDescription getIndividualNodeMatchDescription() { + return isNegated() ? MatchDescription.NOTHING : MatchDescription.EVERYTHING; + } +} diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/GroupNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/GroupNode.java index 2154f7b0cde..096d864e8e2 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/GroupNode.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/GroupNode.java @@ -2,7 +2,7 @@ import javax.annotation.Nonnull; -public class GroupNode extends OreGlobNode { +class GroupNode extends OreGlobNode { final OreGlobNode node; @@ -11,18 +11,17 @@ public class GroupNode extends OreGlobNode { } @Override - protected void visitInternal(NodeVisitor visitor) { + public void visit(NodeVisitor visitor) { visitor.group(node, isNegated()); } @Override public boolean isPropertyEqualTo(@Nonnull OreGlobNode node) { - if (!(node instanceof GroupNode)) return false; - return this.node.isStructurallyEqualTo(((GroupNode) node).node); + return node instanceof GroupNode groupNode && this.node.isStructurallyEqualTo(groupNode.node); } @Override protected MatchDescription getIndividualNodeMatchDescription() { - return node.getMatchDescription(); + return isNegated() ? node.getMatchDescription().complement() : node.getMatchDescription(); } } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchDescription.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchDescription.java index 92f530c0865..93b8fc3d225 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchDescription.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchDescription.java @@ -50,118 +50,66 @@ public boolean isIncomplete() { } public boolean covers(MatchDescription desc) { - switch (this) { - case EVERYTHING: - return true; - case NOTHING: - case OTHER_EXCLUDING_EMPTY: - return desc == NOTHING; - case NONEMPTY: - return !desc.canMatchNothing(); - case EMPTY: - case OTHER_INCLUDING_EMPTY: - return !desc.canMatchNonEmpty(); - default: - throw new IllegalStateException("Unreachable"); - } + return switch (this) { + case EVERYTHING -> true; + case NOTHING, OTHER_EXCLUDING_EMPTY -> desc == NOTHING; + case NONEMPTY -> !desc.canMatchNothing(); + case EMPTY, OTHER_INCLUDING_EMPTY -> !desc.canMatchNonEmpty(); + }; } public MatchDescription append(MatchDescription another) { if (another == NOTHING) return NOTHING; - switch (this) { - case EVERYTHING: - switch (another) { - case NONEMPTY: - return NONEMPTY; - case OTHER_EXCLUDING_EMPTY: - return OTHER_EXCLUDING_EMPTY; - case OTHER_INCLUDING_EMPTY: - return OTHER_INCLUDING_EMPTY; - default: - return EVERYTHING; - } - case NOTHING: - return NOTHING; - case NONEMPTY: - switch (another) { - case NONEMPTY: // 2 or more - case OTHER_EXCLUDING_EMPTY: - case OTHER_INCLUDING_EMPTY: - return OTHER_EXCLUDING_EMPTY; - default: - return NONEMPTY; - } - case EMPTY: - return another; - case OTHER_EXCLUDING_EMPTY: - return OTHER_EXCLUDING_EMPTY; - case OTHER_INCLUDING_EMPTY: - return another.canMatchNothing() ? OTHER_INCLUDING_EMPTY : OTHER_EXCLUDING_EMPTY; - default: - throw new IllegalStateException("Unreachable"); - } + return switch (this) { + case EVERYTHING -> switch (another) { + case NONEMPTY -> NONEMPTY; + case OTHER_EXCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY; + case OTHER_INCLUDING_EMPTY -> OTHER_INCLUDING_EMPTY; + default -> EVERYTHING; + }; + case NOTHING -> NOTHING; + case NONEMPTY -> switch (another) { // 2 or more + case NONEMPTY, OTHER_EXCLUDING_EMPTY, OTHER_INCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY; + default -> NONEMPTY; + }; + case EMPTY -> another; + case OTHER_EXCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY; + case OTHER_INCLUDING_EMPTY -> another.canMatchNothing() ? OTHER_INCLUDING_EMPTY : OTHER_EXCLUDING_EMPTY; + }; } public MatchDescription or(MatchDescription desc) { if (desc == NOTHING) return this; if (desc == EVERYTHING) return EVERYTHING; - switch (this) { - case EVERYTHING: return EVERYTHING; - case NOTHING: return desc; - case NONEMPTY: return desc.canMatchNothing() ? EVERYTHING : NONEMPTY; - case EMPTY: - switch (desc) { - case NONEMPTY: - return EVERYTHING; - case OTHER_EXCLUDING_EMPTY: - return OTHER_INCLUDING_EMPTY; - default: - return desc; - } - case OTHER_EXCLUDING_EMPTY: - switch (desc) { - case NONEMPTY: - return NONEMPTY; - case OTHER_EXCLUDING_EMPTY: - return OTHER_EXCLUDING_EMPTY; - default: - return OTHER_INCLUDING_EMPTY; - } - case OTHER_INCLUDING_EMPTY: - if (desc == MatchDescription.NONEMPTY) { - return EVERYTHING; - } - return OTHER_INCLUDING_EMPTY; - default: - throw new IllegalStateException("Unreachable"); - } + return switch (this) { + case EVERYTHING -> EVERYTHING; + case NOTHING -> desc; + case NONEMPTY -> desc.canMatchNothing() ? EVERYTHING : NONEMPTY; + case EMPTY -> switch (desc) { + case NONEMPTY -> EVERYTHING; + case OTHER_EXCLUDING_EMPTY -> OTHER_INCLUDING_EMPTY; + default -> desc; + }; + case OTHER_EXCLUDING_EMPTY -> switch (desc) { + case NONEMPTY -> NONEMPTY; + case OTHER_EXCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY; + default -> OTHER_INCLUDING_EMPTY; + }; + case OTHER_INCLUDING_EMPTY -> desc == MatchDescription.NONEMPTY ? EVERYTHING : OTHER_INCLUDING_EMPTY; + }; } public MatchDescription and(MatchDescription desc) { if (desc == NOTHING) return NOTHING; if (desc == EVERYTHING) return this; if (this == desc) return this; - switch (this) { - case EVERYTHING: - return desc; - case NOTHING: - return NOTHING; - case NONEMPTY: - case OTHER_EXCLUDING_EMPTY: - if (desc == MatchDescription.EMPTY) { - return NOTHING; - } - return OTHER_EXCLUDING_EMPTY; - case EMPTY: - return desc.canMatchNothing() ? EMPTY : NOTHING; - case OTHER_INCLUDING_EMPTY: - if (desc == MatchDescription.EMPTY) { - return EMPTY; - } - return OTHER_EXCLUDING_EMPTY; - default: - throw new IllegalStateException("Unreachable"); - } + return switch (this) { + case EVERYTHING -> desc; + case NOTHING -> NOTHING; + case NONEMPTY, OTHER_EXCLUDING_EMPTY -> desc == MatchDescription.EMPTY ? NOTHING : OTHER_EXCLUDING_EMPTY; + case EMPTY -> desc.canMatchNothing() ? EMPTY : NOTHING; + case OTHER_INCLUDING_EMPTY -> desc == MatchDescription.EMPTY ? EMPTY : OTHER_EXCLUDING_EMPTY; + }; } public MatchDescription xor(MatchDescription desc) { @@ -170,56 +118,30 @@ public MatchDescription xor(MatchDescription desc) { if (desc == NOTHING) return this; if (this == EVERYTHING) return desc.complement(); if (desc == EVERYTHING) return this.complement(); - switch (this) { - case NONEMPTY: - if (desc == MatchDescription.EMPTY) { - return EVERYTHING; - } - return desc; - case EMPTY: - switch (desc) { - case NONEMPTY: - return EVERYTHING; - case OTHER_EXCLUDING_EMPTY: - return OTHER_INCLUDING_EMPTY; - case OTHER_INCLUDING_EMPTY: - return OTHER_EXCLUDING_EMPTY; - default: - throw new IllegalStateException("Unreachable"); - } - case OTHER_EXCLUDING_EMPTY: - // technically an incomplete descriptions can produce other results - // but we can't factor them in currently - if (desc == MatchDescription.NONEMPTY) { - return OTHER_EXCLUDING_EMPTY; - } - return OTHER_INCLUDING_EMPTY; - case OTHER_INCLUDING_EMPTY: - if (desc == MatchDescription.EMPTY) { - return OTHER_EXCLUDING_EMPTY; - } - return OTHER_INCLUDING_EMPTY; - default: - throw new IllegalStateException("Unreachable"); - } + return switch (this) { + case NONEMPTY -> desc == MatchDescription.EMPTY ? EVERYTHING : desc; + case EMPTY -> switch (desc) { + case NONEMPTY -> EVERYTHING; + case OTHER_EXCLUDING_EMPTY -> OTHER_INCLUDING_EMPTY; + case OTHER_INCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY; + default -> throw new IllegalStateException("Unreachable"); + }; + // technically an incomplete descriptions can produce other results + // but we can't factor them in currently + case OTHER_EXCLUDING_EMPTY -> desc == MatchDescription.NONEMPTY ? OTHER_EXCLUDING_EMPTY : OTHER_INCLUDING_EMPTY; + case OTHER_INCLUDING_EMPTY -> desc == MatchDescription.EMPTY ? OTHER_EXCLUDING_EMPTY : OTHER_INCLUDING_EMPTY; + default -> throw new IllegalStateException("Unreachable"); + }; } public MatchDescription complement() { - switch (this) { - case EVERYTHING: - return NOTHING; - case NOTHING: - return EVERYTHING; - case NONEMPTY: - return EMPTY; - case EMPTY: - return NONEMPTY; - case OTHER_EXCLUDING_EMPTY: - return OTHER_INCLUDING_EMPTY; - case OTHER_INCLUDING_EMPTY: - return OTHER_EXCLUDING_EMPTY; - default: - throw new IllegalStateException("Unreachable"); - } + return switch (this) { + case EVERYTHING -> NOTHING; + case NOTHING -> EVERYTHING; + case NONEMPTY -> EMPTY; + case EMPTY -> NONEMPTY; + case OTHER_EXCLUDING_EMPTY -> OTHER_INCLUDING_EMPTY; + case OTHER_INCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY; + }; } } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchNode.java index 32d37d82e4e..a507466f9aa 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchNode.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchNode.java @@ -2,7 +2,7 @@ import javax.annotation.Nonnull; -public class MatchNode extends OreGlobNode { +class MatchNode extends OreGlobNode { String match; boolean ignoreCase; @@ -13,20 +13,19 @@ public class MatchNode extends OreGlobNode { } @Override - protected void visitInternal(NodeVisitor visitor) { + public void visit(NodeVisitor visitor) { visitor.match(match, ignoreCase, isNegated()); } @Override public boolean isPropertyEqualTo(@Nonnull OreGlobNode node) { - if (!(node instanceof MatchNode)) return false; - String match = ((MatchNode) node).match; - return this.ignoreCase ? this.match.equalsIgnoreCase(match) : this.match.equals(match); + return node instanceof MatchNode match && + (this.ignoreCase ? this.match.equalsIgnoreCase(match.match) : this.match.equals(match.match)); } @Override protected MatchDescription getIndividualNodeMatchDescription() { - return this.match.isEmpty() ? MatchDescription.EMPTY : MatchDescription.OTHER_EXCLUDING_EMPTY; + return isNegated() ? MatchDescription.OTHER_INCLUDING_EMPTY : MatchDescription.OTHER_EXCLUDING_EMPTY; } public boolean isMatchEquals(MatchNode other) { diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/NodeVisitor.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/NodeVisitor.java index 133212e920d..bd36a50e0d5 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/NodeVisitor.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/NodeVisitor.java @@ -1,7 +1,5 @@ package gregtech.common.covers.filter.oreglob.node; -import gregtech.common.covers.filter.oreglob.node.BranchNode.BranchType; - import java.util.List; public interface NodeVisitor { @@ -25,4 +23,37 @@ public interface NodeVisitor { void empty(); void error(); + + interface Base extends NodeVisitor { + + @Override + default void match(String match, boolean ignoreCase, boolean not) {} + + @Override + default void chars(int amount, boolean not) {} + + @Override + default void charsOrMore(int amount, boolean not) {} + + @Override + default void group(OreGlobNode node, boolean not) {} + + @Override + default void branch(BranchType type, List nodes, boolean not) {} + + @Override + default void everything() {} + + @Override + default void nothing() {} + + @Override + default void nonempty() {} + + @Override + default void empty() {} + + @Override + default void error() {} + } } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNode.java index edba4e48d97..429eb1599d5 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNode.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNode.java @@ -14,12 +14,9 @@ public abstract class OreGlobNode { @Nullable private MatchDescription descriptionCache; - @Nullable - private MatchDescription selfDescriptionCache; // package-private constructor to prevent inheritance from outside - OreGlobNode() { - } + OreGlobNode() {} @Nullable public final OreGlobNode getNext() { @@ -52,30 +49,8 @@ final void setNegated(boolean negated) { * Visit this node. * * @param visitor Visitor for this node - * @return Next node, if exists */ - @Nullable - public OreGlobNode visit(NodeVisitor visitor) { - switch (this.getMatchDescription()) { - case EVERYTHING: - visitor.everything(); - break; - case NOTHING: - visitor.nothing(); - break; - case NONEMPTY: - visitor.nonempty(); - break; - case EMPTY: - visitor.empty(); - break; - default: - visitInternal(visitor); - } - return this.getNext(); - } - - protected abstract void visitInternal(NodeVisitor visitor); + public abstract void visit(NodeVisitor visitor); /** * Whether this node shares same structure and content with given node. @@ -95,7 +70,7 @@ public boolean isStructurallyEqualTo(@Nonnull OreGlobNode node) { public final MatchDescription getMatchDescription() { if (this.descriptionCache == null) { - MatchDescription t = getSelfMatchDescription(); + MatchDescription t = getIndividualNodeMatchDescription(); if (t != MatchDescription.NOTHING && this.getNext() != null) t = t.append(this.getNext().getMatchDescription()); return this.descriptionCache = t; @@ -103,29 +78,8 @@ public final MatchDescription getMatchDescription() { return this.descriptionCache; } - public final MatchDescription getSelfMatchDescription() { - if (this.selfDescriptionCache == null) { - MatchDescription t = getIndividualNodeMatchDescription(); - if (this.isNegated() && !(this instanceof ErrorNode)) t = t.complement(); - return this.selfDescriptionCache = t; - } - return this.selfDescriptionCache; - } - - public final boolean isEverything() { - return getMatchDescription() == MatchDescription.EVERYTHING; - } - - public final boolean isImpossibleToMatch() { - return getMatchDescription() == MatchDescription.NOTHING; - } - - public final boolean isSomething() { - return getMatchDescription() == MatchDescription.NONEMPTY; - } - - public final boolean isNothing() { - return getMatchDescription() == MatchDescription.EMPTY; + public final boolean is(MatchDescription description) { + return getMatchDescription() == description; } /** @@ -138,19 +92,18 @@ public final boolean isNothing() { public abstract boolean isPropertyEqualTo(@Nonnull OreGlobNode node); /** - * @return Match type of this specific node, without considering negation flag. + * @return Match type of this specific node */ protected abstract MatchDescription getIndividualNodeMatchDescription(); final void clearMatchDescriptionCache() { this.descriptionCache = null; - this.selfDescriptionCache = null; } public static boolean isStructurallyEqualTo(@Nullable OreGlobNode node1, @Nullable OreGlobNode node2) { if (node1 == node2) return true; - if (node1 == null) return node2.isNothing(); - if (node2 == null) return node1.isNothing(); + if (node1 == null) return node2.is(MatchDescription.EMPTY); + if (node2 == null) return node1.is(MatchDescription.EMPTY); return node1.isStructurallyEqualTo(node2); } } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNodes.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNodes.java index dbccc1ddbbe..1b34da20afc 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNodes.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNodes.java @@ -1,7 +1,6 @@ package gregtech.common.covers.filter.oreglob.node; import com.google.common.collect.Lists; -import gregtech.common.covers.filter.oreglob.node.BranchNode.BranchType; import java.util.List; @@ -20,6 +19,8 @@ public static OreGlobNode match(String match, boolean ignoreCase) { } public static OreGlobNode chars(int amount, boolean more) { + if (amount == 0) return more ? everything() : empty(); + if (amount == 1 && more) return nonempty(); return new AnyCharNode(amount, more); } @@ -28,19 +29,19 @@ public static OreGlobNode group(OreGlobNode node) { } public static OreGlobNode everything() { - return chars(0, true); + return new EverythingNode(); } public static OreGlobNode nothing() { return not(everything()); } - public static OreGlobNode something() { - return chars(1, true); + public static OreGlobNode nonempty() { + return not(empty()); } public static OreGlobNode empty() { - return not(something()); + return new EmptyNode(); } public static OreGlobNode or(OreGlobNode... expressions) { @@ -51,12 +52,14 @@ public static OreGlobNode or(List expressions) { MatchDescription union = MatchDescription.NOTHING; for (int i = 0; i < expressions.size(); i++) { OreGlobNode expr = expressions.get(i); - if (expr.isEverything()) { + if (expr.is(MatchDescription.EVERYTHING)) { return expr; // short circuit - } else if (union.covers(expr.getMatchDescription())) { + } + if (union.covers(expr.getMatchDescription())) { expressions.remove(i--); // trivial term continue; - } else if (expr.getMatchDescription().covers(union)) { + } + if (expr.getMatchDescription().covers(union)) { // everything before was trivial while (i != 0) { expressions.remove(0); @@ -70,13 +73,11 @@ public static OreGlobNode or(List expressions) { return everything(); // short circuit } } - switch (expressions.size()) { - case 0: - return nothing(); - case 1: - return expressions.get(0); - } - return new BranchNode(BranchType.OR, expressions); + return switch (expressions.size()) { + case 0 -> nothing(); + case 1 -> expressions.get(0); + default -> new BranchNode(BranchType.OR, expressions); + }; } public static OreGlobNode and(OreGlobNode... expressions) { @@ -87,12 +88,14 @@ public static OreGlobNode and(List expressions) { MatchDescription intersection = MatchDescription.EVERYTHING; for (int i = 0; i < expressions.size(); i++) { OreGlobNode expr = expressions.get(i); - if (expr.isImpossibleToMatch()) { + if (expr.is(MatchDescription.NOTHING)) { return expr; // short circuit - } else if (expr.getMatchDescription().covers(intersection)) { + } + if (expr.getMatchDescription().covers(intersection)) { expressions.remove(i--); // trivial term continue; - } else if (intersection.covers(expr.getMatchDescription())) { + } + if (intersection.covers(expr.getMatchDescription())) { // everything before was trivial while (i != 0) { expressions.remove(0); @@ -106,13 +109,11 @@ public static OreGlobNode and(List expressions) { return nothing(); // short circuit } } - switch (expressions.size()) { - case 0: - return everything(); - case 1: - return expressions.get(0); - } - return new BranchNode(BranchType.AND, expressions); + return switch (expressions.size()) { + case 0 -> everything(); + case 1 -> expressions.get(0); + default -> new BranchNode(BranchType.AND, expressions); + }; } public static OreGlobNode xor(OreGlobNode... expressions) { @@ -123,9 +124,9 @@ public static OreGlobNode xor(List expressions) { boolean not = false; for (int i1 = 0; i1 < expressions.size(); i1++) { OreGlobNode expr = expressions.get(i1); - if (expr.isImpossibleToMatch()) { + if (expr.is(MatchDescription.NOTHING)) { expressions.remove(i1--); // redundant term - } else if (expr.isEverything()) { + } else if (expr.is(MatchDescription.EVERYTHING)) { expressions.remove(i1--); not = !not; // same as applying NOT to every other term } else { @@ -147,30 +148,14 @@ public static OreGlobNode xor(List expressions) { } } } - switch (expressions.size()) { - case 0: - return not ? everything() : nothing(); - case 1: - OreGlobNode node = expressions.get(0); - return not ? not(node) : node; - } - BranchNode node = new BranchNode(BranchType.XOR, expressions); + OreGlobNode node = switch (expressions.size()) { + case 0 -> nothing(); + case 1 -> expressions.get(0); + default -> new BranchNode(BranchType.XOR, expressions); + }; return not ? not(node) : node; } - public static OreGlobNode branch(BranchType type, List expressions) { - switch (type) { - case OR: - return or(expressions); - case AND: - return and(expressions); - case XOR: - return xor(expressions); - default: - throw new IllegalStateException("Unreachable"); - } - } - public static OreGlobNode error() { return new ErrorNode(); } @@ -188,13 +173,11 @@ public static OreGlobNode not(OreGlobNode node) { } public static OreGlobNode append(OreGlobNode node, OreGlobNode next) { - if (node.isImpossibleToMatch() || next.isNothing()) return node; - if (next.isImpossibleToMatch() || node.isNothing()) return next; + if (node.is(MatchDescription.NOTHING) || next.is(MatchDescription.EMPTY)) return node; + if (next.is(MatchDescription.NOTHING) || node.is(MatchDescription.EMPTY)) return next; - if (node instanceof MatchNode) { - if (next instanceof MatchNode) { - MatchNode n1 = (MatchNode) node; - MatchNode n2 = (MatchNode) next; + if (node instanceof MatchNode n1) { + if (next instanceof MatchNode n2) { if (!node.isNegated() && !next.isNegated()) { if (n1.ignoreCase == n2.ignoreCase) { // two consecutive, non-negated match nodes can be concatenated @@ -225,16 +208,18 @@ public static OreGlobNode append(OreGlobNode node, OreGlobNode next) { } } } - } else if (node instanceof AnyCharNode && !node.isNegated()) { - AnyCharNode n1 = (AnyCharNode) node; - if (next.isEverything()) { + } else if (node instanceof AnyCharNode n1 && !node.isNegated()) { + if (next.is(MatchDescription.EVERYTHING)) { + if (n1.amount == 0) return everything(); + if (n1.amount == 1) return nonempty(); if (!n1.more) { n1.more = true; n1.clearMatchDescriptionCache(); } n1.setNext(null); return n1; - } else if (next.isSomething()) { + } else if (next.is(MatchDescription.NONEMPTY)) { + if (n1.amount == 0) return nonempty(); n1.amount++; if (!n1.more) { n1.more = true; @@ -245,11 +230,12 @@ public static OreGlobNode append(OreGlobNode node, OreGlobNode next) { return n1; } - if (next instanceof AnyCharNode && !next.isNegated()) { - AnyCharNode n2 = (AnyCharNode) next; + if (next instanceof AnyCharNode n2 && !next.isNegated()) { // two consecutive, non-negated char nodes can be concatenated n1.amount += n2.amount; n1.more |= n2.more; + if (n1.amount == 0) return n1.more ? everything() : empty(); + if (n1.amount == 1 && n1.more) return nonempty(); n1.setNext(n2.getNext()); n1.clearMatchDescriptionCache(); return n1; @@ -267,4 +253,8 @@ public static OreGlobNode append(OreGlobNode... nodes) { } return nodes[0]; } + + public static boolean isNegatedMatch(OreGlobNode node) { + return node.isNegated() && node instanceof MatchNode; + } } diff --git a/src/main/java/gregtech/common/items/MetaItem1.java b/src/main/java/gregtech/common/items/MetaItem1.java index 0389ca1c517..36ac90989d1 100644 --- a/src/main/java/gregtech/common/items/MetaItem1.java +++ b/src/main/java/gregtech/common/items/MetaItem1.java @@ -715,6 +715,7 @@ public void registerSubItems() { DUCT_TAPE = addItem(502, "duct_tape"); WIRELESS = addItem(503, "wireless"); CAMERA = addItem(504, "camera"); + BASIC_TAPE = addItem(505, "basic_tape"); // Circuit Components: ID 516-565 VACUUM_TUBE = addItem(516, "circuit.vacuum_tube").setUnificationData(OrePrefix.circuit, Tier.ULV); diff --git a/src/main/java/gregtech/common/items/MetaItems.java b/src/main/java/gregtech/common/items/MetaItems.java index 8d48b8130b7..00e1545998f 100644 --- a/src/main/java/gregtech/common/items/MetaItems.java +++ b/src/main/java/gregtech/common/items/MetaItems.java @@ -113,6 +113,7 @@ private MetaItems() { public static MetaItem.MetaValueItem CARBON_MESH; public static MetaItem.MetaValueItem CARBON_FIBER_PLATE; public static MetaItem.MetaValueItem DUCT_TAPE; + public static MetaItem.MetaValueItem BASIC_TAPE; public static MetaItem.MetaValueItem NEUTRON_REFLECTOR; diff --git a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java index 60a4802ce90..5b7c924023c 100644 --- a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java +++ b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java @@ -146,6 +146,7 @@ public class MetaTileEntities { public static MetaTileEntityMachineHatch MACHINE_HATCH; public static MetaTileEntityPassthroughHatchItem PASSTHROUGH_HATCH_ITEM; public static MetaTileEntityPassthroughHatchFluid PASSTHROUGH_HATCH_FLUID; + public static MetaTileEntityReservoirHatch RESERVOIR_HATCH; public static MetaTileEntityDataAccessHatch DATA_ACCESS_HATCH; public static MetaTileEntityDataAccessHatch ADVANCED_DATA_ACCESS_HATCH; public static MetaTileEntityDataAccessHatch CREATIVE_DATA_HATCH; @@ -329,7 +330,7 @@ public static void init() { case 3 -> 3; default -> 4; }, - Textures.MACERATOR_OVERLAY, + tier <= GTValues.MV ? Textures.MACERATOR_OVERLAY : Textures.PULVERIZER_OVERLAY, tier)); // Alloy Smelter, IDs 80-94 @@ -459,19 +460,19 @@ public static void init() { MINER[2] = registerMetaTileEntity(922, new MetaTileEntityMiner(gregtechId("miner.hv"), 3, 40, 24, 3)); // Diesel Generator, IDs 935-949 - COMBUSTION_GENERATOR[0] = registerMetaTileEntity(935, new SimpleGeneratorMetaTileEntity(gregtechId("combustion_generator.lv"), RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 1, GTUtility.genericGeneratorTankSizeFunction)); - COMBUSTION_GENERATOR[1] = registerMetaTileEntity(936, new SimpleGeneratorMetaTileEntity(gregtechId("combustion_generator.mv"), RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 2, GTUtility.genericGeneratorTankSizeFunction)); - COMBUSTION_GENERATOR[2] = registerMetaTileEntity(937, new SimpleGeneratorMetaTileEntity(gregtechId("combustion_generator.hv"), RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 3, GTUtility.genericGeneratorTankSizeFunction)); + COMBUSTION_GENERATOR[0] = registerMetaTileEntity(935, new MetaTileEntitySingleCombustion(gregtechId("combustion_generator.lv"), RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 1, GTUtility.genericGeneratorTankSizeFunction)); + COMBUSTION_GENERATOR[1] = registerMetaTileEntity(936, new MetaTileEntitySingleCombustion(gregtechId("combustion_generator.mv"), RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 2, GTUtility.genericGeneratorTankSizeFunction)); + COMBUSTION_GENERATOR[2] = registerMetaTileEntity(937, new MetaTileEntitySingleCombustion(gregtechId("combustion_generator.hv"), RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 3, GTUtility.genericGeneratorTankSizeFunction)); // Steam Turbine, IDs 950-964 - STEAM_TURBINE[0] = registerMetaTileEntity(950, new SimpleGeneratorMetaTileEntity(gregtechId("steam_turbine.lv"), RecipeMaps.STEAM_TURBINE_FUELS, Textures.STEAM_TURBINE_OVERLAY, 1, GTUtility.steamGeneratorTankSizeFunction)); - STEAM_TURBINE[1] = registerMetaTileEntity(951, new SimpleGeneratorMetaTileEntity(gregtechId("steam_turbine.mv"), RecipeMaps.STEAM_TURBINE_FUELS, Textures.STEAM_TURBINE_OVERLAY, 2, GTUtility.steamGeneratorTankSizeFunction)); - STEAM_TURBINE[2] = registerMetaTileEntity(952, new SimpleGeneratorMetaTileEntity(gregtechId("steam_turbine.hv"), RecipeMaps.STEAM_TURBINE_FUELS, Textures.STEAM_TURBINE_OVERLAY, 3, GTUtility.steamGeneratorTankSizeFunction)); + STEAM_TURBINE[0] = registerMetaTileEntity(950, new MetaTileEntitySingleTurbine(gregtechId("steam_turbine.lv"), RecipeMaps.STEAM_TURBINE_FUELS, Textures.STEAM_TURBINE_OVERLAY, 1, GTUtility.steamGeneratorTankSizeFunction)); + STEAM_TURBINE[1] = registerMetaTileEntity(951, new MetaTileEntitySingleTurbine(gregtechId("steam_turbine.mv"), RecipeMaps.STEAM_TURBINE_FUELS, Textures.STEAM_TURBINE_OVERLAY, 2, GTUtility.steamGeneratorTankSizeFunction)); + STEAM_TURBINE[2] = registerMetaTileEntity(952, new MetaTileEntitySingleTurbine(gregtechId("steam_turbine.hv"), RecipeMaps.STEAM_TURBINE_FUELS, Textures.STEAM_TURBINE_OVERLAY, 3, GTUtility.steamGeneratorTankSizeFunction)); // Gas Turbine, IDs 965-979 - GAS_TURBINE[0] = registerMetaTileEntity(965, new SimpleGeneratorMetaTileEntity(gregtechId("gas_turbine.lv"), RecipeMaps.GAS_TURBINE_FUELS, Textures.GAS_TURBINE_OVERLAY, 1, GTUtility.genericGeneratorTankSizeFunction)); - GAS_TURBINE[1] = registerMetaTileEntity(966, new SimpleGeneratorMetaTileEntity(gregtechId("gas_turbine.mv"), RecipeMaps.GAS_TURBINE_FUELS, Textures.GAS_TURBINE_OVERLAY, 2, GTUtility.genericGeneratorTankSizeFunction)); - GAS_TURBINE[2] = registerMetaTileEntity(967, new SimpleGeneratorMetaTileEntity(gregtechId("gas_turbine.hv"), RecipeMaps.GAS_TURBINE_FUELS, Textures.GAS_TURBINE_OVERLAY, 3, GTUtility.genericGeneratorTankSizeFunction)); + GAS_TURBINE[0] = registerMetaTileEntity(965, new MetaTileEntitySingleTurbine(gregtechId("gas_turbine.lv"), RecipeMaps.GAS_TURBINE_FUELS, Textures.GAS_TURBINE_OVERLAY, 1, GTUtility.genericGeneratorTankSizeFunction)); + GAS_TURBINE[1] = registerMetaTileEntity(966, new MetaTileEntitySingleTurbine(gregtechId("gas_turbine.mv"), RecipeMaps.GAS_TURBINE_FUELS, Textures.GAS_TURBINE_OVERLAY, 2, GTUtility.genericGeneratorTankSizeFunction)); + GAS_TURBINE[2] = registerMetaTileEntity(967, new MetaTileEntitySingleTurbine(gregtechId("gas_turbine.hv"), RecipeMaps.GAS_TURBINE_FUELS, Textures.GAS_TURBINE_OVERLAY, 3, GTUtility.genericGeneratorTankSizeFunction)); // Item Collector, IDs 980-983 ITEM_COLLECTOR[0] = registerMetaTileEntity(980, new MetaTileEntityItemCollector(gregtechId("item_collector.lv"), 1, 8)); @@ -661,7 +662,9 @@ public static void init() { HPCA_HEAT_SINK_COMPONENT = registerMetaTileEntity(1415, new MetaTileEntityHPCACooler(gregtechId("hpca.heat_sink_component"), false)); HPCA_ACTIVE_COOLER_COMPONENT = registerMetaTileEntity(1416, new MetaTileEntityHPCACooler(gregtechId("hpca.active_cooler_component"), true)); HPCA_BRIDGE_COMPONENT = registerMetaTileEntity(1417, new MetaTileEntityHPCABridge(gregtechId("hpca.bridge_component"))); - // Free IDs 1418, 1419 + + RESERVOIR_HATCH = registerMetaTileEntity(1418, new MetaTileEntityReservoirHatch(gregtechId("reservoir_hatch"))); + // Free ID 1419 endPos = GregTechAPI.isHighTier() ? LASER_INPUT_HATCH_256.length - 1 : Math.min(LASER_INPUT_HATCH_256.length - 1, GTValues.UHV - GTValues.IV); for (int i = 0; i < endPos; i++) { int v = i + GTValues.IV; @@ -847,7 +850,7 @@ public static void init() { * claimed ranges below this comment. Max value is 32767. * * - Gregicality / Shadows of Greg: 2000-3999 - * - Gregification: 4000-4499 + * - Reserved for Integration Modules in GTCEu: 4000-4499 * - GregTech Food Option: 8500-8999 * - HtmlTech: 9000-9499 * - PCM's Ore Addon: 9500-9999 diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleCombustion.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleCombustion.java new file mode 100644 index 00000000000..24808e63611 --- /dev/null +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleCombustion.java @@ -0,0 +1,43 @@ +package gregtech.common.metatileentities.electric; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.SimpleGeneratorMetaTileEntity; +import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.api.recipes.RecipeMap; +import gregtech.client.renderer.ICubeRenderer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; + +import java.util.function.Function; + +public class MetaTileEntitySingleCombustion extends SimpleGeneratorMetaTileEntity { + + public MetaTileEntitySingleCombustion(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, Function tankScalingFunction) { + super(metaTileEntityId, recipeMap, renderer, tier, tankScalingFunction); + } + + @Override + public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { + return new MetaTileEntitySingleCombustion(metaTileEntityId, recipeMap, renderer, getTier(), getTankScalingFunction()); + } + + @Override + public boolean isValidFrontFacing(EnumFacing facing) { + return true; + } + + @Override + protected void renderOverlays(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { + if (getFrontFacing() == EnumFacing.DOWN) { + // Trick the render into rendering on the top, as this case didn't render otherwise + this.renderer.renderOrientedState(renderState, translation, pipeline, EnumFacing.NORTH, workable.isActive(), workable.isWorkingEnabled()); + } else if (getFrontFacing() != EnumFacing.UP) { + // Don't render the top overlay if the facing is up, as the textures + // would collide, otherwise render normally. + super.renderOverlays(renderState, translation, pipeline); + } + } +} diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleTurbine.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleTurbine.java new file mode 100644 index 00000000000..1fd8c2deb2b --- /dev/null +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleTurbine.java @@ -0,0 +1,43 @@ +package gregtech.common.metatileentities.electric; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.SimpleGeneratorMetaTileEntity; +import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.api.recipes.RecipeMap; +import gregtech.client.renderer.ICubeRenderer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; + +import java.util.function.Function; + +public class MetaTileEntitySingleTurbine extends SimpleGeneratorMetaTileEntity { + + public MetaTileEntitySingleTurbine(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, Function tankScalingFunction) { + super(metaTileEntityId, recipeMap, renderer, tier, tankScalingFunction); + } + + @Override + public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { + return new MetaTileEntitySingleTurbine(metaTileEntityId, recipeMap, renderer, getTier(), getTankScalingFunction()); + } + + @Override + public boolean isValidFrontFacing(EnumFacing facing) { + return true; + } + + @Override + protected void renderOverlays(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { + if (getFrontFacing().getAxis() == EnumFacing.Axis.Y) { + // If facing is up or down, render the turbine on all 4 sides. + // Turbine renderer renders front and back, so just render it on both axes. + this.renderer.renderOrientedState(renderState, translation, pipeline, EnumFacing.NORTH, workable.isActive(), workable.isWorkingEnabled()); + this.renderer.renderOrientedState(renderState, translation, pipeline, EnumFacing.WEST, workable.isActive(), workable.isWorkingEnabled()); + } else { + super.renderOverlays(renderState, translation, pipeline); + } + } +} diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java index 9bd448a264f..f4e5f7f39c2 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java @@ -1,5 +1,6 @@ package gregtech.common.metatileentities.multi; +import codechicken.lib.raytracer.CuboidRayTraceResult; import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; @@ -8,6 +9,7 @@ import gregtech.api.gui.ModularUI; import gregtech.api.gui.widgets.*; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.MetaTileEntityUIFactory; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.IMultiblockPart; import gregtech.api.metatileentity.multiblock.RecipeMapPrimitiveMultiblockController; @@ -22,12 +24,12 @@ import gregtech.common.metatileentities.MetaTileEntities; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.SoundEvents; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundCategory; +import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; +import net.minecraftforge.fluids.FluidUtil; +import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -128,4 +130,21 @@ public void randomDisplayTick() { getWorld().spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0, 0, 0); } } + + @Override + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + // try to fill a bucket (or similar) with creosote on right click (if not sneaking) + if (playerIn.getHeldItem(hand).hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { + if (!playerIn.isSneaking()) { + return getWorld().isRemote || FluidUtil.interactWithFluidHandler(playerIn, hand, getFluidInventory()); + } else { + // allow opening UI on shift-right-click with fluid container item + if (getWorld() != null && !getWorld().isRemote) { + MetaTileEntityUIFactory.INSTANCE.openUI(getHolder(), (EntityPlayerMP) playerIn); + } + return true; + } + } + return super.onRightClick(playerIn, hand, facing, hitResult); + } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java index 0d97694cd34..eef47a5846f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java @@ -1,5 +1,6 @@ package gregtech.common.metatileentities.multi; +import codechicken.lib.raytracer.CuboidRayTraceResult; import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; @@ -18,8 +19,11 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.CapabilityItemHandler; @@ -114,4 +118,13 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t tooltip.add(I18n.format("gregtech.tool_action.wrench.set_facing")); super.addToolUsages(stack, world, tooltip, advanced); } + + @Override + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + // try to fill a bucket (or similar) with creosote on right click (if not sneaking) + if (!playerIn.isSneaking() && playerIn.getHeldItem(hand).hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { + return getWorld().isRemote || FluidUtil.interactWithFluidHandler(playerIn, hand, getFluidInventory()); + } + return super.onRightClick(playerIn, hand, facing, hitResult); + } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java index d63c5a875a6..06ffe1ce621 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java @@ -4,22 +4,24 @@ import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.BoilerRecipeLogic; +import gregtech.api.capability.impl.CommonFluidFilters; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.capability.impl.ItemHandlerList; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.Widget; import gregtech.api.gui.Widget.ClickData; +import gregtech.api.gui.resources.TextureArea; import gregtech.api.gui.widgets.ClickButtonWidget; import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.metatileentity.MTETrait; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; -import gregtech.api.metatileentity.multiblock.IMultiblockPart; -import gregtech.api.metatileentity.multiblock.MultiblockAbility; -import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase; +import gregtech.api.metatileentity.multiblock.*; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.pattern.PatternMatchContext; +import gregtech.api.util.TextComponentUtil; +import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.utils.TooltipHelper; import gregtech.core.sound.GTSoundEvents; @@ -31,8 +33,9 @@ import net.minecraft.util.SoundEvent; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; +import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; @@ -43,10 +46,7 @@ import java.util.Collections; import java.util.List; -import static gregtech.api.gui.widgets.AdvancedTextWidget.withHoverTextTranslate; -import static net.minecraft.util.text.TextFormatting.*; - -public class MetaTileEntityLargeBoiler extends MultiblockWithDisplayBase { +public class MetaTileEntityLargeBoiler extends MultiblockWithDisplayBase implements IProgressBarMultiblock { public final BoilerType boilerType; protected BoilerRecipeLogic recipeLogic; @@ -96,17 +96,65 @@ private void resetTileAbilities() { @Override protected void addDisplayText(List textList) { - super.addDisplayText(textList); + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(recipeLogic.isWorkingEnabled(), recipeLogic.isActive()) + .addCustom(tl -> { + if (isStructureFormed()) { + // Steam Output line + ITextComponent steamOutput = TextComponentUtil.stringWithColor( + TextFormatting.AQUA, + TextFormattingUtil.formatNumbers(recipeLogic.getLastTickSteam()) + " L/t"); + + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.large_boiler.steam_output", + steamOutput)); + + // Efficiency line + ITextComponent efficiency = TextComponentUtil.stringWithColor( + getNumberColor(recipeLogic.getHeatScaled()), + recipeLogic.getHeatScaled() + "%"); + + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.large_boiler.efficiency", + efficiency)); + + // Throttle line + ITextComponent throttle = TextComponentUtil.stringWithColor( + getNumberColor(getThrottle()), + getThrottle() + "%"); + + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.large_boiler.throttle", + throttle)); + } + }) + .addWorkingStatusLine(); + } + + private TextFormatting getNumberColor(int number) { + if (number == 0) { + return TextFormatting.DARK_RED; + } else if (number <= 40) { + return TextFormatting.RED; + } else if (number < 100) { + return TextFormatting.YELLOW; + } else { + return TextFormatting.GREEN; + } + } + + @Override + protected void addWarningText(List textList) { + super.addWarningText(textList); if (isStructureFormed()) { - int efficiency = recipeLogic.getHeatScaled(); - textList.add(new TextComponentTranslation("gregtech.multiblock.large_boiler.efficiency", - (efficiency == 0 ? DARK_RED : efficiency <= 40 ? RED : efficiency == 100 ? GREEN : YELLOW).toString() + efficiency + "%")); - textList.add(new TextComponentTranslation("gregtech.multiblock.large_boiler.steam_output", recipeLogic.getLastTickSteam())); - - ITextComponent throttleText = new TextComponentTranslation("gregtech.multiblock.large_boiler.throttle", - AQUA.toString() + getThrottle() + "%"); - withHoverTextTranslate(throttleText, "gregtech.multiblock.large_boiler.throttle.tooltip"); - textList.add(throttleText); + int[] waterAmount = getWaterAmount(); + if (waterAmount[0] == 0) { + textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.large_boiler.no_water")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.large_boiler.explosion_tooltip")); + } } } @@ -259,4 +307,56 @@ protected boolean shouldUpdate(MTETrait trait) { protected boolean shouldShowVoidingModeButton() { return false; } + + @Override + public double getFillPercentage(int index) { + if (!isStructureFormed()) return 0; + int[] waterAmount = getWaterAmount(); + if (waterAmount[1] == 0) return 0; // no water capacity + return (1.0 * waterAmount[0]) / waterAmount[1]; + } + + @Override + public TextureArea getProgressBarTexture(int index) { + return GuiTextures.PROGRESS_BAR_FLUID_RIG_DEPLETION; + } + + @Override + public void addBarHoverText(List hoverList, int index) { + if (!isStructureFormed()) { + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.invalid_structure")); + } else { + int[] waterAmount = getWaterAmount(); + if (waterAmount[0] == 0) { + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.large_boiler.no_water")); + } else { + ITextComponent waterInfo = TextComponentUtil.translationWithColor( + TextFormatting.BLUE, + "%s / %s L", + waterAmount[0], waterAmount[1]); + hoverList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.large_boiler.water_bar_hover", + waterInfo)); + } + } + } + + /** + * Returns an int[] of {AmountFilled, Capacity} where capacity is the sum of hatches with some water in them. + * If there is no water in the boiler (or the structure isn't formed, both of these values will be zero. + */ + private int[] getWaterAmount() { + if (!isStructureFormed()) return new int[]{0, 0}; + List tanks = getAbilities(MultiblockAbility.IMPORT_FLUIDS); + int filled = 0, capacity = 0; + for (IFluidTank tank : tanks) { + if (tank == null || tank.getFluid() == null) continue; + if (CommonFluidFilters.BOILER_FLUID.test(tank.getFluid())) { + filled += tank.getFluidAmount(); + capacity += tank.getCapacity(); + } + } + return new int[]{filled, capacity}; + } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityActiveTransformer.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityActiveTransformer.java index 971c5a15498..c7dee6a3957 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityActiveTransformer.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityActiveTransformer.java @@ -12,6 +12,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.IMultiblockPart; import gregtech.api.metatileentity.multiblock.MultiblockAbility; +import gregtech.api.metatileentity.multiblock.MultiblockDisplayText; import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; @@ -31,9 +32,6 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextComponentTranslation; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; @@ -151,11 +149,13 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, @Override protected void addDisplayText(List textList) { - super.addDisplayText(textList); - if (isActive()) { - textList.add(new TextComponentTranslation("gregtech.machine.active_transformer.routing") - .setStyle(new Style().setColor(TextFormatting.GREEN))); - } + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(true, isActive()) // set to true because we only want a two-state system (running or not running) + .setWorkingStatusKeys( + "gregtech.multiblock.idling", + "gregtech.multiblock.idling", + "gregtech.machine.active_transformer.routing") + .addWorkingStatusLine(); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java index ce6cd351b24..968ad2eb19d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java @@ -17,6 +17,7 @@ import gregtech.api.pattern.*; import gregtech.api.util.BlockInfo; import gregtech.api.util.GTUtility; +import gregtech.api.util.TextComponentUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.TooltipHelper; @@ -443,40 +444,47 @@ protected boolean isMachineBanned(MetaTileEntity metaTileEntity) { @Override protected void addDisplayText(List textList) { - super.addDisplayText(textList); - if (isStructureFormed()) { - if (energyContainer != null && energyContainer.getEnergyCapacity() > 0) { - long maxVoltage = Math.max(energyContainer.getInputVoltage(), energyContainer.getOutputVoltage()); - String voltageName = GTValues.VNF[GTUtility.getTierByVoltage(maxVoltage)]; - textList.add(new TextComponentTranslation("gregtech.multiblock.max_energy_per_tick", maxVoltage, voltageName)); - } - - if (!cleanroomLogic.isWorkingEnabled()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.work_paused")); - } else if (cleanroomLogic.isActive()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.running")); - textList.add(new TextComponentTranslation("gregtech.multiblock.progress", getProgressPercent())); - } else { - textList.add(new TextComponentTranslation("gregtech.multiblock.idling")); - } - - if (isClean()) textList.add(new TextComponentTranslation("gregtech.multiblock.cleanroom.clean_state")); - else textList.add(new TextComponentTranslation("gregtech.multiblock.cleanroom.dirty_state")); - textList.add(new TextComponentTranslation("gregtech.multiblock.cleanroom.clean_amount", this.cleanAmount)); - } + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(cleanroomLogic.isWorkingEnabled(), cleanroomLogic.isActive()) + .addEnergyUsageLine(energyContainer) + .addCustom(tl -> { + // Cleanliness status line + if (isStructureFormed()) { + ITextComponent cleanState; + if (isClean()) { + cleanState = TextComponentUtil.translationWithColor( + TextFormatting.GREEN, + "gregtech.multiblock.cleanroom.clean_state", + this.cleanAmount); + } else { + cleanState = TextComponentUtil.translationWithColor( + TextFormatting.DARK_RED, + "gregtech.multiblock.cleanroom.dirty_state", + this.cleanAmount); + } + + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.cleanroom.clean_status", + cleanState)); + } + }) + .addWorkingStatusLine() + .addProgressLine(getProgressPercent() / 100.0); } @Override protected void addWarningText(List textList) { - super.addWarningText(textList); - if (isStructureFormed()) { - if (!drainEnergy(true)) { - textList.add(new TextComponentTranslation("gregtech.multiblock.not_enough_energy").setStyle(new Style().setColor(TextFormatting.RED))); - } - if (!isClean()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.cleanroom.dirty_state")); - } - } + MultiblockDisplayText.builder(textList, isStructureFormed(), false) + .addLowPowerLine(!drainEnergy(true)) + .addCustom(tl -> { + if (isStructureFormed() && !isClean()) { + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.YELLOW, + "gregtech.multiblock.cleanroom.warning_contaminated")); + } + }) + .addMaintenanceProblemLines(getMaintenanceProblems()); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java index b26cffca037..931e411ea97 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java @@ -5,12 +5,14 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.IMultiblockPart; +import gregtech.api.metatileentity.multiblock.MultiblockDisplayText; import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.pattern.PatternMatchContext; import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage; +import gregtech.api.util.TextComponentUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.blocks.BlockMetalCasing; @@ -22,7 +24,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -75,9 +77,29 @@ public SoundEvent getBreakdownSound() { @Override protected void addDisplayText(List textList) { - super.addDisplayText(textList); - if (isStructureFormed()) - textList.add(new TextComponentTranslation("gregtech.multiblock.cracking_unit.energy", 100 - 10 * coilTier)); + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive()) + .addEnergyUsageLine(getEnergyContainer()) + .addCustom(tl -> { + // Coil energy discount line + if (isStructureFormed()) { + ITextComponent energyDiscount = TextComponentUtil.stringWithColor(TextFormatting.AQUA, (100 - 10 * coilTier) + "%"); + + ITextComponent base = TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.cracking_unit.energy", + energyDiscount); + + ITextComponent hover = TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.cracking_unit.energy_hover"); + + tl.add(TextComponentUtil.setHover(base, hover)); + } + }) + .addParallelsLine(recipeMapWorkable.getParallelLimit()) + .addWorkingStatusLine() + .addProgressLine(recipeMapWorkable.getProgressPercent()); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDataBank.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDataBank.java index 8df29da269a..ee455d04e58 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDataBank.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDataBank.java @@ -10,6 +10,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.IMultiblockPart; import gregtech.api.metatileentity.multiblock.MultiblockAbility; +import gregtech.api.metatileentity.multiblock.MultiblockDisplayText; import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; @@ -247,23 +248,21 @@ public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List @Override protected void addDisplayText(List textList) { - super.addDisplayText(textList); - if (isStructureFormed()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.energy_consumption", getEnergyUsage())); - if (hasNotEnoughEnergy) { - textList.add(new TextComponentTranslation("gregtech.multiblock.not_enough_energy") - .setStyle(new Style().setColor(TextFormatting.RED))); - } - } + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(true, isActive() && isWorkingEnabled()) // transform into two-state system for display + .setWorkingStatusKeys( + "gregtech.multiblock.idling", + "gregtech.multiblock.idling", + "gregtech.multiblock.data_bank.providing") + .addEnergyUsageExactLine(getEnergyUsage()) + .addWorkingStatusLine(); } @Override protected void addWarningText(List textList) { - super.addWarningText(textList); - if (isStructureFormed() && hasNotEnoughEnergy) { - textList.add(new TextComponentTranslation("gregtech.multiblock.not_enough_energy") - .setStyle(new Style().setColor(TextFormatting.RED))); - } + MultiblockDisplayText.builder(textList, isStructureFormed(), false) + .addLowPowerLine(hasNotEnoughEnergy) + .addMaintenanceProblemLines(getMaintenanceProblems()); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDistillationTower.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDistillationTower.java index 5d67c066d98..a4c6abd99b0 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDistillationTower.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDistillationTower.java @@ -8,18 +8,20 @@ import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.recipes.RecipeMaps; +import gregtech.api.util.TextComponentUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiFluidHatch; +import gregtech.common.metatileentities.multi.multiblockpart.appeng.MetaTileEntityMEOutputHatch; import gregtech.core.sound.GTSoundEvents; import net.minecraft.block.state.IBlockState; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -51,8 +53,11 @@ protected void addDisplayText(List textList) { if (isStructureFormed()) { FluidStack stackInTank = importFluids.drain(Integer.MAX_VALUE, false); if (stackInTank != null && stackInTank.amount > 0) { - TextComponentTranslation fluidName = new TextComponentTranslation(stackInTank.getFluid().getUnlocalizedName(stackInTank)); - textList.add(new TextComponentTranslation("gregtech.multiblock.distillation_tower.distilling_fluid", fluidName)); + ITextComponent fluidName = TextComponentUtil.translationWithColor(TextFormatting.AQUA, stackInTank.getFluid().getUnlocalizedName(stackInTank)); + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.distillation_tower.distilling_fluid", + fluidName)); } } super.addDisplayText(textList); @@ -71,7 +76,7 @@ protected BlockPattern createStructurePattern() { .or(abilities(MultiblockAbility.IMPORT_FLUIDS).setExactLimit(1))) .where('X', states(getCasingState()) .or(metaTileEntities(MultiblockAbility.REGISTRY.get(MultiblockAbility.EXPORT_FLUIDS).stream() - .filter(mte->!(mte instanceof MetaTileEntityMultiFluidHatch)) + .filter(mte -> !(mte instanceof MetaTileEntityMultiFluidHatch) && !(mte instanceof MetaTileEntityMEOutputHatch)) .toArray(MetaTileEntity[]::new)) .setMinLayerLimited(1).setMaxLayerLimited(1)) .or(autoAbilities(true, false))) diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java index e7935d50b18..87e6362b5c7 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java @@ -9,6 +9,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.IMultiblockPart; import gregtech.api.metatileentity.multiblock.MultiblockAbility; +import gregtech.api.metatileentity.multiblock.MultiblockDisplayText; import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; @@ -18,6 +19,7 @@ import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.recipeproperties.TemperatureProperty; import gregtech.api.util.GTUtility; +import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; @@ -64,11 +66,25 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { @Override protected void addDisplayText(List textList) { - if (isStructureFormed()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.blast_furnace.max_temperature", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(blastFurnaceTemperature) + "K").setStyle(new Style().setColor(TextFormatting.RED)))); - } - super.addDisplayText(textList); + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive()) + .addEnergyUsageLine(getEnergyContainer()) + .addCustom(tl -> { + // Coil heat capacity line + if (isStructureFormed()) { + ITextComponent heatString = TextComponentUtil.stringWithColor( + TextFormatting.RED, + TextFormattingUtil.formatNumbers(blastFurnaceTemperature) + "K"); + + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.blast_furnace.max_temperature", + heatString)); + } + }) + .addParallelsLine(recipeMapWorkable.getParallelLimit()) + .addWorkingStatusLine() + .addProgressLine(recipeMapWorkable.getProgressPercent()); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java index 54e7dd2857c..24034b1a884 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java @@ -12,12 +12,12 @@ import gregtech.api.capability.impl.EnergyContainerList; import gregtech.api.capability.impl.FluidDrillLogic; import gregtech.api.capability.impl.FluidTankList; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.resources.TextureArea; import gregtech.api.metatileentity.ITieredMetaTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; -import gregtech.api.metatileentity.multiblock.IMultiblockPart; -import gregtech.api.metatileentity.multiblock.MultiblockAbility; -import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase; +import gregtech.api.metatileentity.multiblock.*; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.pattern.PatternMatchContext; @@ -25,7 +25,9 @@ import gregtech.api.unification.material.Materials; import gregtech.api.util.GTTransferUtils; import gregtech.api.util.GTUtility; +import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; +import gregtech.api.worldgen.bedrockFluids.BedrockFluidVeinHandler; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.blocks.BlockMetalCasing; @@ -38,11 +40,10 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -52,7 +53,7 @@ import java.util.Collections; import java.util.List; -public class MetaTileEntityFluidDrill extends MultiblockWithDisplayBase implements ITieredMetaTileEntity, IWorkable { +public class MetaTileEntityFluidDrill extends MultiblockWithDisplayBase implements ITieredMetaTileEntity, IWorkable, IProgressBarMultiblock { private final FluidDrillLogic minerLogic; private final int tier; @@ -156,40 +157,52 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { @Override protected void addDisplayText(List textList) { - super.addDisplayText(textList); - if (!isStructureFormed()) - return; - - if (energyContainer != null && energyContainer.getEnergyCapacity() > 0) { - int energyContainer = getEnergyTier(); - long maxVoltage = GTValues.V[energyContainer]; - String voltageName = GTValues.VNF[energyContainer]; - textList.add(new TextComponentTranslation("gregtech.multiblock.max_energy_per_tick", maxVoltage, voltageName)); - } - - if (!minerLogic.isWorkingEnabled()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.work_paused")); - - } else if (minerLogic.isActive()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.running")); - int currentProgress = (int) (minerLogic.getProgressPercent() * 100); - textList.add(new TextComponentTranslation("gregtech.multiblock.progress", currentProgress)); - } else { - textList.add(new TextComponentTranslation("gregtech.multiblock.idling")); - } + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(minerLogic.isWorkingEnabled(), minerLogic.isActive()) + .setWorkingStatusKeys( + "gregtech.multiblock.idling", + "gregtech.multiblock.work_paused", + "gregtech.multiblock.miner.drilling") + .addEnergyUsageLine(energyContainer) + .addCustom(tl -> { + if (isStructureFormed()) { + if (minerLogic.getDrilledFluid() != null) { + // Fluid name + Fluid drilledFluid = minerLogic.getDrilledFluid(); + ITextComponent fluidInfo = TextComponentUtil.translationWithColor( + TextFormatting.GREEN, + drilledFluid.getUnlocalizedName()); + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.fluid_rig.drilled_fluid", + fluidInfo)); + + // Fluid amount + ITextComponent amountInfo = TextComponentUtil.stringWithColor( + TextFormatting.BLUE, + TextFormattingUtil.formatNumbers(minerLogic.getFluidToProduce() * 20L / FluidDrillLogic.MAX_PROGRESS) + " L/t"); + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.fluid_rig.fluid_amount", + amountInfo)); + } + } + }) + .addWorkingStatusLine() + .addProgressLine(minerLogic.getProgressPercent()); } @Override protected void addWarningText(List textList) { - super.addWarningText(textList); - if (isStructureFormed()) { - if (!drainEnergy(true)) { - textList.add(new TextComponentTranslation("gregtech.multiblock.not_enough_energy").setStyle(new Style().setColor(TextFormatting.RED))); - } - if (minerLogic.isInventoryFull()) { - textList.add(new TextComponentTranslation("gregtech.machine.miner.invfull").setStyle(new Style().setColor(TextFormatting.RED))); - } - } + MultiblockDisplayText.builder(textList, isStructureFormed(), false) + .addLowPowerLine(isStructureFormed() && !drainEnergy(true)) + .addCustom(tl -> { + if (isStructureFormed() && minerLogic.isInventoryFull()) { + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.YELLOW, + "gregtech.machine.miner.invfull")); + } + }); } @Override @@ -198,6 +211,9 @@ public void addInformation(ItemStack stack, @Nullable World world, List tooltip.add(I18n.format("gregtech.machine.fluid_drilling_rig.depletion", TextFormattingUtil.formatNumbers(100.0 / getDepletionChance()))); tooltip.add(I18n.format("gregtech.universal.tooltip.energy_tier_range", GTValues.VNF[this.tier], GTValues.VNF[this.tier + 1])); tooltip.add(I18n.format("gregtech.machine.fluid_drilling_rig.production", getRigMultiplier(), TextFormattingUtil.formatNumbers(getRigMultiplier() * 1.5))); + if (tier > GTValues.MV) { + tooltip.add(I18n.format("gregtech.machine.fluid_drilling_rig.shows_depletion")); + } } @Override @@ -337,4 +353,39 @@ public T getCapability(Capability capability, EnumFacing side) { protected boolean shouldShowVoidingModeButton() { return false; } + + @Override + public boolean showProgressBar() { + return tier > GTValues.MV; // only show for T2/3 fluid rigs + } + + @Override + public double getFillPercentage(int index) { + int numOperationsLeft = BedrockFluidVeinHandler.getOperationsRemaining(getWorld(), minerLogic.getChunkX(), minerLogic.getChunkZ()); + int maxOperations = BedrockFluidVeinHandler.MAXIMUM_VEIN_OPERATIONS; + return 1.0 * numOperationsLeft / maxOperations; + } + + @Override + public TextureArea getProgressBarTexture(int index) { + return GuiTextures.PROGRESS_BAR_FLUID_RIG_DEPLETION; + } + + @Override + public void addBarHoverText(List hoverList, int index) { + int numOperationsLeft = BedrockFluidVeinHandler.getOperationsRemaining(getWorld(), minerLogic.getChunkX(), minerLogic.getChunkZ()); + int maxOperations = BedrockFluidVeinHandler.MAXIMUM_VEIN_OPERATIONS; + int percentage = (int) Math.round(1.0 * numOperationsLeft / maxOperations * 100); + TextFormatting color = percentage > 40 ? TextFormatting.GREEN : percentage > 10 ? TextFormatting.YELLOW : TextFormatting.RED; + + if (numOperationsLeft == 0) { + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.fluid_rig.vein_depleted")); + } else { + ITextComponent veinInfo = TextComponentUtil.stringWithColor(color, percentage + "%"); + hoverList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.fluid_rig.vein_depletion", + veinInfo)); + } + } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java index be0f9703e40..7adbb613b45 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java @@ -1,15 +1,18 @@ package gregtech.common.metatileentities.multi.electric; +import com.google.common.collect.Lists; +import com.google.common.util.concurrent.AtomicDouble; import gregtech.api.GTValues; -import gregtech.api.capability.GregtechDataCodes; -import gregtech.api.capability.IEnergyContainer; +import gregtech.api.capability.*; import gregtech.api.capability.impl.*; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.ModularUI; +import gregtech.api.gui.resources.TextureArea; +import gregtech.api.gui.widgets.*; import gregtech.api.metatileentity.IFastRenderMetaTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; -import gregtech.api.metatileentity.multiblock.IMultiblockPart; -import gregtech.api.metatileentity.multiblock.MultiblockAbility; -import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; +import gregtech.api.metatileentity.multiblock.*; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.pattern.MultiblockShapeInfo; @@ -17,6 +20,8 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.recipeproperties.FusionEUToStartProperty; +import gregtech.api.util.TextComponentUtil; +import gregtech.api.util.TextFormattingUtil; import gregtech.api.util.interpolate.Eases; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; @@ -38,6 +43,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -46,7 +52,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.fml.relauncher.Side; @@ -59,6 +65,7 @@ import java.util.Arrays; import java.util.List; import java.util.Objects; +import java.util.function.DoubleSupplier; public class MetaTileEntityFusionReactor extends RecipeMapMultiblockController implements IFastRenderMetaTileEntity { @@ -66,18 +73,20 @@ public class MetaTileEntityFusionReactor extends RecipeMapMultiblockController i private EnergyContainerList inputEnergyContainers; private long heat = 0; // defined in TileEntityFusionReactor but serialized in FusionRecipeLogic private Integer color; + private final FusionProgressSupplier progressBarSupplier; public MetaTileEntityFusionReactor(ResourceLocation metaTileEntityId, int tier) { super(metaTileEntityId, RecipeMaps.FUSION_RECIPES); this.recipeMapWorkable = new FusionRecipeLogic(this); this.tier = tier; - this.energyContainer = new EnergyContainerHandler(this, Integer.MAX_VALUE, 0, 0, 0, 0) { + this.energyContainer = new EnergyContainerHandler(this, 0, 0, 0, 0, 0) { @Nonnull @Override public String getName() { return GregtechDataCodes.FUSION_REACTOR_ENERGY_CONTAINER_TRAIT; } }; + this.progressBarSupplier = new FusionProgressSupplier(); } @Override @@ -105,14 +114,14 @@ protected BlockPattern createStructurePattern() { .aisle("######ICI######", "####GGAAAGG####", "######ICI######") .aisle("###############", "######OSO######", "###############") .where('S', selfPredicate()) - .where('G', states(MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.FUSION_GLASS)).or(states(getCasingState()))) - .where('E', states(getCasingState()).or(metaTileEntities(Arrays.stream(MetaTileEntities.ENERGY_INPUT_HATCH) + .where('G', states(getCasingState(), getGlassState())) + .where('E', states(getCasingState(), getGlassState()).or(metaTileEntities(Arrays.stream(MetaTileEntities.ENERGY_INPUT_HATCH) .filter(mte -> mte != null && tier <= mte.getTier() && mte.getTier() <= GTValues.UV) .toArray(MetaTileEntity[]::new)) .setMinGlobalLimited(1).setPreviewCount(16))) .where('C', states(getCasingState())) .where('K', states(getCoilState())) - .where('O', states(getCasingState()).or(abilities(MultiblockAbility.EXPORT_FLUIDS))) + .where('O', states(getCasingState(), getGlassState()).or(abilities(MultiblockAbility.EXPORT_FLUIDS))) .where('A', air()) .where('I', states(getCasingState()).or(abilities(MultiblockAbility.IMPORT_FLUIDS).setMinGlobalLimited(2))) .where('#', any()) @@ -174,6 +183,10 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { } } + private IBlockState getGlassState() { + return MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.FUSION_GLASS); + } + private IBlockState getCasingState() { if (tier == GTValues.LuV) return MetaBlocks.FUSION_CASING.getState(BlockFusionCasing.CasingType.FUSION_CASING); @@ -198,6 +211,20 @@ protected void formStructure(PatternMatchContext context) { ((EnergyContainerHandler) this.energyContainer).setEnergyStored(energyStored); } + @Override + public void invalidateStructure() { + super.invalidateStructure(); + this.energyContainer = new EnergyContainerHandler(this, 0, 0, 0, 0, 0) { + @Nonnull + @Override + public String getName() { + return GregtechDataCodes.FUSION_REACTOR_ENERGY_CONTAINER_TRAIT; + } + }; + this.inputEnergyContainers = new EnergyContainerList(Lists.newArrayList()); + this.heat = 0; + } + @Override protected void initializeAbilities() { this.inputInventory = new ItemHandlerList(getAbilities(MultiblockAbility.IMPORT_ITEMS)); @@ -272,15 +299,6 @@ private void writeColor(PacketBuffer buf) { } } - @Override - protected void addDisplayText(List textList) { - super.addDisplayText(textList); - if (isStructureFormed()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.fusion_reactor.energy", this.energyContainer.getEnergyStored(), this.energyContainer.getEnergyCapacity())); - textList.add(new TextComponentTranslation("gregtech.multiblock.fusion_reactor.heat", heat)); - } - } - @Override public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); @@ -304,6 +322,215 @@ public long getHeat() { return heat; } + @Override + protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { + // Background + ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 198, 236); + + // Display + builder.image(4, 4, 190, 138, GuiTextures.DISPLAY); + + // Energy Bar + builder.widget(new ProgressWidget( + () -> energyContainer.getEnergyCapacity() > 0 ? 1.0 * energyContainer.getEnergyStored() / energyContainer.getEnergyCapacity() : 0, + 4, 144, 94, 7, + GuiTextures.PROGRESS_BAR_FUSION_ENERGY, ProgressWidget.MoveType.HORIZONTAL) + .setHoverTextConsumer(this::addEnergyBarHoverText)); + + // Heat Bar + builder.widget(new ProgressWidget( + () -> energyContainer.getEnergyCapacity() > 0 ? 1.0 * heat / energyContainer.getEnergyCapacity() : 0, + 100, 144, 94, 7, + GuiTextures.PROGRESS_BAR_FUSION_HEAT, ProgressWidget.MoveType.HORIZONTAL) + .setHoverTextConsumer(this::addHeatBarHoverText)); + + // Indicator Widget + builder.widget(new IndicatorImageWidget(174, 122, 17, 17, getLogo()) + .setWarningStatus(getWarningLogo(), this::addWarningText) + .setErrorStatus(getErrorLogo(), this::addErrorText)); + + // Title + if (tier == GTValues.LuV) { + // MK1 + builder.widget(new ImageWidget(66, 9, 67, 12, GuiTextures.FUSION_REACTOR_MK1_TITLE).setIgnoreColor(true)); + } else if (tier == GTValues.ZPM) { + // MK2 + builder.widget(new ImageWidget(65, 9, 69, 12, GuiTextures.FUSION_REACTOR_MK2_TITLE).setIgnoreColor(true)); + } else { + // MK3 + builder.widget(new ImageWidget(64, 9, 71, 12, GuiTextures.FUSION_REACTOR_MK3_TITLE).setIgnoreColor(true)); + } + + // Fusion Diagram + Progress Bar + builder.widget(new ImageWidget(55, 24, 89, 101, GuiTextures.FUSION_REACTOR_DIAGRAM).setIgnoreColor(true)); + builder.widget(FusionProgressSupplier.Type.BOTTOM_LEFT.getWidget(this)); + builder.widget(FusionProgressSupplier.Type.TOP_LEFT.getWidget(this)); + builder.widget(FusionProgressSupplier.Type.TOP_RIGHT.getWidget(this)); + builder.widget(FusionProgressSupplier.Type.BOTTOM_RIGHT.getWidget(this)); + + // Fusion Legend + builder.widget(new ImageWidget(7, 98, 108, 41, GuiTextures.FUSION_REACTOR_LEGEND).setIgnoreColor(true)); + + // Power Button + Detail + builder.widget(new ImageCycleButtonWidget(173, 211, 18, 18, GuiTextures.BUTTON_POWER, + recipeMapWorkable::isWorkingEnabled, recipeMapWorkable::setWorkingEnabled)); + builder.widget(new ImageWidget(173, 229, 18, 6, GuiTextures.BUTTON_POWER_DETAIL)); + + // Voiding Mode Button + builder.widget(new ImageCycleButtonWidget(173, 189, 18, 18, GuiTextures.BUTTON_VOID_MULTIBLOCK, + 4, this::getVoidingMode, this::setVoidingMode) + .setTooltipHoverString(MultiblockWithDisplayBase::getVoidingModeTooltip)); + + // Distinct Buses Unavailable Image + builder.widget(new ImageWidget(173, 171, 18, 18, GuiTextures.BUTTON_NO_DISTINCT_BUSES) + .setTooltip("gregtech.multiblock.universal.distinct_not_supported")); + + // Flex Unavailable Image + builder.widget(getFlexButton(173, 153, 18, 18)); + + // Player Inventory + builder.bindPlayerInventory(entityPlayer.inventory, 153); + return builder; + } + + private void addEnergyBarHoverText(List hoverList) { + ITextComponent energyInfo = TextComponentUtil.stringWithColor( + TextFormatting.AQUA, + TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored()) + " / " + + TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity()) + " EU"); + hoverList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.energy_stored", + energyInfo)); + } + + private void addHeatBarHoverText(List hoverList) { + ITextComponent heatInfo = TextComponentUtil.stringWithColor( + TextFormatting.RED, + TextFormattingUtil.formatNumbers(heat) + " / " + TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())); + hoverList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.fusion_reactor.heat", + heatInfo)); + } + + private static class FusionProgressSupplier { + + private final AtomicDouble tracker = new AtomicDouble(0.0); + private final ProgressWidget.TimedProgressSupplier bottomLeft; + private final DoubleSupplier topLeft; + private final DoubleSupplier topRight; + private final DoubleSupplier bottomRight; + + public FusionProgressSupplier() { + // Bottom Left, fill on [0, 0.25) + bottomLeft = new ProgressWidget.TimedProgressSupplier(200, 164, false) { + @Override + public double getAsDouble() { + double val = super.getAsDouble(); + tracker.set(val); + if (val >= 0.25) { + return 1; + } + return 4 * val; + } + + @Override + public void resetCountdown() { + super.resetCountdown(); + tracker.set(0); + } + }; + + // Top Left, fill on [0.25, 0.5) + topLeft = () -> { + double val = tracker.get(); + if (val < 0.25) { + return 0; + } else if (val >= 0.5) { + return 1; + } + return 4 * (val - 0.25); + }; + + // Top Right, fill on [0.5, 0.75) + topRight = () -> { + double val = tracker.get(); + if (val < 0.5) { + return 0; + } else if (val >= 0.75) { + return 1; + } + return 4 * (val - 0.5); + }; + + // Bottom Right, fill on [0.75, 1.0] + bottomRight = () -> { + double val = tracker.get(); + if (val < 0.75) { + return 0; + } else if (val >= 1) { + return 1; + } + return 4 * (val - 0.75); + }; + } + + public void resetCountdown() { + bottomLeft.resetCountdown(); + } + + public DoubleSupplier getSupplier(Type type) { + return switch (type) { + case BOTTOM_LEFT -> bottomLeft; + case TOP_LEFT -> topLeft; + case TOP_RIGHT -> topRight; + case BOTTOM_RIGHT -> bottomRight; + }; + } + + private enum Type { + BOTTOM_LEFT( + 61, 66, 35, 41, + GuiTextures.PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BL, ProgressWidget.MoveType.VERTICAL), + TOP_LEFT( + 61, 30, 41, 35, + GuiTextures.PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_TL, ProgressWidget.MoveType.HORIZONTAL), + TOP_RIGHT( + 103, 30, 35, 41, + GuiTextures.PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_TR, ProgressWidget.MoveType.VERTICAL_DOWNWARDS), + BOTTOM_RIGHT( + 97, 72, 41, 35, + GuiTextures.PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BR, ProgressWidget.MoveType.HORIZONTAL_BACKWARDS); + + private final int x; + private final int y; + private final int width; + private final int height; + private final TextureArea texture; + private final ProgressWidget.MoveType moveType; + + Type(int x, int y, int width, int height, TextureArea texture, ProgressWidget.MoveType moveType) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.texture = texture; + this.moveType = moveType; + } + + public ProgressWidget getWidget(MetaTileEntityFusionReactor instance) { + return new ProgressWidget( + () -> instance.recipeMapWorkable.isActive() ? instance.progressBarSupplier.getSupplier(this).getAsDouble() : 0, + x, y, width, height, texture, moveType) + .setIgnoreColor(true) + .setHoverTextConsumer(tl -> MultiblockDisplayText.builder(tl, instance.isStructureFormed()) + .setWorkingStatus(instance.recipeMapWorkable.isWorkingEnabled(), instance.recipeMapWorkable.isActive()) + .addWorkingStatusLine()); + } + } + } + private class FusionRecipeLogic extends MultiblockRecipeLogic { public FusionRecipeLogic(MetaTileEntityFusionReactor tileEntity) { @@ -331,8 +558,10 @@ public void updateWorkable() { // Drain heat when the reactor is not active, is paused via soft mallet, or does not have enough energy and has fully wiped recipe progress // Don't drain heat when there is not enough energy and there is still some recipe progress, as that makes it doubly hard to complete the recipe // (Will have to recover heat and recipe progress) - if ((!(isActive || workingEnabled) || (hasNotEnoughEnergy && progressTime == 0)) && heat > 0) { - heat = heat <= 10000 ? 0 : (heat - 10000); + if (heat > 0) { + if (!isActive || !workingEnabled || (hasNotEnoughEnergy && progressTime == 0)) { + heat = heat <= 10000 ? 0 : (heat - 10000); + } } } @@ -374,6 +603,14 @@ public void deserializeNBT(@Nonnull NBTTagCompound compound) { super.deserializeNBT(compound); heat = compound.getLong("Heat"); } + + @Override + protected void setActive(boolean active) { + if (active != isActive) { + MetaTileEntityFusionReactor.this.progressBarSupplier.resetCountdown(); + } + super.setActive(active); + } } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java index e8845501dc3..852d452a3e4 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java @@ -7,17 +7,22 @@ import gregtech.api.capability.*; import gregtech.api.capability.impl.EnergyContainerList; import gregtech.api.capability.impl.FluidTankList; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.ModularUI; +import gregtech.api.gui.resources.IGuiTexture; +import gregtech.api.gui.resources.TextureArea; +import gregtech.api.gui.widgets.ProgressWidget; +import gregtech.api.gui.widgets.SuppliedImageWidget; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; -import gregtech.api.metatileentity.multiblock.IMultiblockPart; -import gregtech.api.metatileentity.multiblock.MultiblockAbility; -import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase; +import gregtech.api.metatileentity.multiblock.*; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.pattern.MultiblockShapeInfo; import gregtech.api.pattern.PatternMatchContext; import gregtech.api.unification.material.Materials; import gregtech.api.util.GTUtility; +import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; @@ -26,19 +31,20 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.core.sound.GTSoundEvents; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextComponentTranslation; -import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.*; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.Fluid; @@ -53,15 +59,16 @@ import java.util.Collection; import java.util.List; import java.util.Set; +import java.util.function.Supplier; -public class MetaTileEntityHPCA extends MultiblockWithDisplayBase implements IOpticalComputationProvider, IControllable { +public class MetaTileEntityHPCA extends MultiblockWithDisplayBase implements IOpticalComputationProvider, IControllable, IProgressBarMultiblock { private static final double IDLE_TEMPERATURE = 200; private static final double DAMAGE_TEMPERATURE = 1000; private IEnergyContainer energyContainer; private IFluidHandler coolantHandler; - private final HPCAGridHandler hpcaHandler = new HPCAGridHandler(); + private final HPCAGridHandler hpcaHandler; private boolean isActive; private boolean isWorkingEnabled = true; @@ -69,9 +76,13 @@ public class MetaTileEntityHPCA extends MultiblockWithDisplayBase implements IOp private double temperature = IDLE_TEMPERATURE; // start at idle temperature + private final ProgressWidget.TimedProgressSupplier progressSupplier; + public MetaTileEntityHPCA(ResourceLocation metaTileEntityId) { super(metaTileEntityId); this.energyContainer = new EnergyContainerList(new ArrayList<>()); + this.progressSupplier = new ProgressWidget.TimedProgressSupplier(200, 47, false); + this.hpcaHandler = new HPCAGridHandler(this); } @Override @@ -113,6 +124,19 @@ public boolean canBridge(@NotNull Collection seen) return !isStructureFormed() || hpcaHandler.hasHPCABridge(); } + @Override + public void update() { + super.update(); + // we need to know what components we have on the client + if (getWorld().isRemote) { + if (isStructureFormed()) { + hpcaHandler.tryGatherClientComponents(getWorld(), getPos(), getFrontFacing()); + } else { + hpcaHandler.clearClientComponents(); + } + } + } + @Override protected void updateFormedValid() { consumeEnergy(); @@ -319,42 +343,57 @@ public void setWorkingEnabled(boolean isWorkingAllowed) { } @Override - protected void addDisplayText(List textList) { - super.addDisplayText(textList); - if (isStructureFormed()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.hpca.computation", - hpcaHandler.cachedCWUt, hpcaHandler.getMaxCWUt())); - textList.add(new TextComponentTranslation("gregtech.multiblock.hpca.energy", - TextFormattingUtil.formatNumbers(hpcaHandler.cachedEUt), - TextFormattingUtil.formatNumbers(hpcaHandler.getMaxEUt()), - GTValues.VNF[GTUtility.getTierByVoltage(hpcaHandler.getMaxEUt())])); - - int coolantDemand = hpcaHandler.getMaxCoolantDemand(); - if (coolantDemand > 0 && hpcaHandler.getCoolant() != null) { - textList.add(new TextComponentTranslation("gregtech.multiblock.hpca.coolant", coolantDemand)); - } - - int coolingDemand = hpcaHandler.getMaxCoolingDemand(); - int coolingProvided = hpcaHandler.getMaxCoolingAmount(); - textList.add(new TextComponentTranslation("gregtech.multiblock.hpca.cooling") - .appendText(getDisplayCoolingColor(coolingProvided, coolingDemand) + " " + coolingProvided + " / " + coolingDemand)); - - textList.add(new TextComponentTranslation("gregtech.multiblock.hpca.temperature") - .appendText(getDisplayTemperatureColor() + " " + Math.round(temperature / 10.0D) + "°C")); - - if (!isWorkingEnabled()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.work_paused")); - } else if (isActive() && hpcaHandler.cachedCWUt > 0) { - textList.add(new TextComponentTranslation("gregtech.multiblock.running")); - } else { - textList.add(new TextComponentTranslation("gregtech.multiblock.idling")); - } - - if (hasNotEnoughEnergy) { - textList.add(new TextComponentTranslation("gregtech.multiblock.not_enough_energy") - .setStyle(new Style().setColor(TextFormatting.RED))); + protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { + ModularUI.Builder builder = super.createUITemplate(entityPlayer); + + // Create the hover grid + builder.widget(new ProgressWidget( + () -> hpcaHandler.getAllocatedCWUt() > 0 ? progressSupplier.getAsDouble() : 0, + 74, 57, 47, 47, GuiTextures.HPCA_COMPONENT_OUTLINE, ProgressWidget.MoveType.HORIZONTAL) + .setIgnoreColor(true) + .setHoverTextConsumer(hpcaHandler::addInfo)); + int startX = 76; + int startY = 59; + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) { + final int index = i * 3 + j; + Supplier textureSupplier = () -> hpcaHandler.getComponentTexture(index); + builder.widget(new SuppliedImageWidget(startX + (15 * j), startY + (15 * i), 13, 13, textureSupplier).setIgnoreColor(true)); } } + return builder; + } + + @Override + protected void addDisplayText(List textList) { + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(true, hpcaHandler.getAllocatedCWUt() > 0) // transform into two-state system for display + .setWorkingStatusKeys( + "gregtech.multiblock.idling", + "gregtech.multiblock.idling", + "gregtech.multiblock.data_bank.providing") + .addCustom(tl -> { + if (isStructureFormed()) { + // Energy Usage + ITextComponent voltageName = new TextComponentString(GTValues.VNF[GTUtility.getTierByVoltage(hpcaHandler.getMaxEUt())]); + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.hpca.energy", + TextFormattingUtil.formatNumbers(hpcaHandler.cachedEUt), + TextFormattingUtil.formatNumbers(hpcaHandler.getMaxEUt()), + voltageName)); + + // Provided Computation + ITextComponent cwutInfo = TextComponentUtil.stringWithColor( + TextFormatting.AQUA, + hpcaHandler.cachedCWUt + " / " + hpcaHandler.getMaxCWUt() + " CWU/t"); + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.hpca.computation", + cwutInfo)); + } + }) + .addWorkingStatusLine(); } private TextFormatting getDisplayTemperatureColor() { @@ -366,33 +405,29 @@ private TextFormatting getDisplayTemperatureColor() { return TextFormatting.RED; } - private TextFormatting getDisplayCoolingColor(int provided, int demand) { - if (provided >= demand) { - return TextFormatting.GREEN; - } else if (demand - provided >= 2) { - return TextFormatting.YELLOW; - } - return TextFormatting.RED; - } - @Override protected void addWarningText(List textList) { - super.addWarningText(textList); - if (isStructureFormed()) { - if (temperature > 500) { - textList.add(new TextComponentTranslation("gregtech.multiblock.hpca.warning_temperature") - .setStyle(new Style().setColor(TextFormatting.RED))); - if (hpcaHandler.hasActiveCoolers()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.hpca.warning_temperature_active_cool") - .setStyle(new Style().setColor(TextFormatting.GRAY))); - } - } - if (hasNotEnoughEnergy) { - textList.add(new TextComponentTranslation("gregtech.multiblock.not_enough_energy") - .setStyle(new Style().setColor(TextFormatting.RED))); - } - hpcaHandler.addWarnings(textList); - } + MultiblockDisplayText.builder(textList, isStructureFormed(), false) + .addLowPowerLine(hasNotEnoughEnergy) + .addCustom(tl -> { + if (isStructureFormed()) { + if (temperature > 500) { + // Temperature warning + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.YELLOW, + "gregtech.multiblock.hpca.warning_temperature")); + + // Active cooler overdrive warning + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.hpca.warning_temperature_active_cool")); + } + + // Structure warnings + hpcaHandler.addWarnings(tl); + } + }) + .addMaintenanceProblemLines(getMaintenanceProblems()); } @Override @@ -400,7 +435,7 @@ protected void addErrorText(List textList) { super.addErrorText(textList); if (isStructureFormed()) { if (temperature > 1000) { - textList.add(new TextComponentTranslation("gregtech.multiblock.hpca.error_temperature")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.hpca.error_temperature")); } hpcaHandler.addErrors(textList); } @@ -465,6 +500,8 @@ public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) { } else if (dataId == GregtechDataCodes.WORKING_ENABLED) { this.isWorkingEnabled = buf.readBoolean(); scheduleRenderUpdate(); + } else if (dataId == GregtechDataCodes.CACHED_CWU) { + hpcaHandler.cachedCWUt = buf.readInt(); } } @@ -476,11 +513,54 @@ public T getCapability(Capability capability, EnumFacing side) { return super.getCapability(capability, side); } + @Override + public int getNumProgressBars() { + return 2; + } + + @Override + public double getFillPercentage(int index) { + return index == 0 + ? 1.0 * hpcaHandler.cachedCWUt / hpcaHandler.getMaxCWUt() + : Math.min(1.0, temperature / DAMAGE_TEMPERATURE); + } + + @Override + public TextureArea getProgressBarTexture(int index) { + return index == 0 + ? GuiTextures.PROGRESS_BAR_HPCA_COMPUTATION + : GuiTextures.PROGRESS_BAR_FUSION_HEAT; + } + + @Override + public void addBarHoverText(List hoverList, int index) { + if (index == 0) { + ITextComponent cwutInfo = TextComponentUtil.stringWithColor( + TextFormatting.AQUA, + hpcaHandler.cachedCWUt + " / " + hpcaHandler.getMaxCWUt() + " CWU/t"); + hoverList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.hpca.computation", + cwutInfo)); + } else { + ITextComponent tempInfo = TextComponentUtil.stringWithColor( + getDisplayTemperatureColor(), + Math.round(temperature / 10.0D) + "°C"); + hoverList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.hpca.temperature", + tempInfo)); + } + } + // Handles the logic of this structure's specific HPCA component grid public static class HPCAGridHandler { + @Nullable // for testing + private final MetaTileEntityHPCA controller; + // structure info - private final Set components = new ObjectOpenHashSet<>(); + private final List components = new ObjectArrayList<>(); private final Set coolantProviders = new ObjectOpenHashSet<>(); private final Set computationProviders = new ObjectOpenHashSet<>(); private int numBridges; @@ -493,6 +573,10 @@ public static class HPCAGridHandler { private int cachedEUt; private int cachedCWUt; + public HPCAGridHandler(@Nullable MetaTileEntityHPCA controller) { + this.controller = controller; + } + public void onStructureForm(Collection components) { reset(); for (var component : components) { @@ -526,7 +610,12 @@ private void clearComputationCache() { } public void tick() { - cachedCWUt = allocatedCWUt; + if (cachedCWUt != allocatedCWUt) { + cachedCWUt = allocatedCWUt; + if (controller != null) { + controller.writeCustomData(GregtechDataCodes.CACHED_CWU, buf -> buf.writeInt(cachedCWUt)); + } + } cachedEUt = getCurrentEUt(); if (allocatedCWUt != 0) { allocatedCWUt = 0; @@ -733,27 +822,95 @@ public int getMaxCoolantDemand() { return maxCoolant; } + public void addInfo(List textList) { + // Max Computation + ITextComponent data = TextComponentUtil.stringWithColor(TextFormatting.AQUA, Integer.toString(getMaxCWUt())); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.info_max_computation", data)); + + // Cooling + TextFormatting coolingColor = getMaxCoolingAmount() < getMaxCoolingDemand() ? TextFormatting.RED : TextFormatting.GREEN; + data = TextComponentUtil.stringWithColor(coolingColor, Integer.toString(getMaxCoolingDemand())); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.info_max_cooling_demand", data)); + + data = TextComponentUtil.stringWithColor(coolingColor, Integer.toString(getMaxCoolingAmount())); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.info_max_cooling_available", data)); + + // Coolant Required + if (getMaxCoolantDemand() > 0) { + data = TextComponentUtil.stringWithColor( + TextFormatting.YELLOW, + getMaxCoolantDemand() + "L "); + ITextComponent coolantName = TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.hpca.info_coolant_name"); + data.appendSibling(coolantName); + } else { + data = TextComponentUtil.stringWithColor(TextFormatting.GREEN, "0"); + } + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.info_max_coolant_required", data)); + + // Bridging + if (numBridges > 0) { + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GREEN, "gregtech.multiblock.hpca.info_bridging_enabled")); + } else { + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.hpca.info_bridging_disabled")); + } + } + public void addWarnings(List textList) { List warnings = new ArrayList<>(); if (numBridges > 1) { - warnings.add(new TextComponentTranslation("gregtech.multiblock.hpca.warning_multiple_bridges")); + warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.warning_multiple_bridges")); } if (computationProviders.isEmpty()) { - warnings.add(new TextComponentTranslation("gregtech.multiblock.hpca.warning_no_computation")); + warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.warning_no_computation")); } if (getMaxCoolingDemand() > getMaxCoolingAmount()) { - warnings.add(new TextComponentTranslation("gregtech.multiblock.hpca.warning_low_cooling")); + warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.warning_low_cooling")); } if (!warnings.isEmpty()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.hpca.warning_structure_header")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.hpca.warning_structure_header")); textList.addAll(warnings); } } public void addErrors(List textList) { if (components.stream().anyMatch(IHPCAComponentHatch::isDamaged)) { - textList.add(new TextComponentTranslation("gregtech.multiblock.hpca.error_damaged")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.hpca.error_damaged")); + } + } + + public TextureArea getComponentTexture(int index) { + if (components.size() <= index) { + return GuiTextures.BLANK_TRANSPARENT; + } + return components.get(index).getComponentIcon(); + } + + public void tryGatherClientComponents(World world, BlockPos pos, EnumFacing facing) { + if (components.isEmpty()) { + BlockPos testPos = pos + .offset(facing.getOpposite(), 3) + .offset(EnumFacing.UP, 3); + + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) { + BlockPos tempPos = testPos.offset(facing, j).offset(EnumFacing.DOWN, i); + TileEntity te = world.getTileEntity(tempPos); + if (te instanceof IHPCAComponentHatch hatch) { + components.add(hatch); + } else if (te instanceof IGregTechTileEntity igtte) { + MetaTileEntity mte = igtte.getMetaTileEntity(); + if (mte instanceof IHPCAComponentHatch hatch) { + components.add(hatch); + } + } + // if here without a hatch, something went wrong, better to skip than add a null into the mix. + } + } } } + + public void clearClientComponents() { + components.clear(); + } } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java index 299e081aa3c..a425e679733 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java @@ -21,6 +21,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.IMultiblockPart; import gregtech.api.metatileentity.multiblock.MultiblockAbility; +import gregtech.api.metatileentity.multiblock.MultiblockDisplayText; import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; @@ -30,6 +31,7 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; import gregtech.api.util.GTUtility; +import gregtech.api.util.TextComponentUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.blocks.BlockMetalCasing; @@ -258,17 +260,22 @@ private void addDisplayText2(List textList) { @Override protected void addWarningText(List textList) { - super.addWarningText(textList); - if (isStructureFormed()) { - if (this.isInventoryFull) { - textList.add(new TextComponentTranslation("gregtech.machine.miner.invfull").setStyle(new Style().setColor(TextFormatting.RED))); - } - if (!drainFluid(true)) { - textList.add(new TextComponentTranslation("gregtech.machine.miner.multi.needsfluid").setStyle(new Style().setColor(TextFormatting.RED))); - } - if (!drainEnergy(true)) { - textList.add(new TextComponentTranslation("gregtech.machine.miner.needspower").setStyle(new Style().setColor(TextFormatting.RED))); - } + MultiblockDisplayText.builder(textList, isStructureFormed(), false) + .addLowPowerLine(isStructureFormed() && !drainEnergy(true)) + .addCustom(tl -> { + if (isStructureFormed() && isInventoryFull) { + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.YELLOW, + "gregtech.machine.miner.invfull")); + } + }); + } + + @Override + protected void addErrorText(List textList) { + super.addErrorText(textList); + if (isStructureFormed() && !drainFluid(true)) { + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.machine.miner.multi.needsfluid")); } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java index f6618e3f159..68919a5bc94 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java @@ -4,16 +4,15 @@ import gregtech.api.capability.impl.MultiblockRecipeLogic; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; -import gregtech.api.metatileentity.multiblock.IMultiblockPart; -import gregtech.api.metatileentity.multiblock.MultiblockAbility; -import gregtech.api.metatileentity.multiblock.ParallelLogicType; -import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; +import gregtech.api.metatileentity.multiblock.*; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.pattern.PatternMatchContext; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.machines.RecipeMapFurnace; +import gregtech.api.util.TextComponentUtil; +import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; @@ -23,8 +22,8 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.*; +import net.minecraft.util.text.event.HoverEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -48,11 +47,48 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { @Override protected void addDisplayText(List textList) { - if (isStructureFormed()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.multi_furnace.heating_coil_level", heatingCoilLevel)); - textList.add(new TextComponentTranslation("gregtech.multiblock.multi_furnace.heating_coil_discount", heatingCoilDiscount)); - } - super.addDisplayText(textList); + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive()) + .addEnergyUsageLine(recipeMapWorkable.getEnergyContainer()) + .addCustom(tl -> { + if (isStructureFormed()) { + // Heating coil discount + if (heatingCoilDiscount > 1) { + ITextComponent coilDiscount = TextComponentUtil.stringWithColor( + TextFormatting.AQUA, + TextFormattingUtil.formatNumbers(100.0 / heatingCoilDiscount) + "%"); + + ITextComponent base = TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.multi_furnace.heating_coil_discount", + coilDiscount); + + ITextComponent hoverText = TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.multi_furnace.heating_coil_discount_hover"); + + TextComponentUtil.setHover(base, hoverText); + tl.add(base); + } + + // Custom parallels line so we can have a hover text + if (recipeMapWorkable.getParallelLimit() > 1) { + ITextComponent parallels = TextComponentUtil.stringWithColor( + TextFormatting.DARK_PURPLE, + TextFormattingUtil.formatNumbers(recipeMapWorkable.getParallelLimit())); + ITextComponent bodyText = TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.parallel", + parallels); + ITextComponent hoverText = TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.multi_furnace.parallel_hover"); + tl.add(TextComponentUtil.setHover(bodyText, hoverText)); + } + } + }) + .addWorkingStatusLine() + .addProgressLine(recipeMapWorkable.getProgressPercent()); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityNetworkSwitch.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityNetworkSwitch.java index fa79c4709d1..e4c7fc9cfa7 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityNetworkSwitch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityNetworkSwitch.java @@ -11,9 +11,11 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.IMultiblockPart; import gregtech.api.metatileentity.multiblock.MultiblockAbility; +import gregtech.api.metatileentity.multiblock.MultiblockDisplayText; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.pattern.PatternMatchContext; +import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; @@ -25,10 +27,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.event.HoverEvent; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -151,23 +150,24 @@ public void addInformation(ItemStack stack, @Nullable World world, @NotNull List @Override protected void addDisplayText(List textList) { - super.addDisplayText(textList); - if (isStructureFormed()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.computation.max", computationHandler.getMaxCWUtForDisplay())); - if (computationHandler.hasNonBridgingConnections()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.computation.non_bridging") - .setStyle(new Style().setColor(TextFormatting.RED) - .setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, - new TextComponentTranslation("gregtech.multiblock.computation.non_bridging.detailed"))))); - } - } + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(true, isActive() && isWorkingEnabled()) // transform into two-state system for display + .setWorkingStatusKeys( + "gregtech.multiblock.idling", + "gregtech.multiblock.idling", + "gregtech.multiblock.data_bank.providing") + .addEnergyUsageExactLine(getEnergyUsage()) + .addComputationUsageLine(computationHandler.getMaxCWUtForDisplay()) + .addWorkingStatusLine(); } @Override protected void addWarningText(List textList) { + super.addWarningText(textList); if (isStructureFormed() && computationHandler.hasNonBridgingConnections()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.computation.non_bridging.detailed") - .setStyle(new Style().setColor(TextFormatting.RED))); + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.YELLOW, + "gregtech.multiblock.computation.non_bridging.detailed")); } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPowerSubstation.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPowerSubstation.java index 1d1fa82c3dd..e80fb1044b0 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPowerSubstation.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPowerSubstation.java @@ -12,12 +12,10 @@ import gregtech.api.capability.impl.EnergyContainerList; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; -import gregtech.api.metatileentity.multiblock.IBatteryData; -import gregtech.api.metatileentity.multiblock.IMultiblockPart; -import gregtech.api.metatileentity.multiblock.MultiblockAbility; -import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase; +import gregtech.api.metatileentity.multiblock.*; import gregtech.api.pattern.*; import gregtech.api.util.BlockInfo; +import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; @@ -36,9 +34,8 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; import net.minecraft.util.text.TextComponentTranslation; -import net.minecraft.util.text.event.HoverEvent; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; @@ -54,7 +51,7 @@ import static gregtech.api.util.RelativeDirection.*; -public class MetaTileEntityPowerSubstation extends MultiblockWithDisplayBase implements IControllable { +public class MetaTileEntityPowerSubstation extends MultiblockWithDisplayBase implements IControllable, IProgressBarMultiblock { // Structure Constants public static final int MAX_BATTERY_LAYERS = 18; @@ -315,27 +312,89 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, @Override protected void addDisplayText(List textList) { - super.addDisplayText(textList); - if (isStructureFormed()) { - if (energyBank != null) { - BigInteger energyStored = energyBank.getStored(); - BigInteger energyCapacity = energyBank.getCapacity(); - textList.add(new TextComponentTranslation("gregtech.multiblock.power_substation.stored", TextFormattingUtil.formatNumbers(energyStored))); - textList.add(new TextComponentTranslation("gregtech.multiblock.power_substation.capacity", TextFormattingUtil.formatNumbers(energyCapacity))); - textList.add(new TextComponentTranslation("gregtech.multiblock.power_substation.passive_drain", TextFormattingUtil.formatNumbers(getPassiveDrain()))); - textList.add(new TextComponentTranslation("gregtech.multiblock.power_substation.average_io", TextFormattingUtil.formatNumbers(averageIOLastSec)) - .setStyle(new Style().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, - new TextComponentTranslation("gregtech.multiblock.power_substation.average_io_hover"))))); - - if (averageIOLastSec > 0) { - BigInteger timeToFillSeconds = energyCapacity.subtract(energyStored).divide(BigInteger.valueOf(averageIOLastSec * 20)); - textList.add(new TextComponentTranslation("gregtech.multiblock.power_substation.time_to_fill", getTimeToFillDrainText(timeToFillSeconds))); - } else if (averageIOLastSec < 0) { - BigInteger timeToDrainSeconds = energyStored.divide(BigInteger.valueOf(Math.abs(averageIOLastSec) * 20)); - textList.add(new TextComponentTranslation("gregtech.multiblock.power_substation.time_to_drain", getTimeToFillDrainText(timeToDrainSeconds))); - } - } - } + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(true, isActive() && isWorkingEnabled()) // transform into two-state system for display + .setWorkingStatusKeys( + "gregtech.multiblock.idling", + "gregtech.multiblock.idling", + "gregtech.machine.active_transformer.routing") + .addCustom(tl -> { + if (isStructureFormed() && energyBank != null) { + BigInteger energyStored = energyBank.getStored(); + BigInteger energyCapacity = energyBank.getCapacity(); + + // Stored EU line + ITextComponent storedFormatted = TextComponentUtil.stringWithColor( + TextFormatting.GOLD, + TextFormattingUtil.formatNumbers(energyStored) + " EU"); + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.power_substation.stored", + storedFormatted)); + + // EU Capacity line + ITextComponent capacityFormatted = TextComponentUtil.stringWithColor( + TextFormatting.GOLD, + TextFormattingUtil.formatNumbers(energyCapacity) + " EU"); + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.power_substation.capacity", + capacityFormatted)); + + // Passive Drain line + ITextComponent passiveDrain = TextComponentUtil.stringWithColor( + TextFormatting.DARK_RED, + TextFormattingUtil.formatNumbers(getPassiveDrain()) + " EU/t"); + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.power_substation.passive_drain", + passiveDrain)); + + // Average I/O line + TextFormatting averageIOColor = TextFormatting.GRAY; + if (isActive() && isWorkingEnabled() && averageIOLastSec == 0) { + // only set to yellow on zero if the machine is on, avoids a yellow "warning" + // color when the machine is first formed and not yet plugged in. + averageIOColor = TextFormatting.YELLOW; + } else if (averageIOLastSec > 0) { + averageIOColor = TextFormatting.GREEN; + } else if (averageIOLastSec < 0) { + averageIOColor = TextFormatting.RED; + } + + ITextComponent averageIO = TextComponentUtil.stringWithColor( + averageIOColor, + TextFormattingUtil.formatNumbers(averageIOLastSec) + " EU/t"); + + ITextComponent base = TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.power_substation.average_io", + averageIO); + + ITextComponent hover = TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.power_substation.average_io_hover"); + tl.add(TextComponentUtil.setHover(base, hover)); + + // Time to fill/drain line + if (averageIOLastSec > 0) { + ITextComponent timeToFill = getTimeToFillDrainText(energyCapacity.subtract(energyStored).divide(BigInteger.valueOf(averageIOLastSec * 20))); + TextComponentUtil.setColor(timeToFill, TextFormatting.GREEN); + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.power_substation.time_to_fill", + timeToFill)); + } else if (averageIOLastSec < 0) { + ITextComponent timeToDrain = getTimeToFillDrainText(energyStored.divide(BigInteger.valueOf(Math.abs(averageIOLastSec) * 20))); + TextComponentUtil.setColor(timeToDrain, TextFormatting.RED); + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.power_substation.time_to_drain", + timeToDrain)); + } + } + }) + .addWorkingStatusLine(); } @Override @@ -345,7 +404,9 @@ protected void addWarningText(List textList) { if (averageIOLastSec < 0) { // decreasing BigInteger timeToDrainSeconds = energyBank.getStored().divide(BigInteger.valueOf(Math.abs(averageIOLastSec) * 20)); if (timeToDrainSeconds.compareTo(BigInteger.valueOf(60 * 60)) < 0) { // less than 1 hour left - textList.add(new TextComponentTranslation("gregtech.multiblock.power_substation.under_one_hour_left")); + textList.add(TextComponentUtil.translationWithColor( + TextFormatting.YELLOW, + "gregtech.multiblock.power_substation.under_one_hour_left")); } } } @@ -455,6 +516,20 @@ public String getStored() { return TextFormattingUtil.formatNumbers(energyBank.getStored()); } + public long getStoredLong() { + if (energyBank == null) { + return 0; + } + return energyBank.getStored().longValue() & ~(1L << 63); + } + + public long getCapacityLong() { + if (energyBank == null) { + return 0; + } + return energyBank.getCapacity().longValue() & ~(1L << 63); + } + public String getCapacity() { if (energyBank == null) { return "0"; @@ -466,6 +541,26 @@ public long getAverageIOLastSec() { return averageIOLastSec; } + @Override + public double getFillPercentage(int index) { + if (energyBank == null) return 0; + return energyBank.getStored().doubleValue() / energyBank.getCapacity().doubleValue(); + } + + @Override + public void addBarHoverText(List hoverList, int index) { + String stored = energyBank != null ? TextFormattingUtil.formatNumbers(energyBank.getStored()) : "0"; + String capacity = energyBank != null ? TextFormattingUtil.formatNumbers(energyBank.getCapacity()) : "0"; + + ITextComponent energyInfo = TextComponentUtil.stringWithColor( + TextFormatting.YELLOW, + stored + " / " + capacity + " EU"); + hoverList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.energy_stored", + energyInfo)); + } + public static class PowerStationEnergyBank { private static final String NBT_SIZE = "Size"; diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java index 1ff9fb017cc..34dab5a22af 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java @@ -17,6 +17,8 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.api.util.GTUtility; +import gregtech.api.util.TextComponentUtil; +import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.OrientedOverlayRenderer; @@ -30,8 +32,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -106,10 +107,51 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { @Override protected void addDisplayText(List textList) { - super.addDisplayText(textList); - if (this.isActive()) { - textList.add(new TextComponentTranslation("gregtech.machine.machine_hatch.locked").setStyle(new Style().setColor(TextFormatting.RED))); - } + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive()) + .addEnergyUsageLine(recipeMapWorkable.getEnergyContainer()) + .addCustom(tl -> { + if (isStructureFormed()) { + ProcessingArrayWorkable logic = (ProcessingArrayWorkable) recipeMapWorkable; + + // Machine mode text + // Shared text components for both states + ITextComponent maxMachinesText = TextComponentUtil.stringWithColor(TextFormatting.DARK_PURPLE, Integer.toString(getMachineLimit())); + maxMachinesText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.machine.machine_hatch.machines_max", maxMachinesText); + + if (logic.activeRecipeMap == null) { + // No machines in hatch + ITextComponent noneText = TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.machine.machine_hatch.machines_none"); + ITextComponent bodyText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.machine.machine_hatch.machines", noneText); + ITextComponent hoverText1 = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.machine.machine_hatch.machines_none_hover"); + tl.add(TextComponentUtil.setHover(bodyText, hoverText1, maxMachinesText)); + } else { + // Some amount of machines in hatch + String key = logic.getMachineStack().getTranslationKey(); + ITextComponent mapText = TextComponentUtil.translationWithColor(TextFormatting.DARK_PURPLE, key + ".name"); + mapText = TextComponentUtil.translationWithColor( + TextFormatting.DARK_PURPLE, + "%sx %s", + logic.getParallelLimit(), mapText); + ITextComponent bodyText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.machine.machine_hatch.machines", mapText); + ITextComponent voltageName = new TextComponentString(GTValues.VNF[logic.machineTier]); + int amps = logic.getMachineStack().getCount(); + String energyFormatted = TextFormattingUtil.formatNumbers(GTValues.V[logic.machineTier] * amps); + ITextComponent hoverText = TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.machine.machine_hatch.machines_max_eut", + energyFormatted, amps, voltageName); + tl.add(TextComponentUtil.setHover(bodyText, hoverText, maxMachinesText)); + } + + // Hatch locked status + if (isActive()) { + tl.add(TextComponentUtil.translationWithColor(TextFormatting.DARK_RED, "gregtech.machine.machine_hatch.locked")); + } + } + }) + .addWorkingStatusLine() + .addProgressLine(recipeMapWorkable.getProgressPercent()); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java index 201613bf1aa..90e6a0c5cbb 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java @@ -5,12 +5,14 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.IMultiblockPart; +import gregtech.api.metatileentity.multiblock.MultiblockDisplayText; import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.pattern.PatternMatchContext; import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage; +import gregtech.api.util.TextComponentUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.blocks.BlockMachineCasing.MachineCasingType; @@ -23,6 +25,7 @@ import net.minecraft.util.SoundEvent; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -93,9 +96,43 @@ protected void formStructure(PatternMatchContext context) { @Override protected void addDisplayText(List textList) { - super.addDisplayText(textList); - if (isStructureFormed()) - textList.add(new TextComponentTranslation("gregtech.multiblock.pyrolyse_oven.speed", coilTier == 0 ? 75 : 50 * (coilTier + 1))); + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive()) + .addEnergyUsageLine(recipeMapWorkable.getEnergyContainer()) + .addCustom(tl -> { + if (isStructureFormed()) { + int processingSpeed = coilTier == 0 ? 75 : 50 * (coilTier + 1); + ITextComponent speedIncrease = TextComponentUtil.stringWithColor( + getSpeedColor(processingSpeed), + processingSpeed + "%"); + + ITextComponent base = TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.pyrolyse_oven.speed", + speedIncrease); + + ITextComponent hover = TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.pyrolyse_oven.speed_hover"); + + tl.add(TextComponentUtil.setHover(base, hover)); + } + }) + .addParallelsLine(recipeMapWorkable.getParallelLimit()) + .addWorkingStatusLine() + .addProgressLine(recipeMapWorkable.getProgressPercent()); + } + + private TextFormatting getSpeedColor(int speed) { + if (speed < 100) { + return TextFormatting.RED; + } else if (speed == 100) { + return TextFormatting.GRAY; + } else if (speed < 250) { + return TextFormatting.GREEN; + } else { + return TextFormatting.LIGHT_PURPLE; + } } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityResearchStation.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityResearchStation.java index 0f74bab3d59..cad1696cfa5 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityResearchStation.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityResearchStation.java @@ -11,6 +11,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.IMultiblockPart; import gregtech.api.metatileentity.multiblock.MultiblockAbility; +import gregtech.api.metatileentity.multiblock.MultiblockDisplayText; import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; @@ -31,9 +32,6 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextComponentTranslation; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -216,24 +214,25 @@ public void addInformation(ItemStack stack, @Nullable World world, @NotNull List @Override protected void addDisplayText(List textList) { - super.addDisplayText(textList); - if (isStructureFormed() && isActive()) { - var recipeLogic = getRecipeMapWorkable(); - textList.add(new TextComponentTranslation("gregtech.multiblock.computation.usage", recipeLogic.getCurrentDrawnCWUt())); - if (recipeLogic.isHasNotEnoughComputation()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.computation.not_enough_computation") - .setStyle(new Style().setColor(TextFormatting.RED))); - } - } + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive()) + .setWorkingStatusKeys( + "gregtech.multiblock.idling", + "gregtech.multiblock.work_paused", + "gregtech.machine.research_station.researching") + .addEnergyUsageLine(recipeMapWorkable.getEnergyContainer()) + .addComputationUsageExactLine(getRecipeMapWorkable().getCurrentDrawnCWUt()) + .addParallelsLine(recipeMapWorkable.getParallelLimit()) + .addWorkingStatusLine() + .addProgressLine(recipeMapWorkable.getProgressPercent()); } @Override protected void addWarningText(List textList) { - super.addWarningText(textList); - if (isStructureFormed() && isActive() && getRecipeMapWorkable().isHasNotEnoughComputation()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.computation.not_enough_computation") - .setStyle(new Style().setColor(TextFormatting.RED))); - } + MultiblockDisplayText.builder(textList, isStructureFormed(), false) + .addLowPowerLine(recipeMapWorkable.isHasNotEnoughEnergy()) + .addLowComputationLine(getRecipeMapWorkable().isHasNotEnoughComputation()) + .addMaintenanceProblemLines(getMaintenanceProblems()); } private static class ResearchStationRecipeLogic extends ComputationRecipeLogic { diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java index 7bfefc9cce2..5b1c048fa66 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java @@ -5,17 +5,18 @@ import gregtech.api.capability.IEnergyContainer; import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.capability.impl.MultiblockFuelRecipeLogic; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.resources.TextureArea; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; -import gregtech.api.metatileentity.multiblock.FuelMultiblockController; -import gregtech.api.metatileentity.multiblock.IMultiblockPart; -import gregtech.api.metatileentity.multiblock.MultiblockAbility; -import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; +import gregtech.api.metatileentity.multiblock.*; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.pattern.PatternMatchContext; import gregtech.api.recipes.RecipeMaps; +import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; +import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; @@ -30,7 +31,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.relauncher.Side; @@ -40,7 +41,7 @@ import javax.annotation.Nullable; import java.util.List; -public class MetaTileEntityLargeCombustionEngine extends FuelMultiblockController { +public class MetaTileEntityLargeCombustionEngine extends FuelMultiblockController implements IProgressBarMultiblock { private final int tier; private final boolean isExtreme; @@ -61,59 +62,45 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { @Override protected void addDisplayText(List textList) { - super.addDisplayText(textList); - if (isStructureFormed()) { - if (getInputFluidInventory() != null) { - FluidStack lubricantStack = getInputFluidInventory().drain(Materials.Lubricant.getFluid(Integer.MAX_VALUE), false); - FluidStack oxygenStack = getInputFluidInventory().drain(Materials.Oxygen.getFluid(Integer.MAX_VALUE), false); - FluidStack liquidOxygenStack = getInputFluidInventory().drain(Materials.LiquidOxygen.getFluid(Integer.MAX_VALUE), false); - int lubricantAmount = lubricantStack == null ? 0 : lubricantStack.amount; - textList.add(new TextComponentTranslation("gregtech.multiblock.large_combustion_engine.lubricant_amount", TextFormattingUtil.formatNumbers(lubricantAmount))); - if (boostAllowed) { - if (!isExtreme) { - if (((LargeCombustionEngineWorkableHandler) recipeMapWorkable).isOxygenBoosted) { - int oxygenAmount = oxygenStack == null ? 0 : oxygenStack.amount; - textList.add(new TextComponentTranslation("gregtech.multiblock.large_combustion_engine.oxygen_amount", TextFormattingUtil.formatNumbers(oxygenAmount))); - textList.add(new TextComponentTranslation("gregtech.multiblock.large_combustion_engine.oxygen_boosted")); - } else { - textList.add(new TextComponentTranslation("gregtech.multiblock.large_combustion_engine.supply_oxygen_to_boost")); - } - } - else { - if (((LargeCombustionEngineWorkableHandler) recipeMapWorkable).isOxygenBoosted) { - int liquidOxygenAmount = liquidOxygenStack == null ? 0 : liquidOxygenStack.amount; - textList.add(new TextComponentTranslation("gregtech.multiblock.large_combustion_engine.liquid_oxygen_amount", TextFormattingUtil.formatNumbers((liquidOxygenAmount)))); - textList.add(new TextComponentTranslation("gregtech.multiblock.large_combustion_engine.liquid_oxygen_boosted")); - } else { - textList.add(new TextComponentTranslation("gregtech.multiblock.large_combustion_engine.supply_liquid_oxygen_to_boost")); - } - } - } else { - textList.add(new TextComponentTranslation("gregtech.multiblock.large_combustion_engine.boost_disallowed")); - } - } + LargeCombustionEngineWorkableHandler recipeLogic = ((LargeCombustionEngineWorkableHandler) recipeMapWorkable); + + MultiblockDisplayText.Builder builder = MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(recipeLogic.isWorkingEnabled(), recipeLogic.isActive()); + + if (isExtreme) { + builder.addEnergyProductionLine(GTValues.V[tier + 1], recipeLogic.getRecipeEUt()); + } else { + builder.addEnergyProductionAmpsLine(GTValues.V[tier] * 3, 3); } + + builder.addFuelNeededLine(recipeLogic.getRecipeFluidInputInfo(), recipeLogic.getPreviousRecipeDuration()) + .addCustom(tl -> { + if (isStructureFormed() && recipeLogic.isOxygenBoosted) { + String key = isExtreme + ? "gregtech.multiblock.large_combustion_engine.liquid_oxygen_boosted" + : "gregtech.multiblock.large_combustion_engine.oxygen_boosted"; + tl.add(TextComponentUtil.translationWithColor(TextFormatting.AQUA, key)); + } + }) + .addWorkingStatusLine(); } @Override - protected void addWarningText(List textList) { - super.addWarningText(textList); + protected void addErrorText(List textList) { + super.addErrorText(textList); if (isStructureFormed()) { + if (checkIntakesObstructed()) { + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.large_combustion_engine.obstructed")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.large_combustion_engine.obstructed.desc")); + } + FluidStack lubricantStack = getInputFluidInventory().drain(Materials.Lubricant.getFluid(Integer.MAX_VALUE), false); if (lubricantStack == null || lubricantStack.amount == 0) { - textList.add(new TextComponentTranslation("gregtech.multiblock.large_combustion_engine.no_lubricant")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.large_combustion_engine.no_lubricant")); } } } - @Override - protected void addErrorText(List textList) { - super.addErrorText(textList); - if (isStructureFormed() && checkIntakesObstructed()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.large_combustion_engine.obstructed")); - } - } - @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); @@ -220,6 +207,104 @@ public boolean isBoostAllowed() { return boostAllowed; } + @Override + public int getNumProgressBars() { + return 3; + } + + @Override + public double getFillPercentage(int index) { + if (index == 0) { + int[] fuelAmount = new int[2]; + if (getInputFluidInventory() != null) { + MultiblockFuelRecipeLogic recipeLogic = (MultiblockFuelRecipeLogic) recipeMapWorkable; + if (recipeLogic.getInputFluidStack() != null) { + FluidStack testStack = recipeLogic.getInputFluidStack().copy(); + testStack.amount = Integer.MAX_VALUE; + fuelAmount = getTotalFluidAmount(testStack, getInputFluidInventory()); + } + } + return fuelAmount[1] != 0 ? 1.0 * fuelAmount[0] / fuelAmount[1] : 0; + } else if (index == 1) { + int[] lubricantAmount = new int[2]; + if (getInputFluidInventory() != null) { + lubricantAmount = getTotalFluidAmount(Materials.Lubricant.getFluid(Integer.MAX_VALUE), getInputFluidInventory()); + } + return lubricantAmount[1] != 0 ? 1.0 * lubricantAmount[0] / lubricantAmount[1] : 0; + } else { + int[] oxygenAmount = new int[2]; + if (getInputFluidInventory() != null) { + if (isBoostAllowed()) { + Material material = isExtreme ? Materials.LiquidOxygen : Materials.Oxygen; + oxygenAmount = getTotalFluidAmount(material.getFluid(Integer.MAX_VALUE), getInputFluidInventory()); + } + } + return oxygenAmount[1] != 0 ? 1.0 * oxygenAmount[0] / oxygenAmount[1] : 0; + } + } + + @Override + public TextureArea getProgressBarTexture(int index) { + if (index == 0) { + return GuiTextures.PROGRESS_BAR_LCE_FUEL; + } else if (index == 1) { + return GuiTextures.PROGRESS_BAR_LCE_LUBRICANT; + } else { + return GuiTextures.PROGRESS_BAR_LCE_OXYGEN; + } + } + + @Override + public void addBarHoverText(List hoverList, int index) { + if (index == 0) { + addFuelText(hoverList); + } else if (index == 1) { + // Lubricant + int lubricantStored = 0; + int lubricantCapacity = 0; + if (isStructureFormed() && getInputFluidInventory() != null) { + // Hunt for tanks with lubricant in them + int[] lubricantAmount = getTotalFluidAmount(Materials.Lubricant.getFluid(Integer.MAX_VALUE), getInputFluidInventory()); + lubricantStored = lubricantAmount[0]; + lubricantCapacity = lubricantAmount[1]; + } + + ITextComponent lubricantInfo = TextComponentUtil.stringWithColor( + TextFormatting.GOLD, + TextFormattingUtil.formatNumbers(lubricantStored) + " / " + TextFormattingUtil.formatNumbers(lubricantCapacity) + " L"); + hoverList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.large_combustion_engine.lubricant_amount", + lubricantInfo)); + } else { + // Oxygen/LOX + if (isBoostAllowed()) { + int oxygenStored = 0; + int oxygenCapacity = 0; + if (isStructureFormed() && getInputFluidInventory() != null) { + // Hunt for tanks with Oxygen or LOX (depending on tier) in them + Material material = isExtreme ? Materials.LiquidOxygen : Materials.Oxygen; + int[] oxygenAmount = getTotalFluidAmount(material.getFluid(Integer.MAX_VALUE), getInputFluidInventory()); + oxygenStored = oxygenAmount[0]; + oxygenCapacity = oxygenAmount[1]; + } + + ITextComponent oxygenInfo = TextComponentUtil.stringWithColor( + TextFormatting.AQUA, + TextFormattingUtil.formatNumbers(oxygenStored) + " / " + TextFormattingUtil.formatNumbers(oxygenCapacity) + " L"); + String key = isExtreme + ? "gregtech.multiblock.large_combustion_engine.liquid_oxygen_amount" + : "gregtech.multiblock.large_combustion_engine.oxygen_amount"; + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, key, oxygenInfo)); + } else { + String key = isExtreme + ? "gregtech.multiblock.large_combustion_engine.liquid_oxygen_boost_disallowed" + : "gregtech.multiblock.large_combustion_engine.oxygen_boost_disallowed"; + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, key)); + } + } + } + private static class LargeCombustionEngineWorkableHandler extends MultiblockFuelRecipeLogic { private boolean isOxygenBoosted = false; diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java index 7290032c0d8..8a3e139e26b 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java @@ -3,17 +3,18 @@ import gregtech.api.GTValues; import gregtech.api.capability.IRotorHolder; import gregtech.api.capability.impl.FluidTankList; +import gregtech.api.capability.impl.MultiblockFuelRecipeLogic; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.resources.TextureArea; import gregtech.api.metatileentity.ITieredMetaTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; -import gregtech.api.metatileentity.multiblock.FuelMultiblockController; -import gregtech.api.metatileentity.multiblock.IMultiblockPart; -import gregtech.api.metatileentity.multiblock.MultiblockAbility; +import gregtech.api.metatileentity.multiblock.*; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.pattern.PatternMatchContext; import gregtech.api.recipes.RecipeMap; -import gregtech.api.util.GTUtility; +import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.ICubeRenderer; import net.minecraft.block.state.IBlockState; @@ -21,10 +22,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -33,7 +33,7 @@ import javax.annotation.Nullable; import java.util.List; -public class MetaTileEntityLargeTurbine extends FuelMultiblockController implements ITieredMetaTileEntity { +public class MetaTileEntityLargeTurbine extends FuelMultiblockController implements ITieredMetaTileEntity, IProgressBarMultiblock { public final int tier; @@ -109,52 +109,60 @@ protected long getMaxVoltage() { @Override protected void addDisplayText(List textList) { - super.addDisplayText(textList); - if (isStructureFormed()) { - IRotorHolder rotorHolder = getRotorHolder(); - - if (rotorHolder.getRotorEfficiency() > 0) { - textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.rotor_speed", TextFormattingUtil.formatNumbers(rotorHolder.getRotorSpeed()), TextFormattingUtil.formatNumbers(rotorHolder.getMaxRotorHolderSpeed()))); - textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.efficiency", rotorHolder.getTotalEfficiency())); - - long maxProduction = ((LargeTurbineWorkableHandler) recipeMapWorkable).getMaxVoltage(); - long currentProduction = isActive() ? ((LargeTurbineWorkableHandler) recipeMapWorkable).boostProduction((int) maxProduction) : 0; - String voltageName = GTValues.VNF[GTUtility.getTierByVoltage(currentProduction)]; - - if (isActive()) { - textList.add(3, new TextComponentTranslation("gregtech.multiblock.turbine.energy_per_tick", TextFormattingUtil.formatNumbers(currentProduction), voltageName)); - } - - int rotorDurability = rotorHolder.getRotorDurabilityPercent(); - if (rotorDurability > MIN_DURABILITY_TO_WARN) { - textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.rotor_durability", rotorDurability)); - } else { - textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.rotor_durability", rotorDurability).setStyle(new Style().setColor(TextFormatting.RED))); - } - } - } + MultiblockFuelRecipeLogic recipeLogic = (MultiblockFuelRecipeLogic) recipeMapWorkable; + + MultiblockDisplayText.builder(textList, isStructureFormed()) + .setWorkingStatus(recipeLogic.isWorkingEnabled(), recipeLogic.isActive()) + .addEnergyProductionLine(getMaxVoltage(), recipeLogic.getRecipeEUt()) + .addCustom(tl -> { + if (isStructureFormed()) { + IRotorHolder rotorHolder = getRotorHolder(); + if (rotorHolder.getRotorEfficiency() > 0) { + ITextComponent efficiencyInfo = TextComponentUtil.stringWithColor( + TextFormatting.AQUA, TextFormattingUtil.formatNumbers(rotorHolder.getTotalEfficiency()) + "%"); + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.turbine.efficiency", + efficiencyInfo)); + } + } + }) + .addFuelNeededLine(recipeLogic.getRecipeFluidInputInfo(), recipeLogic.getPreviousRecipeDuration()) + .addWorkingStatusLine(); } @Override protected void addWarningText(List textList) { - super.addWarningText(textList); - if (isStructureFormed()) { - IRotorHolder rotorHolder = getRotorHolder(); - if (rotorHolder.getRotorEfficiency() > 0) { - if (rotorHolder.getRotorDurabilityPercent() <= MIN_DURABILITY_TO_WARN) { - textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.rotor_durability_low")); - } - } else { - textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.no_rotor")); - } - } + MultiblockDisplayText.builder(textList, isStructureFormed(), false) + .addCustom(tl -> { + if (isStructureFormed()) { + IRotorHolder rotorHolder = getRotorHolder(); + if (rotorHolder.getRotorEfficiency() > 0) { + if (rotorHolder.getRotorDurabilityPercent() <= MIN_DURABILITY_TO_WARN) { + tl.add(TextComponentUtil.translationWithColor( + TextFormatting.YELLOW, + "gregtech.multiblock.turbine.rotor_durability_low")); + } + } + } + }) + .addLowDynamoTierLine(isDynamoTierTooLow()) + .addMaintenanceProblemLines(getMaintenanceProblems()); } @Override protected void addErrorText(List textList) { super.addErrorText(textList); - if (isStructureFormed() && !isRotorFaceFree()) { - textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.obstructed").setStyle(new Style().setColor(TextFormatting.RED))); + if (isStructureFormed()) { + if (!isRotorFaceFree()) { + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.turbine.obstructed")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.turbine.obstructed.desc")); + } + + IRotorHolder rotorHolder = getRotorHolder(); + if (rotorHolder.getRotorEfficiency() <= 0) { + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.turbine.no_rotor")); + } } } @@ -240,4 +248,109 @@ public boolean canVoidRecipeFluidOutputs() { protected boolean shouldShowVoidingModeButton() { return false; } + + @Override + public int getNumProgressBars() { + return 3; + } + + @Override + public double getFillPercentage(int index) { + if (index == 0) { + int[] fuelAmount = new int[2]; + if (getInputFluidInventory() != null) { + MultiblockFuelRecipeLogic recipeLogic = (MultiblockFuelRecipeLogic) recipeMapWorkable; + if (recipeLogic.getInputFluidStack() != null) { + FluidStack testStack = recipeLogic.getInputFluidStack().copy(); + testStack.amount = Integer.MAX_VALUE; + fuelAmount = getTotalFluidAmount(testStack, getInputFluidInventory()); + } + } + return fuelAmount[1] != 0 ? 1.0 * fuelAmount[0] / fuelAmount[1] : 0; + } else if (index == 1) { + IRotorHolder rotorHolder = getRotorHolder(); + return rotorHolder != null ? 1.0 * rotorHolder.getRotorSpeed() / rotorHolder.getMaxRotorHolderSpeed() : 0; + } else { + IRotorHolder rotorHolder = getRotorHolder(); + return rotorHolder != null ? 1.0 * rotorHolder.getRotorDurabilityPercent() / 100 : 0; + } + } + + @Override + public TextureArea getProgressBarTexture(int index) { + if (index == 0) { + return GuiTextures.PROGRESS_BAR_LCE_FUEL; + } else if (index == 1) { + return GuiTextures.PROGRESS_BAR_TURBINE_ROTOR_SPEED; + } else { + return GuiTextures.PROGRESS_BAR_TURBINE_ROTOR_DURABILITY; + } + } + + @Override + public void addBarHoverText(List hoverList, int index) { + if (index == 0) { + // Fuel + addFuelText(hoverList); + } else if (index == 1) { + // Rotor speed + IRotorHolder rotorHolder = getRotorHolder(); + if (rotorHolder == null || rotorHolder.getRotorEfficiency() <= 0) { + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.turbine.no_rotor")); + } else { + int rotorSpeed = rotorHolder.getRotorSpeed(); + int rotorMaxSpeed = rotorHolder.getMaxRotorHolderSpeed(); + ITextComponent rpmTranslated = TextComponentUtil.translationWithColor( + getRotorSpeedColor(rotorSpeed, rotorMaxSpeed), + "gregtech.multiblock.turbine.rotor_rpm_unit_name"); + ITextComponent rotorInfo = TextComponentUtil.translationWithColor( + getRotorSpeedColor(rotorSpeed, rotorMaxSpeed), + "%s / %s %s", + TextFormattingUtil.formatNumbers(rotorSpeed), + TextFormattingUtil.formatNumbers(rotorMaxSpeed), + rpmTranslated); + hoverList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.turbine.rotor_speed", + rotorInfo)); + } + } else { + // Rotor durability + IRotorHolder rotorHolder = getRotorHolder(); + if (rotorHolder == null || rotorHolder.getRotorEfficiency() <= 0) { + // No rotor found + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.turbine.no_rotor")); + } else { + int rotorDurability = rotorHolder.getRotorDurabilityPercent(); + ITextComponent rotorInfo = TextComponentUtil.stringWithColor( + getRotorDurabilityColor(rotorDurability), + rotorDurability + "%"); + hoverList.add(TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.turbine.rotor_durability", + rotorInfo)); + } + } + } + + private TextFormatting getRotorDurabilityColor(int durability) { + if (durability > 40) { + return TextFormatting.GREEN; + } else if (durability > MIN_DURABILITY_TO_WARN) { + return TextFormatting.YELLOW; + } else { + return TextFormatting.RED; + } + } + + private TextFormatting getRotorSpeedColor(int rotorSpeed, int maxRotorSpeed) { + double speedRatio = 1.0 * rotorSpeed / maxRotorSpeed; + if (speedRatio < 0.4) { + return TextFormatting.RED; + } else if (speedRatio < 0.8) { + return TextFormatting.YELLOW; + } else { + return TextFormatting.GREEN; + } + } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java new file mode 100644 index 00000000000..a5aa1133e75 --- /dev/null +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java @@ -0,0 +1,219 @@ +package gregtech.common.metatileentities.multi.multiblockpart; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import gregtech.api.GTValues; +import gregtech.api.capability.impl.FilteredItemHandler; +import gregtech.api.capability.impl.FluidTankList; +import gregtech.api.capability.impl.NotifiableFluidTank; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.ModularUI; +import gregtech.api.gui.widgets.*; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.api.metatileentity.multiblock.IMultiblockAbilityPart; +import gregtech.api.metatileentity.multiblock.MultiblockAbility; +import gregtech.client.renderer.texture.Textures; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.world.World; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidTank; +import net.minecraftforge.fluids.capability.CapabilityFluidHandler; +import net.minecraftforge.items.IItemHandlerModifiable; +import net.minecraftforge.items.ItemStackHandler; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.List; +import java.util.function.Consumer; + +public class MetaTileEntityReservoirHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart { + + private final InfiniteWaterTank fluidTank; + + public MetaTileEntityReservoirHatch(ResourceLocation metaTileEntityId) { + super(metaTileEntityId, GTValues.EV, false); + this.fluidTank = new InfiniteWaterTank(getInventorySize(), this); + initializeInventory(); + } + + @Override + public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { + return new MetaTileEntityReservoirHatch(metaTileEntityId); + } + + @Override + public void update() { + super.update(); + if (!getWorld().isRemote) { + fillContainerFromInternalTank(fluidTank); + fillInternalTankFromFluidContainer(fluidTank); + if (getOffsetTimer() % 20 == 0) { + fluidTank.refillWater(); + } + } + } + + @Override + public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { + super.renderMetaTileEntity(renderState, translation, pipeline); + if (shouldRenderOverlay()) { + Textures.WATER_OVERLAY.renderSided(getFrontFacing(), renderState, translation, pipeline); + } + } + + @Override + public T getCapability(Capability capability, EnumFacing side) { + if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { + // allow both importing and exporting from the tank + return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(fluidTank); + } + return super.getCapability(capability, side); + } + + private int getInventorySize() { + return Integer.MAX_VALUE; + } + + @Override + protected FluidTankList createImportFluidHandler() { + return new FluidTankList(false, fluidTank); + } + + @Override + protected IItemHandlerModifiable createImportItemHandler() { + return new FilteredItemHandler(1).setFillPredicate(FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); + } + + @Override + protected IItemHandlerModifiable createExportItemHandler() { + return new ItemStackHandler(1); + } + + @Override + public MultiblockAbility getAbility() { + return MultiblockAbility.IMPORT_FLUIDS; + } + + @Override + public void registerAbilities(List abilityList) { + abilityList.add(fluidTank); + } + + @Override + protected ModularUI createUI(EntityPlayer entityPlayer) { + return createTankUI(fluidTank, getMetaFullName(), entityPlayer).build(getHolder(), entityPlayer); + } + + public ModularUI.Builder createTankUI(IFluidTank fluidTank, String title, EntityPlayer entityPlayer) { + // Create base builder/widget references + ModularUI.Builder builder = ModularUI.defaultBuilder(); + TankWidget tankWidget; + + // Add input/output-specific widgets + tankWidget = new TankWidget(fluidTank, 69, 52, 18, 18) + .setAlwaysShowFull(true).setDrawHoveringText(false).setContainerClicking(true, true); + + builder.image(7, 16, 81, 55, GuiTextures.DISPLAY) + .widget(new ImageWidget(91, 36, 14, 15, GuiTextures.TANK_ICON)) + .widget(new SlotWidget(exportItems, 0, 90, 53, true, false) + .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.OUT_SLOT_OVERLAY)); + + // Add general widgets + return builder.label(6, 6, title) + .label(11, 20, "gregtech.gui.fluid_amount", 0xFFFFFF) + .widget(new AdvancedTextWidget(11, 30, getFluidAmountText(tankWidget), 0xFFFFFF)) + .widget(new AdvancedTextWidget(11, 40, getFluidNameText(tankWidget), 0xFFFFFF)) + .widget(tankWidget) + .widget(new FluidContainerSlotWidget(importItems, 0, 90, 16, false) + .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.IN_SLOT_OVERLAY)) + .bindPlayerInventory(entityPlayer.inventory); + } + + private Consumer> getFluidNameText(TankWidget tankWidget) { + return (list) -> { + String fluidName = tankWidget.getFluidUnlocalizedName(); + if (!fluidName.isEmpty()) { + list.add(new TextComponentTranslation(fluidName)); + } + }; + } + + private Consumer> getFluidAmountText(TankWidget tankWidget) { + return (list) -> { + String fluidAmount = tankWidget.getFormattedFluidAmount(); + if (!fluidAmount.isEmpty()) { + list.add(new TextComponentString(fluidAmount)); + } + }; + } + + @Override + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", getInventorySize())); + tooltip.add(I18n.format("gregtech.universal.enabled")); + } + + @Override + public void addToolUsages(ItemStack stack, @Nullable World world, List tooltip, boolean advanced) { + tooltip.add(I18n.format("gregtech.tool_action.screwdriver.access_covers")); + super.addToolUsages(stack, world, tooltip, advanced); + } + + private static class InfiniteWaterTank extends NotifiableFluidTank { + private final FluidStack BIG_WATER = new FluidStack(FluidRegistry.WATER, Integer.MAX_VALUE); + + public InfiniteWaterTank(int capacity, MetaTileEntity entityToNotify) { + super(capacity, entityToNotify, false); + } + + private void refillWater() { + if (BIG_WATER.amount != Integer.MAX_VALUE) { + BIG_WATER.amount = Integer.MAX_VALUE; + onContentsChanged(); + } + } + + @Override + public FluidStack drainInternal(int maxDrain, boolean doDrain) { + return new FluidStack(BIG_WATER, maxDrain); + } + + @Nullable + @Override + public FluidStack drainInternal(FluidStack resource, boolean doDrain) { + return new FluidStack(BIG_WATER, resource.amount); + } + + @Override + public int fillInternal(FluidStack resource, boolean doFill) { + return resource.amount; + } + + @Override + public boolean canDrainFluidType(@Nullable FluidStack fluid) { + return fluid != null && fluid.getFluid() == BIG_WATER.getFluid(); + } + + @Override + public boolean canFillFluidType(FluidStack fluid) { + return fluid.getFluid() == BIG_WATER.getFluid(); + } + + @Nullable + @Override + public FluidStack getFluid() { + return BIG_WATER; + } + } +} diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCABridge.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCABridge.java index a9597951024..41112608963 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCABridge.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCABridge.java @@ -1,6 +1,8 @@ package gregtech.common.metatileentities.multi.multiblockpart.hpca; import gregtech.api.GTValues; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.resources.TextureArea; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.client.renderer.texture.Textures; @@ -33,6 +35,11 @@ public SimpleOverlayRenderer getFrontOverlay() { return Textures.HPCA_BRIDGE_OVERLAY; } + @Override + public TextureArea getComponentIcon() { + return GuiTextures.HPCA_ICON_BRIDGE_COMPONENT; + } + @Override public SimpleOverlayRenderer getFrontActiveOverlay() { return Textures.HPCA_BRIDGE_ACTIVE_OVERLAY; diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComputation.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComputation.java index 5edd5969402..c0ad45c0dfb 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComputation.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComputation.java @@ -2,6 +2,8 @@ import gregtech.api.GTValues; import gregtech.api.capability.IHPCAComputationProvider; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.resources.TextureArea; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.client.renderer.texture.Textures; @@ -33,6 +35,14 @@ public SimpleOverlayRenderer getFrontOverlay() { return advanced ? Textures.HPCA_ADVANCED_COMPUTATION_OVERLAY : Textures.HPCA_COMPUTATION_OVERLAY; } + @Override + public TextureArea getComponentIcon() { + if (isDamaged()) { + return advanced ? GuiTextures.HPCA_ICON_DAMAGED_ADVANCED_COMPUTATION_COMPONENT : GuiTextures.HPCA_ICON_DAMAGED_COMPUTATION_COMPONENT; + } + return advanced ? GuiTextures.HPCA_ICON_ADVANCED_COMPUTATION_COMPONENT : GuiTextures.HPCA_ICON_COMPUTATION_COMPONENT; + } + @Override public SimpleOverlayRenderer getFrontActiveOverlay() { if (isDamaged()) return advanced ? Textures.HPCA_ADVANCED_DAMAGED_ACTIVE_OVERLAY : Textures.HPCA_DAMAGED_ACTIVE_OVERLAY; diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCACooler.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCACooler.java index c3890a1e8a5..d96354f50f7 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCACooler.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCACooler.java @@ -2,6 +2,8 @@ import gregtech.api.GTValues; import gregtech.api.capability.IHPCACoolantProvider; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.resources.TextureArea; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.client.renderer.texture.Textures; @@ -32,6 +34,11 @@ public SimpleOverlayRenderer getFrontOverlay() { return advanced ? Textures.HPCA_ACTIVE_COOLER_OVERLAY : Textures.HPCA_HEAT_SINK_OVERLAY; } + @Override + public TextureArea getComponentIcon() { + return advanced ? GuiTextures.HPCA_ICON_ACTIVE_COOLER_COMPONENT : GuiTextures.HPCA_ICON_HEAT_SINK_COMPONENT; + } + @Override public SimpleOverlayRenderer getFrontActiveOverlay() { return advanced ? Textures.HPCA_ACTIVE_COOLER_ACTIVE_OVERLAY : getFrontOverlay(); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAEmpty.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAEmpty.java index 3511aa7f770..c666ccba379 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAEmpty.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAEmpty.java @@ -1,5 +1,7 @@ package gregtech.common.metatileentities.multi.multiblockpart.hpca; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.resources.TextureArea; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.client.renderer.texture.Textures; @@ -27,6 +29,11 @@ public SimpleOverlayRenderer getFrontOverlay() { return Textures.HPCA_EMPTY_OVERLAY; } + @Override + public TextureArea getComponentIcon() { + return GuiTextures.HPCA_ICON_EMPTY_COMPONENT; + } + @Override public int getUpkeepEUt() { return 0; diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java index a38657d1a25..00727b113a5 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java @@ -227,9 +227,19 @@ private void updateCurrentTemperature() { protected abstract int getBaseSteamOutput(); + /** Returns the current total steam output every 10 ticks. */ + public int getTotalSteamOutput() { + if (currentTemperature < 100) return 0; + return (int) (getBaseSteamOutput() * (currentTemperature / (getMaxTemperate() * 1.0)) / 2); + } + + public boolean hasWater() { + return !hasNoWater; + } + private void generateSteam() { if (currentTemperature >= 100) { - int fillAmount = (int) (getBaseSteamOutput() * (currentTemperature / (getMaxTemperate() * 1.0)) / 2); + int fillAmount = getTotalSteamOutput(); boolean hasDrainedWater = waterFluidTank.drain(1, true) != null; int filledSteam = 0; if (hasDrainedWater) { @@ -258,7 +268,9 @@ private void generateSteam() { steamFluidTank.drain(4000, true); } - } else this.hasNoWater = false; + } else { + this.hasNoWater = waterFluidTank.getFluidAmount() == 0; + } } public boolean isBurning() { diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java index 448341d98ed..0364afa6107 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java @@ -1,6 +1,7 @@ package gregtech.common.metatileentities.storage; import codechicken.lib.colour.ColourRGBA; +import codechicken.lib.raytracer.CuboidRayTraceResult; import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; @@ -14,11 +15,15 @@ import gregtech.api.unification.material.Material; import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; +import gregtech.common.items.MetaItems; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -30,11 +35,16 @@ import javax.annotation.Nullable; import java.util.List; +import static gregtech.api.capability.GregtechDataCodes.IS_TAPED; +import static gregtech.api.capability.GregtechDataCodes.TAG_KEY_PAINTING_COLOR; + public class MetaTileEntityCrate extends MetaTileEntity { private final Material material; private final int inventorySize; - private ItemStackHandler inventory; + protected ItemStackHandler inventory; + private boolean isTaped; + private final String TAPED_NBT = "Taped"; public MetaTileEntityCrate(ResourceLocation metaTileEntityId, Material material, int inventorySize) { super(metaTileEntityId); @@ -72,7 +82,9 @@ protected void initializeInventory() { @Override public void clearMachineInventory(NonNullList itemBuffer) { - clearInventory(itemBuffer, inventory); + if(!isTaped) { + clearInventory(itemBuffer, inventory); + } } @Override @@ -97,6 +109,16 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, int baseColor = ColourRGBA.multiply(GTUtility.convertRGBtoOpaqueRGBA_CL(material.getMaterialRGB()), GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); Textures.METAL_CRATE.render(renderState, translation, baseColor, pipeline); } + boolean taped = isTaped; + if (renderContextStack != null && renderContextStack.getTagCompound() != null) { + NBTTagCompound tag = renderContextStack.getTagCompound(); + if (tag.hasKey(TAPED_NBT) && tag.getBoolean(TAPED_NBT)) { + taped = true; + } + } + if (taped) { + Textures.TAPED_OVERLAY.render(renderState, translation, pipeline); + } } @Override @@ -115,10 +137,39 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { return builder.build(getHolder(), entityPlayer); } + @Override + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + ItemStack stack = playerIn.getHeldItem(hand); + if(playerIn.isSneaking() && !isTaped) { + if (stack.isItemEqual(MetaItems.DUCT_TAPE.getStackForm()) || stack.isItemEqual(MetaItems.BASIC_TAPE.getStackForm())) { + if (!playerIn.isCreative()) { + stack.shrink(1); + } + isTaped = true; + if (!getWorld().isRemote) { + writeCustomData(IS_TAPED, buf -> buf.writeBoolean(isTaped)); + markDirty(); + } + return true; + } + } + return super.onRightClick(playerIn, hand, facing, hitResult); + } + + @Override + public int getItemStackLimit(ItemStack stack) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag != null && tag.getBoolean(TAPED_NBT)) { + return 1; + } + return super.getItemStackLimit(stack); + } + @Override public NBTTagCompound writeToNBT(NBTTagCompound data) { super.writeToNBT(data); data.setTag("Inventory", inventory.serializeNBT()); + data.setBoolean(TAPED_NBT, isTaped); return data; } @@ -126,6 +177,52 @@ public NBTTagCompound writeToNBT(NBTTagCompound data) { public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); this.inventory.deserializeNBT(data.getCompoundTag("Inventory")); + if(data.hasKey(TAPED_NBT)) { + this.isTaped = data.getBoolean(TAPED_NBT); + } + } + + @Override + public void initFromItemStackData(NBTTagCompound data) { + super.initFromItemStackData(data); + if (data.hasKey(TAG_KEY_PAINTING_COLOR)) { + this.setPaintingColor(data.getInteger(TAG_KEY_PAINTING_COLOR)); + } + this.isTaped = data.getBoolean(TAPED_NBT); + if(isTaped) { + this.inventory.deserializeNBT(data.getCompoundTag("Inventory")); + } + + data.removeTag(TAPED_NBT); + data.removeTag(TAG_KEY_PAINTING_COLOR); + + this.isTaped = false; + } + + @Override + public void writeItemStackData(NBTTagCompound data) { + super.writeItemStackData(data); + + // Account for painting color when breaking the crate + if (this.isPainted()) { + data.setInteger(TAG_KEY_PAINTING_COLOR, this.getPaintingColor()); + } + // Don't write tape NBT if not taped, to stack with ones from JEI + if(isTaped) { + data.setBoolean(TAPED_NBT, isTaped); + data.setTag("Inventory", inventory.serializeNBT()); + } + } + + @Override + public void receiveCustomData(int dataId, PacketBuffer buf) { + super.receiveCustomData(dataId, buf); + + if(dataId == IS_TAPED) { + this.isTaped = buf.readBoolean(); + scheduleRenderUpdate(); + markDirty(); + } } @Override @@ -136,6 +233,7 @@ protected boolean shouldSerializeInventories() { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", inventorySize)); + tooltip.add(I18n.format("gregtech.crate.tooltip.taped_movement")); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLongDistanceEndpoint.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLongDistanceEndpoint.java index 6f984d9bf02..9ac55d9b934 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLongDistanceEndpoint.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLongDistanceEndpoint.java @@ -17,22 +17,24 @@ import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import java.util.Objects; public abstract class MetaTileEntityLongDistanceEndpoint extends MetaTileEntity implements ILDEndpoint, IDataInfoProvider { private final LongDistancePipeType pipeType; - private Type type = Type.NONE; + private IOType ioType = IOType.NONE; private ILDEndpoint link; private boolean placed = false; public MetaTileEntityLongDistanceEndpoint(ResourceLocation metaTileEntityId, LongDistancePipeType pipeType) { super(metaTileEntityId); - this.pipeType = pipeType; + this.pipeType = Objects.requireNonNull(pipeType); } public void updateNetwork() { @@ -48,13 +50,13 @@ public void updateNetwork() { // no neighbours found, create new network network = this.pipeType.createNetwork(getWorld()); network.onPlaceEndpoint(this); - setType(Type.NONE); + setIoType(IOType.NONE); } else if (networks.size() == 1) { // one neighbour network found, attach self to neighbour network networks.get(0).onPlaceEndpoint(this); } else { // two neighbour networks found, configuration invalid - setType(Type.NONE); + setIoType(IOType.NONE); } } @@ -83,7 +85,7 @@ public void onRemoval() { link.invalidateLink(); invalidateLink(); } - setType(Type.NONE); + setIoType(IOType.NONE); LongDistanceNetwork network = LongDistanceNetwork.get(getWorld(), getPos()); // remove endpoint from network if (network != null) network.onRemoveEndpoint(this); @@ -112,7 +114,7 @@ public void onNeighborChanged() { } } if (networks.size() != 1) { - setType(Type.NONE); + setIoType(IOType.NONE); } } @@ -124,13 +126,13 @@ private List findNetworks() { if (network != null && pipeType == network.getPipeType()) { // found a network on the input face, therefore this is an output of the network networks.add(network); - setType(Type.OUTPUT); + setIoType(IOType.OUTPUT); } network = LongDistanceNetwork.get(getWorld(), getPos().offset(getOutputFacing())); if (network != null && pipeType == network.getPipeType()) { // found a network on the output face, therefore this is an input of the network networks.add(network); - setType(Type.INPUT); + setIoType(IOType.INPUT); } return networks; } @@ -138,24 +140,24 @@ private List findNetworks() { @Override public NBTTagCompound writeToNBT(NBTTagCompound data) { NBTTagCompound nbt = super.writeToNBT(data); - data.setByte("Type", (byte) type.ordinal()); + data.setByte("Type", (byte) ioType.ordinal()); return nbt; } @Override public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); - this.type = Type.values()[data.getByte("Type")]; + this.ioType = IOType.values()[data.getByte("Type")]; } @Override - public Type getType() { - return type; + public @NotNull IOType getIoType() { + return ioType; } @Override - public void setType(Type type) { - this.type = type; + public void setIoType(IOType ioType) { + this.ioType = Objects.requireNonNull(ioType); } @Override @@ -165,6 +167,16 @@ public ILDEndpoint getLink() { if (network != null && network.isValid()) { this.link = network.getOtherEndpoint(this); } + } else if (!this.link.isValid()) { + this.link.invalidateLink(); + this.link = null; + LongDistanceNetwork network = LongDistanceNetwork.get(getWorld(), getPos()); + if (network != null) { + network.invalidateEndpoints(); + if (network.isValid()) { + this.link = network.getOtherEndpoint(this); + } + } } return this.link; } @@ -175,12 +187,12 @@ public void invalidateLink() { } @Override - public EnumFacing getOutputFacing() { + public @NotNull EnumFacing getOutputFacing() { return getFrontFacing().getOpposite(); } @Override - public LongDistancePipeType getPipeType() { + public @NotNull LongDistancePipeType getPipeType() { return pipeType; } diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/LDFluidPipeType.java b/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/LDFluidPipeType.java index ed986b5aa10..05d9b91f407 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/LDFluidPipeType.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/LDFluidPipeType.java @@ -1,10 +1,7 @@ package gregtech.common.pipelike.fluidpipe.longdistance; -import gregtech.api.pipenet.longdist.ILDEndpoint; import gregtech.api.pipenet.longdist.LongDistancePipeType; import gregtech.common.ConfigHolder; -import gregtech.common.blocks.MetaBlocks; -import net.minecraft.block.state.IBlockState; public class LDFluidPipeType extends LongDistancePipeType { @@ -14,16 +11,6 @@ private LDFluidPipeType() { super("fluid"); } - @Override - public boolean isValidBlock(IBlockState blockState) { - return blockState.getBlock() == MetaBlocks.LD_FLUID_PIPE; - } - - @Override - public boolean isValidEndpoint(ILDEndpoint endpoint) { - return endpoint instanceof MetaTileEntityLDFluidEndpoint; - } - @Override public int getMinLength() { return ConfigHolder.machines.ldFluidPipeMinDistance; diff --git a/src/main/java/gregtech/common/pipelike/itempipe/longdistance/LDItemPipeType.java b/src/main/java/gregtech/common/pipelike/itempipe/longdistance/LDItemPipeType.java index e1fe3aec461..4bf089b74c9 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/longdistance/LDItemPipeType.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/longdistance/LDItemPipeType.java @@ -1,10 +1,7 @@ package gregtech.common.pipelike.itempipe.longdistance; -import gregtech.api.pipenet.longdist.ILDEndpoint; import gregtech.api.pipenet.longdist.LongDistancePipeType; import gregtech.common.ConfigHolder; -import gregtech.common.blocks.MetaBlocks; -import net.minecraft.block.state.IBlockState; public class LDItemPipeType extends LongDistancePipeType { @@ -14,16 +11,6 @@ private LDItemPipeType() { super("item"); } - @Override - public boolean isValidBlock(IBlockState blockState) { - return blockState.getBlock() == MetaBlocks.LD_ITEM_PIPE; - } - - @Override - public boolean isValidEndpoint(ILDEndpoint endpoint) { - return endpoint instanceof MetaTileEntityLDItemEndpoint; - } - @Override public int getMinLength() { return ConfigHolder.machines.ldItemPipeMinDistance; diff --git a/src/main/java/gregtech/common/terminal/app/capeselector/CapeSelectorApp.java b/src/main/java/gregtech/common/terminal/app/capeselector/CapeSelectorApp.java index cc53e1ca5f6..1f244022df5 100644 --- a/src/main/java/gregtech/common/terminal/app/capeselector/CapeSelectorApp.java +++ b/src/main/java/gregtech/common/terminal/app/capeselector/CapeSelectorApp.java @@ -25,7 +25,8 @@ public IGuiTexture getIcon() { public AbstractApplication initApp() { this.addWidget(new ImageWidget(5, 5, 333 - 10, 232 - 10, TerminalTheme.COLOR_B_2)); - this.setCapeList(new CapeListWidget(27, 33, 4, 2, this.gui.entityPlayer.getPersistentID())); + this.setCapeList(new CapeListWidget(27, 43, 4, 3, this.gui.entityPlayer.getPersistentID())); + this.getCapeList().setYScrollBarWidth(3).setYBarStyle(null, TerminalTheme.COLOR_F_1); this.addWidget(new SimpleTextWidget(166, 33, "", 0xFFFFFF, () -> { if(this.getCapeList().getCapes() == null || this.getCapeList().getCapes().isEmpty()) { diff --git a/src/main/java/gregtech/common/terminal/app/capeselector/widget/CapeListWidget.java b/src/main/java/gregtech/common/terminal/app/capeselector/widget/CapeListWidget.java index f273d420e4c..56202a76ec7 100644 --- a/src/main/java/gregtech/common/terminal/app/capeselector/widget/CapeListWidget.java +++ b/src/main/java/gregtech/common/terminal/app/capeselector/widget/CapeListWidget.java @@ -8,6 +8,7 @@ import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; import gregtech.api.util.CapesRegistry; +import gregtech.client.utils.RenderUtil; import net.minecraft.network.PacketBuffer; import net.minecraft.util.ResourceLocation; @@ -21,7 +22,7 @@ public class CapeListWidget extends DraggableScrollableWidgetGroup { private int selectedX, selectedY = -1; public CapeListWidget(int xPosition, int yPosition, int width, int height, UUID uuid) { - super(xPosition, yPosition, width * 70 + 42, height * 56 + 12); // Cape banners are 28x44, expanded to 70x56 + super(xPosition, yPosition, width * 70, height * 56); // Cape banners are 28x44, expanded to 70x56 this.uuid = uuid; } @@ -53,9 +54,7 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { private void updateCapeCandidates(List capes) { this.capes = capes; - int xPosition = getSelfPosition().x; - int yPosition = getSelfPosition().y; - int width = (getSize().width - 42) / 70; + int width = (getSize().width) / 70; int rowNumber = 0; if (capes == null || capes.isEmpty()) return; int i = 0; @@ -67,7 +66,7 @@ private void updateCapeCandidates(List capes) { int finalRowPosition = rowPosition; int finalRowNumber = rowNumber; int finalI = i; - ClickButtonWidget capeButton = new ClickButtonWidget(xPosition + rowPosition * 70, yPosition + rowNumber * 56, 28, 44, "", + ClickButtonWidget capeButton = new ClickButtonWidget(rowPosition * 70 + 21, rowNumber * 56, 28, 44, "", (data) -> this.setCape(finalRowPosition, finalRowNumber, capes.get(finalI))).setButtonTexture(capeImage) .setShouldClientCallback(true); row.addWidget(capeButton); @@ -112,10 +111,11 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender return; // Get selected cape button - Widget button = ((WidgetGroup) this.getContainedWidgets(false).get(this.selectedY)) - .getContainedWidgets(false).get(this.selectedX); + Widget button = ((WidgetGroup) this.widgets.get(this.selectedY)).widgets.get(this.selectedX); - drawSelectionOverlay(button.toRectangleBox().x - 6, button.toRectangleBox().y - 6, - button.toRectangleBox().width + 12, button.toRectangleBox().height + 12); // Add a bit of margin + RenderUtil.useScissor(getPosition().x, getPosition().y, getSize().width - yBarWidth, getSize().height - xBarHeight, () -> { + drawSelectionOverlay(button.getPosition().x - 6, button.getPosition().y - 6, + button.getSize().width + 12, button.getSize().height + 12); // Add a bit of margin + }); } } diff --git a/src/main/java/gregtech/core/CoreModule.java b/src/main/java/gregtech/core/CoreModule.java index 657b0bdee9c..8aead1f84f8 100644 --- a/src/main/java/gregtech/core/CoreModule.java +++ b/src/main/java/gregtech/core/CoreModule.java @@ -13,9 +13,7 @@ import gregtech.api.metatileentity.MetaTileEntityUIFactory; import gregtech.api.modules.GregTechModule; import gregtech.api.modules.IGregTechModule; -import gregtech.api.pipenet.longdist.LongDistanceNetwork; import gregtech.api.recipes.ModHandler; -import gregtech.api.pipenet.longdist.LongDistancePipeType; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.recipeproperties.TemperatureProperty; import gregtech.api.unification.OreDictUnifier; @@ -76,7 +74,7 @@ moduleID = GregTechModules.MODULE_CORE, containerID = GTValues.MODID, name = "GregTech Core", - descriptionKey = "gregtech.modules.core.description", + description = "Core GregTech content. Disabling this disables the entire mod and all its addons.", coreModule = true ) public class CoreModule implements IGregTechModule { @@ -178,8 +176,6 @@ public void preInit(FMLPreInitializationEvent event) { proxy.onPreLoad(); KeyBind.init(); - - LongDistancePipeType.init(); } @Override diff --git a/src/main/java/gregtech/integration/IntegrationModule.java b/src/main/java/gregtech/integration/IntegrationModule.java index 16e265a525b..0245d051f57 100644 --- a/src/main/java/gregtech/integration/IntegrationModule.java +++ b/src/main/java/gregtech/integration/IntegrationModule.java @@ -24,7 +24,7 @@ moduleID = GregTechModules.MODULE_INTEGRATION, containerID = GTValues.MODID, name = "GregTech Mod Integration", - descriptionKey = "gregtech.modules.integration.description" + description = "General GregTech Integration Module. Disabling this disables all integration modules." ) public class IntegrationModule extends BaseGregTechModule { diff --git a/src/main/java/gregtech/integration/IntegrationUtil.java b/src/main/java/gregtech/integration/IntegrationUtil.java index 86108d5de0d..ed4a015b218 100644 --- a/src/main/java/gregtech/integration/IntegrationUtil.java +++ b/src/main/java/gregtech/integration/IntegrationUtil.java @@ -2,12 +2,16 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiErrorScreen; +import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.client.CustomModLoadingErrorDisplayException; import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.FMLLaunchHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Arrays; @@ -35,6 +39,24 @@ public static void throwIncompatibility(List messages) { } } + @NotNull + public static ItemStack getModItem(@NotNull String modid, @NotNull String name, int meta) { + return getModItem(modid, name, meta, 1, null); + } + + @NotNull + public static ItemStack getModItem(@NotNull String modid, @NotNull String name, int meta, int amount) { + return getModItem(modid, name, meta, amount, null); + } + + @NotNull + public static ItemStack getModItem(@NotNull String modid, @NotNull String name, int meta, int amount, @Nullable String nbt) { + if (!Loader.isModLoaded(modid)) { + return ItemStack.EMPTY; + } + return GameRegistry.makeItemStack(modid + ":" + name, meta, amount, nbt); + } + @SideOnly(Side.CLIENT) private static void throwClientIncompatibility(List messages) { throw new ModIncompatibilityException(messages); diff --git a/src/main/java/gregtech/integration/baubles/BaublesModule.java b/src/main/java/gregtech/integration/baubles/BaublesModule.java index 34e7b35d871..4d73036565c 100644 --- a/src/main/java/gregtech/integration/baubles/BaublesModule.java +++ b/src/main/java/gregtech/integration/baubles/BaublesModule.java @@ -24,7 +24,7 @@ containerID = GTValues.MODID, modDependencies = GTValues.MODID_BAUBLES, name = "GregTech Baubles Integration", - descriptionKey = "gregtech.modules.baubles_integration.description" + description = "Baubles Integration Module" ) public class BaublesModule extends IntegrationSubmodule { diff --git a/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java b/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java index 699eb30c6e0..3ac8c77ddda 100644 --- a/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java +++ b/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java @@ -27,7 +27,7 @@ containerID = GTValues.MODID, modDependencies = GTValues.MODID_CT, name = "GregTech CraftTweaker Integration", - descriptionKey = "gregtech.modules.ct_integration.description" + description = "CraftTweaker Integration Module" ) public class CraftTweakerModule extends IntegrationSubmodule { diff --git a/src/main/java/gregtech/integration/forestry/ForestryConfig.java b/src/main/java/gregtech/integration/forestry/ForestryConfig.java new file mode 100644 index 00000000000..f148d6aa49d --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/ForestryConfig.java @@ -0,0 +1,50 @@ +package gregtech.integration.forestry; + +import gregtech.api.GTValues; +import net.minecraftforge.common.config.Config; +import net.minecraftforge.common.config.Config.*; + +@LangKey("gregtech.config.forestry") +@Config(modid = GTValues.MODID, name = GTValues.MODID + "/forestry_integration", category = "Forestry") +public class ForestryConfig { + + @Comment({"Enable GregTech Electron Tubes.", "Default: true"}) + @RequiresMcRestart + public static boolean enableGTElectronTubes = true; + + @Comment({"Enable the GregTech Scoop.", "Default: true"}) + @RequiresMcRestart + public static boolean enableGTScoop = true; + + @Comment({ + "Enable GregTech Bees.", + "Requirements: Forestry Apiculture module", + "Recommended: ExtraBees and MagicBees, as some GT bees are only added, and others have more interesting mutations, if those mods are present", + "Default: true" + }) + @RequiresMcRestart + public static boolean enableGTBees = true; + + @Comment({ + "Enable GregTech Apiary Frames.", + "Requirements: Forestry Apiculture module", + "Default: true" + }) + @RequiresMcRestart + public static boolean enableGTFrames = true; + + @Comment({ + "Whether to remove some Forestry Crafting Table recipes (such as Fertilizer, Compost, etc) in favor of GT recipes.", + "Default: false" + }) + @RequiresMcRestart + public static boolean harderForestryRecipes = false; + + @Comment({ + "Whether to disable some bees from other Forestry addons, such as ExtraBees and MagicBees, in favor of GTs.", + "Heavily recommended, as the removed bees have no purpose with GT Bees other than JEI and breed tree clutter.", + "Default: true" + }) + @RequiresMcRestart + public static boolean disableConflictingBees = true; +} diff --git a/src/main/java/gregtech/integration/forestry/ForestryModule.java b/src/main/java/gregtech/integration/forestry/ForestryModule.java new file mode 100644 index 00000000000..d7b1233f091 --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/ForestryModule.java @@ -0,0 +1,343 @@ +package gregtech.integration.forestry; + +import forestry.api.core.ForestryAPI; +import forestry.core.items.IColoredItem; +import gregtech.api.GTValues; +import gregtech.api.items.metaitem.MetaItem; +import gregtech.api.items.metaitem.StandardMetaItem; +import gregtech.api.items.toolitem.IGTTool; +import gregtech.api.items.toolitem.ItemGTTool; +import gregtech.api.modules.GregTechModule; +import gregtech.api.recipes.machines.RecipeMapScanner; +import gregtech.api.unification.material.Material; +import gregtech.api.unification.material.Materials; +import gregtech.api.unification.material.event.MaterialEvent; +import gregtech.api.unification.material.info.MaterialFlags; +import gregtech.api.unification.material.properties.OreProperty; +import gregtech.api.unification.material.properties.PropertyKey; +import gregtech.common.items.ToolItems; +import gregtech.integration.IntegrationModule; +import gregtech.integration.IntegrationSubmodule; +import gregtech.integration.forestry.bees.*; +import gregtech.integration.forestry.frames.GTFrameType; +import gregtech.integration.forestry.frames.GTItemFrame; +import gregtech.integration.forestry.recipes.*; +import gregtech.integration.forestry.tools.ScoopBehavior; +import gregtech.modules.GregTechModules; +import net.minecraft.client.Minecraft; +import net.minecraft.item.Item; +import net.minecraft.item.crafting.IRecipe; +import net.minecraftforge.client.event.ModelRegistryEvent; +import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.registries.IForgeRegistry; +import org.jetbrains.annotations.NotNull; + +import java.util.Collections; +import java.util.List; + +@GregTechModule( + moduleID = GregTechModules.MODULE_FR, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_FR, + name = "GregTech Forestry Integration", + description = "Forestry Integration Module") +public class ForestryModule extends IntegrationSubmodule { + + private static MetaItem forestryMetaItem; + + public static GTItemFrame FRAME_ACCELERATED; + public static GTItemFrame FRAME_MUTAGENIC; + public static GTItemFrame FRAME_WORKING; + public static GTItemFrame FRAME_DECAYING; + public static GTItemFrame FRAME_SLOWING; + public static GTItemFrame FRAME_STABILIZING; + public static GTItemFrame FRAME_ARBORIST; + + public static MetaItem.MetaValueItem ELECTRODE_APATITE; + public static MetaItem.MetaValueItem ELECTRODE_BLAZE; + public static MetaItem.MetaValueItem ELECTRODE_BRONZE; + public static MetaItem.MetaValueItem ELECTRODE_COPPER; + public static MetaItem.MetaValueItem ELECTRODE_DIAMOND; + public static MetaItem.MetaValueItem ELECTRODE_EMERALD; + public static MetaItem.MetaValueItem ELECTRODE_ENDER; + public static MetaItem.MetaValueItem ELECTRODE_GOLD; + public static MetaItem.MetaValueItem ELECTRODE_IRON; + public static MetaItem.MetaValueItem ELECTRODE_LAPIS; + public static MetaItem.MetaValueItem ELECTRODE_OBSIDIAN; + public static MetaItem.MetaValueItem ELECTRODE_ORCHID; + public static MetaItem.MetaValueItem ELECTRODE_RUBBER; + public static MetaItem.MetaValueItem ELECTRODE_TIN; + + public static IGTTool SCOOP; + + public static GTDropItem DROPS; + public static GTCombItem COMBS; + + @NotNull + @Override + public List> getEventBusSubscribers() { + return Collections.singletonList(ForestryModule.class); + } + + @Override + public void preInit(FMLPreInitializationEvent event) { + forestryMetaItem = new StandardMetaItem(); + forestryMetaItem.setRegistryName("forestry_meta_item"); + + // GT Frames + if (ForestryConfig.enableGTFrames) { + if (ForestryUtil.apicultureEnabled()) { + FRAME_ACCELERATED = new GTItemFrame(GTFrameType.ACCELERATED); + FRAME_MUTAGENIC = new GTItemFrame(GTFrameType.MUTAGENIC); + FRAME_WORKING = new GTItemFrame(GTFrameType.WORKING); + FRAME_DECAYING = new GTItemFrame(GTFrameType.DECAYING); + FRAME_SLOWING = new GTItemFrame(GTFrameType.SLOWING); + FRAME_STABILIZING = new GTItemFrame(GTFrameType.STABILIZING); + FRAME_ARBORIST = new GTItemFrame(GTFrameType.ARBORIST); + } else { + getLogger().warn("GregTech Frames are enabled, but Forestry Apiculture module is disabled. Skipping..."); + } + } + + // GT Scoop + if (ForestryConfig.enableGTScoop) { + SCOOP = ToolItems.register(ItemGTTool.Builder.of(GTValues.MODID, "scoop") + .toolStats(b -> b + .cannotAttack().attackSpeed(-2.4F) + .behaviors(ScoopBehavior.INSTANCE)) + .toolClasses("scoop") + .oreDict("toolScoop")); + } + + // GT Bees + if (ForestryConfig.enableGTBees) { + if (ForestryUtil.apicultureEnabled()) { + DROPS = new GTDropItem(); + COMBS = new GTCombItem(); + } else { + getLogger().warn("GregTech Bees are enabled, but Forestry Apiculture module is disabled. Skipping..."); + } + } + + // Remove duplicate/conflicting bees from other Forestry addons. + // Done in init to have our changes applied before their registration, + // since we load after other Forestry addons purposefully. + if (ForestryConfig.disableConflictingBees && ForestryUtil.apicultureEnabled()) { + BeeRemovals.init(); + } + + // Custom scanner logic for scanning Forestry bees, saplings, etc + RecipeMapScanner.registerCustomScannerLogic(new ForestryScannerLogic()); + } + + @Override + public void init(FMLInitializationEvent event) { + // Yes, this recipe stuff has to be done in init. Because Forestry refuses to move their recipes + // to the event, causing removals to need to be done in init instead of registry event. + // See https://github.com/ForestryMC/ForestryMC/issues/2599 + if (ForestryConfig.enableGTElectronTubes) { + ForestryElectrodeRecipes.onInit(); + } + + if (ForestryUtil.apicultureEnabled()) { + if (ForestryConfig.harderForestryRecipes) { + ForestryMiscRecipes.initRemoval(); + } + + if (ForestryConfig.enableGTBees) { + GTAlleleBeeSpecies.setupAlleles(); + GTBeeDefinition.initBees(); + } + } + + if (event.getSide() == Side.CLIENT) { + if (ForestryUtil.apicultureEnabled()) { + if (ForestryConfig.enableGTBees) { + Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> { + if (stack.getItem() instanceof IColoredItem coloredItem) { + return coloredItem.getColorFromItemstack(stack, tintIndex); + } + return 0xFFFFFF; + }, DROPS, COMBS); + } + } + } + } + + @Override + public void postInit(FMLPostInitializationEvent event) { + if (ForestryUtil.apicultureEnabled()) { + getLogger().info("Copying Forestry Centrifuge recipes to GT Centrifuge"); + CombRecipes.initForestryCombs(); + } + } + + @SubscribeEvent + public static void registerItems(RegistryEvent.Register event) { + IForgeRegistry registry = event.getRegistry(); + + // GT Frames + if (ForestryUtil.apicultureEnabled()) { + if (ForestryConfig.enableGTFrames) { + registry.register(FRAME_ACCELERATED); + registry.register(FRAME_MUTAGENIC); + registry.register(FRAME_WORKING); + registry.register(FRAME_DECAYING); + registry.register(FRAME_SLOWING); + registry.register(FRAME_STABILIZING); + registry.register(FRAME_ARBORIST); + } + } + + // GT Electrodes + if (ForestryConfig.enableGTElectronTubes) { + ELECTRODE_APATITE = forestryMetaItem.addItem(1, "electrode.apatite"); + ELECTRODE_BLAZE = forestryMetaItem.addItem(2, "electrode.blaze"); + ELECTRODE_BRONZE = forestryMetaItem.addItem(3, "electrode.bronze"); + ELECTRODE_COPPER = forestryMetaItem.addItem(4, "electrode.copper"); + ELECTRODE_DIAMOND = forestryMetaItem.addItem(5, "electrode.diamond"); + ELECTRODE_EMERALD = forestryMetaItem.addItem(6, "electrode.emerald"); + ELECTRODE_ENDER = forestryMetaItem.addItem(7, "electrode.ender"); + ELECTRODE_GOLD = forestryMetaItem.addItem(8, "electrode.gold"); + ELECTRODE_LAPIS = forestryMetaItem.addItem(9, "electrode.lapis"); + ELECTRODE_OBSIDIAN = forestryMetaItem.addItem(10, "electrode.obsidian"); + ELECTRODE_TIN = forestryMetaItem.addItem(11, "electrode.tin"); + + if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_BINNIE)) { + ELECTRODE_IRON = forestryMetaItem.addItem(12, "electrode.iron"); + } + if (Loader.isModLoaded(GTValues.MODID_XU2)) { + ELECTRODE_ORCHID = forestryMetaItem.addItem(13, "electrode.orchid"); + } + if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_TR) || Loader.isModLoaded(GTValues.MODID_BINNIE)) { + ELECTRODE_RUBBER = forestryMetaItem.addItem(14, "electrode.rubber"); + } + } + + // GT Drops + if (ForestryUtil.apicultureEnabled()) { + if (ForestryConfig.enableGTBees) { + registry.register(DROPS); + registry.register(COMBS); + } + } + } + + @SideOnly(Side.CLIENT) + @SubscribeEvent + public static void registerModels(ModelRegistryEvent event) { + if (ForestryUtil.apicultureEnabled()) { + if (ForestryConfig.enableGTFrames) { + FRAME_ACCELERATED.registerModel(FRAME_ACCELERATED, ForestryAPI.modelManager); + FRAME_MUTAGENIC.registerModel(FRAME_MUTAGENIC, ForestryAPI.modelManager); + FRAME_WORKING.registerModel(FRAME_WORKING, ForestryAPI.modelManager); + FRAME_DECAYING.registerModel(FRAME_DECAYING, ForestryAPI.modelManager); + FRAME_SLOWING.registerModel(FRAME_SLOWING, ForestryAPI.modelManager); + FRAME_STABILIZING.registerModel(FRAME_STABILIZING, ForestryAPI.modelManager); + FRAME_ARBORIST.registerModel(FRAME_ARBORIST, ForestryAPI.modelManager); + } + if (ForestryConfig.enableGTBees) { + DROPS.registerModel(DROPS, ForestryAPI.modelManager); + COMBS.registerModel(COMBS, ForestryAPI.modelManager); + } + } + } + + @SubscribeEvent + public static void registerRecipes(RegistryEvent.Register event) { + if (ForestryUtil.apicultureEnabled()) { + // GT Frames + if (ForestryConfig.enableGTFrames) { + ForestryFrameRecipes.init(); + } + + // GT Combs + if (ForestryConfig.enableGTBees) { + CombRecipes.initGTCombs(); + } + } + + // GT Electrodes + if (ForestryConfig.enableGTElectronTubes) { + ForestryElectrodeRecipes.onRecipeEvent(); + } + + // GT Scoop + if (ForestryConfig.enableGTScoop) { + ForestryToolRecipes.registerHandlers(); + } + + // Random other recipes + ForestryMiscRecipes.init(); + ForestryExtractorRecipes.init(); + } + + @SubscribeEvent + public static void registerMaterials(MaterialEvent event) { + if (ForestryUtil.apicultureEnabled()) { + if (ForestryConfig.enableGTFrames) { + Materials.TreatedWood.addFlags(MaterialFlags.GENERATE_LONG_ROD); + Materials.Uranium235.addFlags(MaterialFlags.GENERATE_LONG_ROD); + Materials.Plutonium241.addFlags(MaterialFlags.GENERATE_LONG_ROD, MaterialFlags.GENERATE_FOIL); + Materials.BlueSteel.addFlags(MaterialFlags.GENERATE_LONG_ROD); + } + if (ForestryConfig.enableGTElectronTubes) { + Materials.Copper.addFlags(MaterialFlags.GENERATE_BOLT_SCREW); + Materials.Emerald.addFlags(MaterialFlags.GENERATE_BOLT_SCREW); + Materials.Lapis.addFlags(MaterialFlags.GENERATE_BOLT_SCREW); + } + if (ForestryConfig.enableGTBees) { + // Blocks for Bee Breeding + Materials.Arsenic.addFlags(MaterialFlags.FORCE_GENERATE_BLOCK); + Materials.Lithium.addFlags(MaterialFlags.FORCE_GENERATE_BLOCK); + Materials.Electrotine.addFlags(MaterialFlags.FORCE_GENERATE_BLOCK); + Materials.Lutetium.addFlags(MaterialFlags.FORCE_GENERATE_BLOCK); + Materials.TricalciumPhosphate.addFlags(MaterialFlags.FORCE_GENERATE_BLOCK); + + // Ores for Comb Processing, does not generate Ore Blocks + createOreProperty(Materials.Chrome, Materials.Iron, Materials.Magnesium); + createOreProperty(Materials.Manganese, Materials.Chrome, Materials.Iron); + createOreProperty(Materials.Magnesium, Materials.Olivine); + createOreProperty(Materials.Silicon, Materials.SiliconDioxide); + createOreProperty(Materials.Tungsten, Materials.Manganese, Materials.Molybdenum); + createOreProperty(Materials.Titanium, Materials.Almandine); + createOreProperty(Materials.Osmium, Materials.Iridium); + createOreProperty(Materials.Iridium, Materials.Platinum, Materials.Osmium); + createOreProperty(Materials.Electrum, Materials.Gold, Materials.Silver); + createOreProperty(Materials.Uranium238, Materials.Lead, Materials.Uranium235, Materials.Thorium); + createOreProperty(Materials.NaquadahEnriched, Materials.Naquadah, Materials.Naquadria); + createOreProperty(Materials.Uranium235); + createOreProperty(Materials.Neutronium); + createOreProperty(Materials.Gallium); + createOreProperty(Materials.Niobium); + createOreProperty(Materials.Rutile); + createOreProperty(Materials.Naquadria); + createOreProperty(Materials.Lutetium); + createOreProperty(Materials.Americium); + createOreProperty(Materials.NetherStar); + createOreProperty(Materials.Trinium); + } + } + } + + private static void createOreProperty(Material material, Material... byproducts) { + if (material.hasProperty(PropertyKey.ORE)) { + IntegrationModule.logger.debug("Material {} already has an ore property, skipping...", material); + return; + } + + OreProperty property = new OreProperty(); + if (byproducts != null && byproducts.length != 0) { + property.setOreByProducts(byproducts); + } + material.setProperty(PropertyKey.ORE, property); + material.addFlags(MaterialFlags.DISABLE_ORE_BLOCK); + } +} diff --git a/src/main/java/gregtech/integration/forestry/ForestryUtil.java b/src/main/java/gregtech/integration/forestry/ForestryUtil.java new file mode 100644 index 00000000000..4ea464f3a9b --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/ForestryUtil.java @@ -0,0 +1,98 @@ +package gregtech.integration.forestry; + +import forestry.api.apiculture.IAlleleBeeEffect; +import forestry.api.apiculture.IAlleleBeeSpecies; +import forestry.api.genetics.AlleleManager; +import forestry.api.genetics.IAlleleFlowers; +import forestry.modules.ModuleHelper; +import gregtech.api.GTValues; +import gregtech.integration.IntegrationModule; +import gregtech.integration.forestry.bees.GTCombType; +import gregtech.integration.forestry.bees.GTDropType; +import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class ForestryUtil { + + public static boolean apicultureEnabled() { + return ModuleHelper.isEnabled("apiculture"); + } + + public static boolean arboricultureEnabled() { + return ModuleHelper.isEnabled("arboriculture"); + } + + public static boolean lepidopterologyEnabled() { + return ModuleHelper.isEnabled("lepidopterology"); + } + + @Nullable + public static IAlleleBeeEffect getEffect(@NotNull String modid, @NotNull String name) { + String s = switch (modid) { + case GTValues.MODID_EB -> "extrabees.effect." + name; + case GTValues.MODID_MB -> "magicbees.effect" + name; + case GTValues.MODID -> "gregtech.effect." + name; + default -> "forestry.effect" + name; + }; + return (IAlleleBeeEffect) AlleleManager.alleleRegistry.getAllele(s); + } + + @Nullable + public static IAlleleFlowers getFlowers(@NotNull String modid, @NotNull String name) { + String s = switch (modid) { + case GTValues.MODID_EB -> "extrabees.flower." + name; + case GTValues.MODID_MB -> "magicbees.flower" + name; + case GTValues.MODID -> "gregtech.flower." + name; + default -> "forestry.flowers" + name; + }; + return (IAlleleFlowers) AlleleManager.alleleRegistry.getAllele(s); + } + + @Nullable + public static IAlleleBeeSpecies getSpecies(@NotNull String modid, @NotNull String name) { + String s = switch (modid) { + case GTValues.MODID_EB -> "extrabees.species." + name; + case GTValues.MODID_MB -> "magicbees.species" + name; + case GTValues.MODID -> "gregtech.species." + name; + default -> "forestry.species" + name; + }; + return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele(s); + } + + @NotNull + public static ItemStack getCombStack(@NotNull GTCombType type) { + return getCombStack(type, 1); + } + + @NotNull + public static ItemStack getCombStack(@NotNull GTCombType type, int amount) { + if (!ForestryConfig.enableGTBees) { + IntegrationModule.logger.error("Tried to get GregTech Comb stack, but GregTech Bees config is not enabled!"); + return ItemStack.EMPTY; + } + if (!apicultureEnabled()) { + IntegrationModule.logger.error("Tried to get GregTech Comb stack, but Apiculture module is not enabled!"); + return ItemStack.EMPTY; + } + return new ItemStack(ForestryModule.COMBS, amount, type.ordinal()); + } + + @NotNull + public static ItemStack getDropStack(@NotNull GTDropType type) { + return getDropStack(type, 1); + } + + @NotNull + public static ItemStack getDropStack(@NotNull GTDropType type, int amount) { + if (!ForestryConfig.enableGTBees) { + IntegrationModule.logger.error("Tried to get GregTech Drop stack, but GregTech Bees config is not enabled!"); + return ItemStack.EMPTY; + } + if (!apicultureEnabled()) { + IntegrationModule.logger.error("Tried to get GregTech Drop stack, but Apiculture module is not enabled!"); + return ItemStack.EMPTY; + } + return new ItemStack(ForestryModule.DROPS, amount, type.ordinal()); + } +} diff --git a/src/main/java/gregtech/integration/forestry/bees/BeeRemovals.java b/src/main/java/gregtech/integration/forestry/bees/BeeRemovals.java new file mode 100644 index 00000000000..9bc4fca61f7 --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/bees/BeeRemovals.java @@ -0,0 +1,129 @@ +package gregtech.integration.forestry.bees; + +import gregtech.api.GTValues; +import gregtech.integration.IntegrationModule; +import net.minecraftforge.fml.common.Loader; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.List; + +public class BeeRemovals { + + private static final List MB_REMOVALS = new ArrayList<>(); + private static final List EB_REMOVALS = new ArrayList<>(); + + public static void init() { + if (Loader.isModLoaded(GTValues.MODID_MB)) { + removeMagicBees(); + } + if (Loader.isModLoaded(GTValues.MODID_EB)) { + removeExtraBees(); + } + } + + // No breed tree issues with these removals + private static void removeMagicBees() { + MB_REMOVALS.add("FLUIX"); + MB_REMOVALS.add("CERTUS"); + MB_REMOVALS.add("SILICON"); + MB_REMOVALS.add("APATITE"); + MB_REMOVALS.add("EMERALD"); + MB_REMOVALS.add("DIAMOND"); + MB_REMOVALS.add("BRONZE"); + MB_REMOVALS.add("INVAR"); + MB_REMOVALS.add("NICKEL"); + MB_REMOVALS.add("PLATINUM"); + MB_REMOVALS.add("ELECTRUM"); + MB_REMOVALS.add("OSMIUM"); + MB_REMOVALS.add("ALUMINIUM"); + MB_REMOVALS.add("LEAD"); + MB_REMOVALS.add("SILVER"); + MB_REMOVALS.add("TIN"); + MB_REMOVALS.add("COPPER"); + MB_REMOVALS.add("GOLD"); + MB_REMOVALS.add("IRON"); + + try { + Class mbBeeDefinition = Class.forName("magicbees.bees.EnumBeeSpecies"); + Field enabledField = mbBeeDefinition.getDeclaredField("enabledOverride"); + enabledField.setAccessible(true); + + for (var o : mbBeeDefinition.getEnumConstants()) { + if (o instanceof Enum bee) { + String name = bee.name(); + if (MB_REMOVALS.contains(name)) { + try { + enabledField.set(bee, false); + } catch (IllegalAccessException e) { + IntegrationModule.logger.error("Failed to disable bee {}! Skipping...", name); + } + } + } + } + + } catch (ClassNotFoundException e) { + IntegrationModule.logger.error("Could not find MagicBees EnumBeeSpecies! Skipping..."); + } catch (NoSuchFieldException e) { + IntegrationModule.logger.error("Could not find MagicBees \"enabledOverride\" field! Skipping..."); + } + } + + private static void removeExtraBees() { + EB_REMOVALS.add("COPPER"); + EB_REMOVALS.add("TIN"); + EB_REMOVALS.add("IRON"); + EB_REMOVALS.add("LEAD"); + EB_REMOVALS.add("ZINC"); + EB_REMOVALS.add("TITANIUM"); + EB_REMOVALS.add("TUNGSTATE"); + EB_REMOVALS.add("NICKEL"); + EB_REMOVALS.add("GOLD"); + EB_REMOVALS.add("SILVER"); + EB_REMOVALS.add("PLATINUM"); + EB_REMOVALS.add("LAPIS"); + EB_REMOVALS.add("SODALITE"); + EB_REMOVALS.add("PYRITE"); + EB_REMOVALS.add("BAUXITE"); + EB_REMOVALS.add("CINNABAR"); + EB_REMOVALS.add("SPHALERITE"); + EB_REMOVALS.add("EMERALD"); + EB_REMOVALS.add("RUBY"); + EB_REMOVALS.add("SAPPHIRE"); + EB_REMOVALS.add("DIAMOND"); + EB_REMOVALS.add("NUCLEAR"); + EB_REMOVALS.add("RADIOACTIVE"); + EB_REMOVALS.add("YELLORIUM"); + EB_REMOVALS.add("CYANITE"); + EB_REMOVALS.add("BLUTONIUM"); + + try { + Class ebBeeDefinition = Class.forName("binnie.extrabees.genetics.ExtraBeeDefinition"); + Field branchField = ebBeeDefinition.getDeclaredField("branch"); + Field speciesBuilderField = ebBeeDefinition.getDeclaredField("speciesBuilder"); + branchField.setAccessible(true); + speciesBuilderField.setAccessible(true); + Field modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(branchField, branchField.getModifiers() & ~Modifier.FINAL); + modifiersField.setInt(speciesBuilderField, speciesBuilderField.getModifiers() & ~Modifier.FINAL); + + for (var o : ebBeeDefinition.getEnumConstants()) { + if (o instanceof Enum bee) { + String name = bee.name(); + if (EB_REMOVALS.contains(name)) { + branchField.set(bee, null); + speciesBuilderField.set(bee, null); + } + } + } + } catch (ClassNotFoundException e) { + IntegrationModule.logger.error("Could not find ExtraBees ExtraBeeDefinition! Skipping..."); + } catch (NoSuchFieldException e) { + IntegrationModule.logger.error("Could not find ExtraBees \"branch\" field! Skipping..."); + } catch (IllegalAccessException e) { + IntegrationModule.logger.error("Could not properly set ExtraBees \"branch\" field! Skipping..."); + } + } +} diff --git a/src/main/java/gregtech/integration/forestry/bees/ForestryScannerLogic.java b/src/main/java/gregtech/integration/forestry/bees/ForestryScannerLogic.java new file mode 100644 index 00000000000..d9719821d2d --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/bees/ForestryScannerLogic.java @@ -0,0 +1,148 @@ +package gregtech.integration.forestry.bees; + +import forestry.api.genetics.AlleleManager; +import forestry.api.genetics.IIndividual; +import forestry.apiculture.ModuleApiculture; +import forestry.apiculture.genetics.BeeDefinition; +import forestry.arboriculture.ModuleArboriculture; +import forestry.arboriculture.genetics.TreeDefinition; +import forestry.core.fluids.Fluids; +import forestry.lepidopterology.ModuleLepidopterology; +import forestry.lepidopterology.genetics.ButterflyDefinition; +import gregtech.api.recipes.Recipe; +import gregtech.api.recipes.RecipeMaps; +import gregtech.api.recipes.machines.IScannerRecipeMap; +import gregtech.integration.forestry.ForestryUtil; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; + +public class ForestryScannerLogic implements IScannerRecipeMap.ICustomScannerLogic { + + private static final int EUT = 2; + private static final int DURATION = 500; + private static final int HONEY_AMOUNT = 100; + + @Override + public Recipe createCustomRecipe(long voltage, List inputs, List fluidInputs, boolean exactVoltage) { + FluidStack fluidStack = fluidInputs.get(0); + if (fluidStack != null && fluidStack.containsFluid(Fluids.FOR_HONEY.getFluid(HONEY_AMOUNT))) { + for (ItemStack stack : inputs) { + if (stack != ItemStack.EMPTY) { + IIndividual individual = AlleleManager.alleleRegistry.getIndividual(stack); + if (individual != null && individual.analyze()) { + NBTTagCompound outputNBT = new NBTTagCompound(); + individual.writeToNBT(outputNBT); + ItemStack outputStack = stack.copy(); + outputStack.setTagCompound(outputNBT); + return RecipeMaps.SCANNER_RECIPES.recipeBuilder() + .inputs(stack) + .fluidInputs(Fluids.FOR_HONEY.getFluid(HONEY_AMOUNT)) + .outputs(outputStack) + .duration(DURATION).EUt(EUT).build().getResult(); + } + } + } + } + return null; + } + + @Nullable + @Override + public List getRepresentativeRecipes() { + List recipes = new ArrayList<>(); + ItemStack outputStack; + + if (ForestryUtil.apicultureEnabled()) { + outputStack = ModuleApiculture.getItems().beeDroneGE.getItemStack(); + outputStack.setTagCompound(BeeDefinition.COMMON.getIndividual().writeToNBT(new NBTTagCompound())); + outputStack.setTranslatableName("gregtech.scanner.forestry.drone"); + recipes.add(RecipeMaps.SCANNER_RECIPES.recipeBuilder() + .inputs(ModuleApiculture.getItems().beeDroneGE.getWildcard()) + .fluidInputs(Fluids.FOR_HONEY.getFluid(HONEY_AMOUNT)) + .outputs(outputStack) + .duration(DURATION).EUt(EUT).build().getResult()); + + outputStack = ModuleApiculture.getItems().beePrincessGE.getItemStack(); + outputStack.setTagCompound(BeeDefinition.COMMON.getIndividual().writeToNBT(new NBTTagCompound())); + outputStack.setTranslatableName("gregtech.scanner.forestry.princess"); + recipes.add(RecipeMaps.SCANNER_RECIPES.recipeBuilder() + .inputs(ModuleApiculture.getItems().beePrincessGE.getWildcard()) + .fluidInputs(Fluids.FOR_HONEY.getFluid(HONEY_AMOUNT)) + .outputs(outputStack) + .duration(DURATION).EUt(EUT).build().getResult()); + + outputStack = ModuleApiculture.getItems().beeQueenGE.getItemStack(); + outputStack.setTagCompound(BeeDefinition.COMMON.getIndividual().writeToNBT(new NBTTagCompound())); + outputStack.setTranslatableName("gregtech.scanner.forestry.queen"); + recipes.add(RecipeMaps.SCANNER_RECIPES.recipeBuilder() + .inputs(ModuleApiculture.getItems().beeQueenGE.getWildcard()) + .fluidInputs(Fluids.FOR_HONEY.getFluid(HONEY_AMOUNT)) + .outputs(outputStack) + .duration(DURATION).EUt(EUT).build().getResult()); + + outputStack = ModuleApiculture.getItems().beeLarvaeGE.getItemStack(); + outputStack.setTagCompound(BeeDefinition.COMMON.getIndividual().writeToNBT(new NBTTagCompound())); + outputStack.setTranslatableName("gregtech.scanner.forestry.larvae"); + recipes.add(RecipeMaps.SCANNER_RECIPES.recipeBuilder() + .inputs(ModuleApiculture.getItems().beeLarvaeGE.getWildcard()) + .fluidInputs(Fluids.FOR_HONEY.getFluid(HONEY_AMOUNT)) + .outputs(outputStack) + .duration(DURATION).EUt(EUT).build().getResult()); + } + + if (ForestryUtil.arboricultureEnabled()) { + outputStack = ModuleArboriculture.getItems().sapling.getItemStack(); + outputStack.setTagCompound(TreeDefinition.Oak.getIndividual().writeToNBT(new NBTTagCompound())); + outputStack.setTranslatableName("gregtech.scanner.forestry.sapling"); + recipes.add(RecipeMaps.SCANNER_RECIPES.recipeBuilder() + .inputs(ModuleArboriculture.getItems().sapling.getWildcard()) + .fluidInputs(Fluids.FOR_HONEY.getFluid(HONEY_AMOUNT)) + .outputs(outputStack) + .duration(DURATION).EUt(EUT).build().getResult()); + + outputStack = ModuleArboriculture.getItems().pollenFertile.getItemStack(); + outputStack.setTagCompound(TreeDefinition.Oak.getIndividual().writeToNBT(new NBTTagCompound())); + outputStack.setTranslatableName("gregtech.scanner.forestry.pollen"); + recipes.add(RecipeMaps.SCANNER_RECIPES.recipeBuilder() + .inputs(ModuleArboriculture.getItems().pollenFertile.getWildcard()) + .fluidInputs(Fluids.FOR_HONEY.getFluid(HONEY_AMOUNT)) + .outputs(outputStack) + .duration(DURATION).EUt(EUT).build().getResult()); + } + + if (ForestryUtil.lepidopterologyEnabled()) { + outputStack = ModuleLepidopterology.getItems().butterflyGE.getItemStack(); + outputStack.setTagCompound(ButterflyDefinition.CabbageWhite.getIndividual().writeToNBT(new NBTTagCompound())); + outputStack.setTranslatableName("gregtech.scanner.forestry.butterfly"); + recipes.add(RecipeMaps.SCANNER_RECIPES.recipeBuilder() + .inputs(ModuleLepidopterology.getItems().butterflyGE.getWildcard()) + .fluidInputs(Fluids.FOR_HONEY.getFluid(HONEY_AMOUNT)) + .outputs(outputStack) + .duration(DURATION).EUt(EUT).build().getResult()); + + outputStack = ModuleLepidopterology.getItems().serumGE.getItemStack(); + outputStack.setTagCompound(ButterflyDefinition.CabbageWhite.getIndividual().writeToNBT(new NBTTagCompound())); + outputStack.setTranslatableName("gregtech.scanner.forestry.serum"); + recipes.add(RecipeMaps.SCANNER_RECIPES.recipeBuilder() + .inputs(ModuleLepidopterology.getItems().serumGE.getWildcard()) + .fluidInputs(Fluids.FOR_HONEY.getFluid(HONEY_AMOUNT)) + .outputs(outputStack) + .duration(DURATION).EUt(EUT).build().getResult()); + + outputStack = ModuleLepidopterology.getItems().caterpillarGE.getItemStack(); + outputStack.setTagCompound(ButterflyDefinition.CabbageWhite.getIndividual().writeToNBT(new NBTTagCompound())); + outputStack.setTranslatableName("gregtech.scanner.forestry.caterpillar"); + recipes.add(RecipeMaps.SCANNER_RECIPES.recipeBuilder() + .inputs(ModuleLepidopterology.getItems().caterpillarGE.getWildcard()) + .fluidInputs(Fluids.FOR_HONEY.getFluid(HONEY_AMOUNT)) + .outputs(outputStack) + .duration(DURATION).EUt(EUT).build().getResult()); + } + return recipes; + } +} diff --git a/src/main/java/gregtech/integration/forestry/bees/GTAlleleBeeSpecies.java b/src/main/java/gregtech/integration/forestry/bees/GTAlleleBeeSpecies.java new file mode 100644 index 00000000000..32824fd7242 --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/bees/GTAlleleBeeSpecies.java @@ -0,0 +1,63 @@ +package gregtech.integration.forestry.bees; + +import forestry.api.apiculture.EnumBeeChromosome; +import forestry.api.apiculture.IAlleleBeeSpeciesBuilder; +import forestry.api.genetics.AlleleManager; +import forestry.api.genetics.IAlleleFloat; +import forestry.api.genetics.IClassification; +import forestry.apiculture.genetics.alleles.AlleleBeeSpecies; +import forestry.core.genetics.alleles.AlleleFloat; +import gregtech.api.GTValues; +import gregtech.integration.IntegrationModule; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.NotNull; + +public class GTAlleleBeeSpecies extends AlleleBeeSpecies { + + public static IAlleleFloat speedBlinding; + + public GTAlleleBeeSpecies(String modId, String uid, String unlocalizedName, String authority, + String unlocalizedDescription, boolean dominant, IClassification branch, + String binomial, int primaryColor, int secondaryColor) { + super(modId, uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, primaryColor, secondaryColor); + AlleleManager.alleleRegistry.registerAllele(this, EnumBeeChromosome.SPECIES); + } + + @NotNull + @Override + public IAlleleBeeSpeciesBuilder addProduct(@NotNull ItemStack product, @NotNull Float chance) { + if (product == ItemStack.EMPTY) { + IntegrationModule.logger.warn("GTAlleleBeeSpecies#addProduct() passed an empty ItemStack for allele {}! Setting default", getUID()); + product = new ItemStack(Items.BOAT); + } + if (chance <= 0.0f || chance > 1.0f) { + IntegrationModule.logger.warn("GTAlleleBeeSpecies#addProduct() passed a chance value out of bounds for allele {}! Setting to 0.1", getUID()); + chance = 0.1f; + } + return super.addProduct(product, chance); + } + + @NotNull + @Override + public IAlleleBeeSpeciesBuilder addSpecialty(@NotNull ItemStack specialty, @NotNull Float chance) { + if (specialty == ItemStack.EMPTY) { + IntegrationModule.logger.warn("GTAlleleBeeSpecies#addProduct() passed an empty ItemStack for allele {}! Setting default", getUID()); + specialty = new ItemStack(Items.BOAT); + } + if (chance <= 0.0f || chance > 1.0f) { + IntegrationModule.logger.warn("GTAlleleBeeSpecies#addSpecialty() passed a chance value out of bounds for allele {}! Setting to 0.1", getUID()); + chance = 0.1f; + } + return super.addSpecialty(specialty, chance); + } + + public static void setupAlleles() { + IAlleleFloat allele = (IAlleleFloat) AlleleManager.alleleRegistry.getAllele("magicbees.speedBlinding"); + if (allele == null) { + allele = new AlleleFloat(GTValues.MODID, "gregtech.speedBlinding", "gregtech.speedBlinding", 2f, false); + AlleleManager.alleleRegistry.registerAllele(allele, EnumBeeChromosome.SPEED); + } + speedBlinding = allele; + } +} diff --git a/src/main/java/gregtech/integration/forestry/bees/GTBeeDefinition.java b/src/main/java/gregtech/integration/forestry/bees/GTBeeDefinition.java new file mode 100644 index 00000000000..08a962fc646 --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/bees/GTBeeDefinition.java @@ -0,0 +1,1367 @@ +package gregtech.integration.forestry.bees; + +import appeng.core.Api; +import forestry.api.apiculture.*; +import forestry.api.core.EnumHumidity; +import forestry.api.core.EnumTemperature; +import forestry.api.genetics.IAllele; +import forestry.api.genetics.IMutationBuilder; +import forestry.apiculture.ModuleApiculture; +import forestry.apiculture.genetics.Bee; +import forestry.apiculture.genetics.BeeDefinition; +import forestry.apiculture.genetics.IBeeDefinition; +import forestry.apiculture.genetics.alleles.AlleleEffects; +import forestry.apiculture.items.EnumHoneyComb; +import forestry.core.ModuleCore; +import forestry.core.genetics.alleles.AlleleHelper; +import forestry.core.genetics.alleles.EnumAllele; +import gregtech.api.GTValues; +import gregtech.api.unification.OreDictUnifier; +import gregtech.api.unification.material.Materials; +import gregtech.api.unification.ore.OrePrefix; +import gregtech.api.unification.stack.UnificationEntry; +import gregtech.common.items.MetaItems; +import gregtech.integration.IntegrationUtil; +import gregtech.integration.forestry.ForestryModule; +import gregtech.integration.forestry.ForestryUtil; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.BiomeDictionary; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.Optional; +import org.apache.commons.lang3.text.WordUtils; +import org.jetbrains.annotations.NotNull; + +import java.util.Arrays; +import java.util.Locale; +import java.util.function.Consumer; +import java.util.function.Supplier; + +import static forestry.api.apiculture.EnumBeeChromosome.*; + +public enum GTBeeDefinition implements IBeeDefinition { + + // Organic + CLAY(GTBranchDefinition.GT_ORGANIC, "Lutum", true, 0xC8C8DA, 0x0000FF, + beeSpecies -> { + if (Loader.isModLoaded(GTValues.MODID_EB)) { + beeSpecies.addProduct(getExtraBeesComb(22), 0.30f); // CLAY + } else { + beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.30f); + } + beeSpecies.addProduct(new ItemStack(Items.CLAY_BALL), 0.15f); + beeSpecies.setHumidity(EnumHumidity.DAMP); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + if (Loader.isModLoaded(GTValues.MODID_BOP)) { + beeSpecies.addSpecialty(IntegrationUtil.getModItem(GTValues.MODID_BOP, "mudball", 0), 0.05f); + } + }, + template -> { + AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.SLOWER); + AlleleHelper.getInstance().set(template, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.VANILLA); + }, + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.INDUSTRIOUS, BeeDefinition.DILIGENT, 10); + mutation.requireResource(Blocks.HARDENED_CLAY.getDefaultState()); + } + ), + SLIMEBALL(GTBranchDefinition.GT_ORGANIC, "Bituminipila", true, 0x4E9E55, 0x00FF15, + beeSpecies -> { + beeSpecies.addProduct(getForestryComb(EnumHoneyComb.MOSSY), 0.30f); + beeSpecies.addProduct(new ItemStack(Items.SLIME_BALL), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.STICKY), 0.05f); + beeSpecies.setHumidity(EnumHumidity.DAMP); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + if (Loader.isModLoaded(GTValues.MODID_TCON)) { + beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_TCON, "edible", 1), 0.10f); + beeSpecies.addSpecialty(IntegrationUtil.getModItem(GTValues.MODID_TCON, "slime_congealed", 2), 0.01f); + } else { + beeSpecies.addSpecialty(new ItemStack(Blocks.SLIME_BLOCK), 0.01f); + } + }, + template -> { + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.MUSHROOMS); + AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.SLOWER); + AlleleHelper.getInstance().set(template, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1); + AlleleHelper.getInstance().set(template, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1); + if (Loader.isModLoaded(GTValues.MODID_EB)) { + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, ForestryUtil.getFlowers(GTValues.MODID_EB, "water")); + } + }, + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.MARSHY, CLAY, 7); + mutation.requireResource(Blocks.SLIME_BLOCK.getDefaultState()); + } + ), + PEAT(GTBranchDefinition.GT_ORGANIC, "Limus", true, 0x906237, 0x58300B, + beeSpecies -> { + beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.15f); + beeSpecies.addProduct(getGTComb(GTCombType.COAL), 0.15f); + beeSpecies.addSpecialty(ModuleCore.getItems().peat.getItemStack(), 0.30f); + beeSpecies.addSpecialty(ModuleCore.getItems().mulch.getItemStack(), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTER); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT); + AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.FASTER); + AlleleHelper.getInstance().set(template, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE); + }, + dis -> dis.registerMutation(BeeDefinition.RURAL, CLAY, 10) + ), + STICKYRESIN(GTBranchDefinition.GT_ORGANIC, "Lenturesinae", true, 0x2E8F5B, 0xDCC289, + beeSpecies -> { + beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.STICKY), 0.15f); + beeSpecies.addSpecialty(MetaItems.STICKY_RESIN.getStackForm(), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> { + AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.SLOWER); + AlleleHelper.getInstance().set(template, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE); + }, + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(SLIMEBALL, PEAT, 15); + mutation.requireResource("logRubber"); + } + ), + COAL(GTBranchDefinition.GT_ORGANIC, "Carbo", true, 0x666666, 0x525252, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.COAL), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.COKE), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> { + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.CACTI); + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWEST); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.LONGER); + AlleleHelper.getInstance().set(template, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_2); + AlleleHelper.getInstance().set(template, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.DOWN_1); + AlleleHelper.getInstance().set(template, NEVER_SLEEPS, true); + AlleleHelper.getInstance().set(template, EFFECT, AlleleEffects.effectCreeper); + }, + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.INDUSTRIOUS, PEAT, 9); + mutation.requireResource("blockCoal"); + } + ), + OIL(GTBranchDefinition.GT_ORGANIC, "Oleum", true, 0x4C4C4C, 0x333333, + beeSpecies -> { + beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.OIL), 0.75f); + beeSpecies.setHumidity(EnumHumidity.DAMP); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + beeSpecies.setHasEffect(); + }, + template -> { + AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.SLOWER); + AlleleHelper.getInstance().set(template, NEVER_SLEEPS, true); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.NORMAL); + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER); + AlleleHelper.getInstance().set(template, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE); + AlleleHelper.getInstance().set(template, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE); + if (Loader.isModLoaded(GTValues.MODID_EB)) { + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, ForestryUtil.getFlowers(GTValues.MODID_EB, "water")); + } + }, + dis -> dis.registerMutation(COAL, STICKYRESIN, 4) + ), + ASH(GTBranchDefinition.GT_ORGANIC, "Cinis", true, 0x1E1A18, 0xC6C6C6, + beeSpecies -> { + if (Loader.isModLoaded(GTValues.MODID_EB)) { + beeSpecies.addProduct(getExtraBeesComb(9), 0.30f); // SEED + } else { + beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.30f); + } + beeSpecies.addSpecialty(getGTComb(GTCombType.ASH), 0.15f); + beeSpecies.setHumidity(EnumHumidity.ARID); + beeSpecies.setTemperature(EnumTemperature.HOT); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.NORMAL); + AlleleHelper.getInstance().set(template, TERRITORY, EnumAllele.Territory.LARGE); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTER); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT); + AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.FASTER); + }, + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(COAL, CLAY, 10); + mutation.restrictTemperature(EnumTemperature.HELLISH); + } + ), + APATITE(GTBranchDefinition.GT_ORGANIC, "Stercorat", true, 0x7FCEF5, 0x654525, + beeSpecies -> { + if (Loader.isModLoaded(GTValues.MODID_EB)) { + beeSpecies.addProduct(getExtraBeesComb(9), 0.15f); // SEED + } else { + beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.15f); + } + beeSpecies.addSpecialty(getGTComb(GTCombType.APATITE), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.WARM); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.FASTEST); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.LONGER); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT); + AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.FASTER); + if (Loader.isModLoaded(GTValues.MODID_EB)) { + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, ForestryUtil.getFlowers(GTValues.MODID_EB, "rock")); + } + }, + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(ASH, COAL, 10); + mutation.requireResource("blockApatite"); + } + ), + BIOMASS(GTBranchDefinition.GT_ORGANIC, "Taeda", true, 0x21E118, 0x17AF0E, + beeSpecies -> { + beeSpecies.addProduct(getForestryComb(EnumHoneyComb.MOSSY), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.BIOMASS), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.FASTEST); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.LONGEST); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT); + AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.FASTER); + }, + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.INDUSTRIOUS, BeeDefinition.RURAL, 10); + mutation.restrictBiomeType(BiomeDictionary.Type.FOREST); + } + ), + FERTILIZER(GTBranchDefinition.GT_ORGANIC, "Stercorat", true, 0x7FCEF5, 0x654525, + beeSpecies -> { + if (Loader.isModLoaded(GTValues.MODID_EB)) { + beeSpecies.addProduct(getExtraBeesComb(9), 0.15f); // SEED + } else { + beeSpecies.addProduct(getForestryComb(EnumHoneyComb.MOSSY), 0.15f); + } + beeSpecies.addSpecialty(OreDictUnifier.get(OrePrefix.dustTiny, Materials.Ash), 0.2f); + beeSpecies.addSpecialty(OreDictUnifier.get(OrePrefix.dustTiny, Materials.DarkAsh), 0.2f); + beeSpecies.addSpecialty(MetaItems.FERTILIZER.getStackForm(), 0.3f); + beeSpecies.addSpecialty(IntegrationUtil.getModItem(GTValues.MODID_FR, "fertilizer_compound", 0), 0.3f); + beeSpecies.setHumidity(EnumHumidity.DAMP); + beeSpecies.setTemperature(EnumTemperature.WARM); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.FASTEST); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.LONGER); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT); + AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.FASTER); + }, + dis -> dis.registerMutation(ASH, APATITE, 8) + ), + PHOSPHORUS(GTBranchDefinition.GT_ORGANIC, "Phosphorus", false, 0xFFC826, 0xC1C1F6, + beeSpecies -> { + beeSpecies.addSpecialty(getGTComb(GTCombType.PHOSPHORUS), 0.35f); + beeSpecies.setTemperature(EnumTemperature.HOT); + beeSpecies.setNocturnal(); + beeSpecies.setHasEffect(); + }, + template -> AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTEST), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(APATITE, ASH, 12); + mutation.restrictTemperature(EnumTemperature.HOT); + mutation.requireResource("blockTricalciumPhosphate"); + } + ), + SANDWICH(GTBranchDefinition.GT_ORGANIC, "Sandwico", true, 0x32CD32, 0xDAA520, + beeSpecies -> { + beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 81), 0.05f); // Cucumber Slice + beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 80), 0.05f); // Onion Slice + beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 79), 0.05f); // Tomato Slice + beeSpecies.addSpecialty(new ItemStack(Items.COOKED_PORKCHOP), 0.05f); + beeSpecies.addSpecialty(new ItemStack(Items.COOKED_BEEF), 0.15f); + beeSpecies.addSpecialty(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 97), 0.05f); // Cheddar Slice + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOW); + AlleleHelper.getInstance().set(template, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_2); + AlleleHelper.getInstance().set(template, EFFECT, AlleleEffects.effectFertile); + AlleleHelper.getInstance().set(template, TERRITORY, EnumAllele.Territory.LARGE); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTER); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT); + AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.FASTER); + }, + dis -> { + if (Loader.isModLoaded(GTValues.MODID_MB)) { + dis.registerMutation(BeeDefinition.AGRARIAN, ForestryUtil.getSpecies(GTValues.MODID_MB, "Batty"), 10); + } else { + dis.registerMutation(BeeDefinition.AGRARIAN, BeeDefinition.IMPERIAL, 10); + } + }, + () -> Loader.isModLoaded(GTValues.MODID_GTFO) + ), + + // Gems + REDSTONE(GTBranchDefinition.GT_GEM, "Rubrumlapis", true, 0x7D0F0F, 0xD11919, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.REDSTONE), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.RAREEARTH), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.INDUSTRIOUS, BeeDefinition.DEMONIC, 10); + mutation.requireResource("blockRedstone"); + } + ), + LAPIS(GTBranchDefinition.GT_GEM, "Lapidi", true, 0x1947D1, 0x476CDA, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.LAPIS), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.DEMONIC, BeeDefinition.IMPERIAL, 10); + mutation.requireResource("blockLapis"); + } + ), + CERTUS(GTBranchDefinition.GT_GEM, "Quarzeus", true, 0x57CFFB, 0xBBEEFF, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.CERTUS), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.HERMITIC, LAPIS, 10); + mutation.requireResource("blockCertusQuartz"); + } + ), + FLUIX(GTBranchDefinition.GT_GEM, "", true, 0xA375FF, 0xB591FF, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.FLUIX), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(REDSTONE, LAPIS, 7); + Api.INSTANCE.definitions().blocks().fluixBlock().maybeBlock().ifPresent(block -> + mutation.requireResource(block.getDefaultState())); + }, + () -> Loader.isModLoaded(GTValues.MODID_APPENG) + ), + DIAMOND(GTBranchDefinition.GT_GEM, "Adamas", false, 0xCCFFFF, 0xA3CCCC, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.DIAMOND), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.HOT); + beeSpecies.setHasEffect(); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(CERTUS, COAL, 3); + mutation.requireResource("blockDiamond"); + } + ), + RUBY(GTBranchDefinition.GT_GEM, "Rubinus", false, 0xE6005C, 0xCC0052, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.RUBY), 0.15f); + beeSpecies.addProduct(getGTComb(GTCombType.REDSTONE), 0.05f); + beeSpecies.setHumidity(EnumHumidity.DAMP); + beeSpecies.setTemperature(EnumTemperature.HOT); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(REDSTONE, DIAMOND, 5); + mutation.requireResource("blockRuby"); + } + ), + SAPPHIRE(GTBranchDefinition.GT_GEM, "Sapphirus", true, 0x0033CC, 0x00248F, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.SAPPHIRE), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(CERTUS, LAPIS, 5); + mutation.requireResource("blockSapphire"); + } + ), + OLIVINE(GTBranchDefinition.GT_GEM, "Olivinum", true, 0x248F24, 0xCCFFCC, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.OLIVINE), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.MAGNESIUM), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> dis.registerMutation(CERTUS, BeeDefinition.ENDED, 5) + ), + EMERALD(GTBranchDefinition.GT_GEM, "Smaragdus", false, 0x248F24, 0x2EB82E, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.EMERALD), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.ALUMINIUM), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.COLD); + beeSpecies.setHasEffect(); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(OLIVINE, DIAMOND, 4); + mutation.requireResource("blockEmerald"); + } + ), + SPARKLING(GTBranchDefinition.GT_GEM, "Vesperstella", true, 0x7A007A, 0xFFFFFF, + beeSpecies -> { + beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_MB, "resource", 3), 0.20f); + beeSpecies.addSpecialty(getGTComb(GTCombType.SPARKLING), 0.125f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> { + AlleleHelper.getInstance().set(template, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_2); + AlleleHelper.getInstance().set(template, NEVER_SLEEPS, true); + AlleleHelper.getInstance().set(template, CAVE_DWELLING, true); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.NETHER); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORT); + AlleleHelper.getInstance().set(template, EFFECT, AlleleEffects.effectAggressive); + AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.AVERAGE); + }, + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(ForestryUtil.getSpecies(GTValues.MODID_MB, "Withering"), ForestryUtil.getSpecies(GTValues.MODID_MB, "Draconic"), 1); + mutation.requireResource("blockNetherStar"); + mutation.restrictBiomeType(BiomeDictionary.Type.END); + }, + () -> Loader.isModLoaded(GTValues.MODID_MB) + ), + + // Metals + COPPER(GTBranchDefinition.GT_METAL, "Cuprum", true, 0xFF6600, 0xE65C00, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.COPPER), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.GOLD), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.MAJESTIC, CLAY, 13); + mutation.requireResource("blockCopper"); + } + ), + TIN(GTBranchDefinition.GT_METAL, "Stannum", true, 0xD4D4D4, 0xDDDDDD, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.TIN), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.ZINC), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(CLAY, BeeDefinition.DILIGENT, 13); + mutation.requireResource("blockTin"); + } + ), + LEAD(GTBranchDefinition.GT_METAL, "Plumbum", true, 0x666699, 0xA3A3CC, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.LEAD), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.SULFUR), 0.05f); + beeSpecies.setHumidity(EnumHumidity.DAMP); + beeSpecies.setTemperature(EnumTemperature.WARM); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(COAL, COPPER, 13); + mutation.requireResource("blockLead"); + } + ), + IRON(GTBranchDefinition.GT_METAL, "Ferrum", true, 0xDA9147, 0xDE9C59, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.IRON), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.TIN), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(TIN, COPPER, 13); + mutation.requireResource("blockIron"); + } + ), + STEEL(GTBranchDefinition.GT_METAL, "Chalybe", true, 0x808080, 0x999999, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.STEEL), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.IRON), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.WARM); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(IRON, COAL, 10); + mutation.requireResource("blockSteel"); + mutation.restrictTemperature(EnumTemperature.HOT); + } + ), + NICKEL(GTBranchDefinition.GT_METAL, "Nichelium", true, 0x8585AD, 0x8585AD, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.NICKEL), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.PLATINUM), 0.02f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(IRON, COPPER, 13); + mutation.requireResource("blockNickel"); + } + ), + ZINC(GTBranchDefinition.GT_METAL, "Cadmiae", true, 0xF0DEF0, 0xF2E1F2, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.ZINC), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.GALLIUM), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(IRON, TIN, 13); + mutation.requireResource("blockZinc"); + } + ), + SILVER(GTBranchDefinition.GT_METAL, "Argenti", true, 0xC2C2D6, 0xCECEDE, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.SILVER), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.SULFUR), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.COLD); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(LEAD, TIN, 10); + mutation.requireResource("blockSilver"); + } + ), + GOLD(GTBranchDefinition.GT_METAL, "Aurum", true, 0xEBC633, 0xEDCC47, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.GOLD), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.NICKEL), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.WARM); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(LEAD, COPPER, 13); + mutation.requireResource("blockGold"); + mutation.restrictTemperature(EnumTemperature.HOT); + } + ), + ARSENIC(GTBranchDefinition.GT_METAL, "Arsenicum", true, 0x736C52, 0x292412, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.ARSENIC), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.WARM); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(ZINC, SILVER, 10); + mutation.requireResource("blockArsenic"); + } + ), + SILICON(GTBranchDefinition.GT_ORGANIC, "Silex", false, 0xADA2A7, 0x736675, + beeSpecies -> { + beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.10f); + beeSpecies.addSpecialty(OreDictUnifier.get(OrePrefix.dust, Materials.Silicon), 0.30f); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOW); + AlleleHelper.getInstance().set(template, TERRITORY, EnumAllele.Territory.LARGER); + AlleleHelper.getInstance().set(template, TOLERATES_RAIN, true); + }, + dis -> { + if (Loader.isModLoaded(GTValues.MODID_MB)) { + dis.registerMutation(IRON, ForestryUtil.getSpecies(GTValues.MODID_MB, "AESkystone"), 17); + } else { + dis.registerMutation(IRON, BeeDefinition.IMPERIAL, 17); + } + } + ), + + // Rare Metals + ALUMINIUM(GTBranchDefinition.GT_RAREMETAL, "Alumen", true, 0xB8B8FF, 0xD6D6FF, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.ALUMINIUM), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.BAUXITE), 0.05f); + beeSpecies.setHumidity(EnumHumidity.ARID); + beeSpecies.setTemperature(EnumTemperature.HOT); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(NICKEL, ZINC, 9); + mutation.requireResource("blockAluminium"); + } + ), + TITANIUM(GTBranchDefinition.GT_RAREMETAL, "Titanus", true, 0xCC99FF, 0xDBB8FF, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.TITANIUM), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.ALMANDINE), 0.05f); + beeSpecies.setHumidity(EnumHumidity.ARID); + beeSpecies.setTemperature(EnumTemperature.HOT); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(REDSTONE, ALUMINIUM, 5); + mutation.requireResource("blockTitanium"); + } + ), + // todo glowstone? + CHROME(GTBranchDefinition.GT_RAREMETAL, "Chroma", true, 0xEBA1EB, 0xF2C3F2, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.CHROME), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.MAGNESIUM), 0.05f); + beeSpecies.setHumidity(EnumHumidity.ARID); + beeSpecies.setTemperature(EnumTemperature.HOT); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(TITANIUM, RUBY, 5); + mutation.requireResource("blockChrome"); + } + ), + MANGANESE(GTBranchDefinition.GT_RAREMETAL, "Manganum", true, 0xD5D5D5, 0xAAAAAA, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.MANGANESE), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.IRON), 0.05f); + beeSpecies.setHumidity(EnumHumidity.ARID); + beeSpecies.setTemperature(EnumTemperature.HOT); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(TITANIUM, ALUMINIUM, 5); + mutation.requireResource("blockManganese"); + } + ), + TUNGSTEN(GTBranchDefinition.GT_RAREMETAL, "Wolframium", false, 0x5C5C8A, 0x7D7DA1, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.TUNGSTEN), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.MOLYBDENUM), 0.05f); + beeSpecies.setHumidity(EnumHumidity.ARID); + beeSpecies.setTemperature(EnumTemperature.HOT); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.HEROIC, MANGANESE, 5); + mutation.requireResource("blockTungsten"); + } + ), + PLATINUM(GTBranchDefinition.GT_RAREMETAL, "Platina", false, 0xE6E6E6, 0xFFFFCC, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.PLATINUM), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.IRIDIUM), 0.05f); + beeSpecies.setHumidity(EnumHumidity.ARID); + beeSpecies.setTemperature(EnumTemperature.HOT); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(DIAMOND, CHROME, 5); + mutation.requireResource("blockPlatinum"); + } + ), + IRIDIUM(GTBranchDefinition.GT_RAREMETAL, "Iris", false, 0xDADADA, 0xD1D1E0, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.IRIDIUM), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.OSMIUM), 0.05f); + beeSpecies.setHumidity(EnumHumidity.ARID); + beeSpecies.setTemperature(EnumTemperature.HELLISH); + beeSpecies.setHasEffect(); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(TUNGSTEN, PLATINUM, 5); + mutation.requireResource("blockIridium"); + } + ), + OSMIUM(GTBranchDefinition.GT_RAREMETAL, "Osmia", false, 0x2B2BDA, 0x8B8B8B, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.OSMIUM), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.IRIDIUM), 0.05f); + beeSpecies.setHumidity(EnumHumidity.ARID); + beeSpecies.setTemperature(EnumTemperature.COLD); + beeSpecies.setHasEffect(); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(TUNGSTEN, PLATINUM, 5); + mutation.requireResource("blockOsmium"); + } + ), + SALTY(GTBranchDefinition.GT_RAREMETAL, "Sal", true, 0xF0C8C8, 0xFAFAFA, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.SALT), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.LITHIUM), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.WARM); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(CLAY, ALUMINIUM, 5); + mutation.requireResource("blockSalt"); + } + ), + LITHIUM(GTBranchDefinition.GT_RAREMETAL, "Lithos", false, 0xF0328C, 0xE1DCFF, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.LITHIUM), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.SALT), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.COLD); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(SALTY, ALUMINIUM, 5); + mutation.requireResource("blockLithium"); + } + ), + ELECTROTINE(GTBranchDefinition.GT_RAREMETAL, "Electrum", false, 0x1E90FF, 0x3CB4C8, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.ELECTROTINE), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.REDSTONE), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.HOT); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(REDSTONE, GOLD, 5); + mutation.requireResource("blockElectrotine"); + } + ), + SULFUR(GTBranchDefinition.GT_RAREMETAL, "Sulphur", false, 0x1E90FF, 0x3CB4C8, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SULFUR), 0.70f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.HOT); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.NORMAL), + dis -> dis.registerMutation(ASH, PEAT, 15) + ), + INDIUM(GTBranchDefinition.GT_RAREMETAL, "Indicium", false, 0xFFA9FF, 0x8F5D99, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.INDIUM), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.HOT); + beeSpecies.setHasEffect(); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWEST), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(LEAD, OSMIUM, 1); + mutation.requireResource("blockIndium"); + mutation.restrictBiomeType(BiomeDictionary.Type.END); + } + ), + + // Industrial + ENERGY(GTBranchDefinition.GT_INDUSTRIAL, "Industria", false, 0xC11F1F, 0xEBB9B9, + beeSpecies -> { + if (Loader.isModLoaded(GTValues.MODID_EB)) { + beeSpecies.addProduct(getExtraBeesComb(14), 0.30f); // STATIC + } else { + beeSpecies.addProduct(getForestryComb(EnumHoneyComb.SIMMERING), 0.30f); + } + beeSpecies.addSpecialty(getGTComb(GTCombType.ENERGY), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.WARM); + beeSpecies.setHasEffect(); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.LONGER); + AlleleHelper.getInstance().set(template, EFFECT, AlleleEffects.effectIgnition); + AlleleHelper.getInstance().set(template, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_2); + AlleleHelper.getInstance().set(template, NEVER_SLEEPS, true); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.NETHER); + AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.AVERAGE); + }, + dis -> { + IBeeMutationBuilder mutation; + if (Loader.isModLoaded(GTValues.MODID_EB)) { + mutation = dis.registerMutation(BeeDefinition.DEMONIC, ForestryUtil.getSpecies(GTValues.MODID_EB, "volcanic"), 10); + } else { + mutation = dis.registerMutation(BeeDefinition.DEMONIC, BeeDefinition.FIENDISH, 10); + } + mutation.requireResource("blockRedstone"); + } + ), + LAPOTRON(GTBranchDefinition.GT_INDUSTRIAL, "Azureus", false, 0xFFEBC4, 0xE36400, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.LAPIS), 0.20f); + beeSpecies.addSpecialty(getGTComb(GTCombType.ENERGY), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.LAPOTRON), 0.10f); + beeSpecies.setHumidity(EnumHumidity.DAMP); + beeSpecies.setTemperature(EnumTemperature.ICY); + beeSpecies.setHasEffect(); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.LONGER); + AlleleHelper.getInstance().set(template, EFFECT, AlleleEffects.effectIgnition); + AlleleHelper.getInstance().set(template, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1); + AlleleHelper.getInstance().set(template, NEVER_SLEEPS, true); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.SNOW); + AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.AVERAGE); + }, + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(LAPIS, ENERGY, 6); + mutation.requireResource("blockLapis"); + mutation.restrictTemperature(EnumTemperature.ICY); + } + ), + EXPLOSIVE(GTBranchDefinition.GT_INDUSTRIAL, "Explosionis", false, 0x7E270F, 0x747474, + beeSpecies -> { + beeSpecies.addProduct(new ItemStack(Blocks.TNT), 0.2f); + // todo if we add a ITNT substitute, put it here instead of TNT + beeSpecies.setHumidity(EnumHumidity.ARID); + beeSpecies.setTemperature(EnumTemperature.HELLISH); + beeSpecies.setHasEffect(); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWEST); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.LONGEST); + AlleleHelper.getInstance().set(template, EFFECT, AlleleEffects.effectSnowing); + AlleleHelper.getInstance().set(template, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE); + AlleleHelper.getInstance().set(template, NEVER_SLEEPS, true); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.SNOW); + AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.AVERAGE); + }, + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.AUSTERE, COAL, 4); + mutation.requireResource(Blocks.TNT.getDefaultState()); + } + ), + + // Alloys + REDALLOY(GTBranchDefinition.GT_ALLOY, "Rubrum", false, 0xE60000, 0xB80000, + beeSpecies -> { + beeSpecies.addProduct(getForestryComb(EnumHoneyComb.PARCHED), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.REDALLOY), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTER); + }, + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(COPPER, REDSTONE, 10); + mutation.requireResource("blockRedAlloy"); + } + ), + STAINLESSSTEEL(GTBranchDefinition.GT_ALLOY, "Nonferrugo", false, 0xC8C8DC, 0x778899, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.STEEL), 0.10f); + beeSpecies.addSpecialty(getGTComb(GTCombType.STAINLESSSTEEL), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.CHROME), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.HOT); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.FAST); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTEST); + AlleleHelper.getInstance().set(template, EFFECT, AlleleEffects.effectIgnition); + }, + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(CHROME, STEEL, 9); + mutation.requireResource("blockStainlessSteel"); + } + ), + + // Radioactive + URANIUM(GTBranchDefinition.GT_RADIOACTIVE, "Ouranos", true, 0x19AF19, 0x169E16, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.URANIUM), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.COLD); + beeSpecies.setNocturnal(); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWEST); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.LONGEST); + }, + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.AVENGING, PLATINUM, 2); + mutation.requireResource("blockUranium"); + } + ), + PLUTONIUM(GTBranchDefinition.GT_RADIOACTIVE, "Plutos", true, 0x570000, 0x240000, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addProduct(getGTComb(GTCombType.LEAD), 0.15f); + beeSpecies.addSpecialty(getGTComb(GTCombType.PLUTONIUM), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.ICY); + beeSpecies.setNocturnal(); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWEST); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.LONGEST); + }, + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(URANIUM, EMERALD, 2); + mutation.requireResource("blockPlutonium"); + } + ), + NAQUADAH(GTBranchDefinition.GT_RADIOACTIVE, "Nasquis", false, 0x003300, 0x002400, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.NAQUADAH), 0.15f); + beeSpecies.setHumidity(EnumHumidity.ARID); + beeSpecies.setTemperature(EnumTemperature.ICY); + beeSpecies.setNocturnal(); + beeSpecies.setHasEffect(); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWEST); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.LONGEST); + }, + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(PLUTONIUM, IRIDIUM, 1); + mutation.requireResource("blockNaquadah"); + } + ), + NAQUADRIA(GTBranchDefinition.GT_RADIOACTIVE, "Nasquidrius", false, 0x000000, 0x002400, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); + beeSpecies.addSpecialty(getGTComb(GTCombType.NAQUADAH), 0.20f); + beeSpecies.addSpecialty(getGTComb(GTCombType.NAQUADRIA), 0.15f); + beeSpecies.setHumidity(EnumHumidity.ARID); + beeSpecies.setTemperature(EnumTemperature.ICY); + beeSpecies.setNocturnal(); + beeSpecies.setHasEffect(); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWEST); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.LONGEST); + }, + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(PLUTONIUM, IRIDIUM, 1); + mutation.requireResource("blockNaquadria"); + } + ), + TRINIUM(GTBranchDefinition.GT_RADIOACTIVE, "Trinium", false, 0xB0E0E6, 0xC8C8D2, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.TRINIUM), 0.75f); + beeSpecies.addSpecialty(getGTComb(GTCombType.NAQUADAH), 0.10f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.COLD); + beeSpecies.setNocturnal(); + beeSpecies.setHasEffect(); + }, + template -> AlleleHelper.getInstance().set(template, SPEED, GTAlleleBeeSpecies.speedBlinding), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(IRIDIUM, NAQUADAH, 4); + mutation.requireResource("blockTrinium"); + } + ), + THORIUM(GTBranchDefinition.GT_RADIOACTIVE, "Thorax", false, 0x005000, 0x001E00, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.THORIUM), 0.75f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.COLD); + beeSpecies.setNocturnal(); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWEST); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.LONGEST); + }, + dis -> { + IMutationBuilder mutation = dis.registerMutation(COAL, URANIUM, 2).setIsSecret(); + mutation.requireResource("blockThorium"); + } + ), + LUTETIUM(GTBranchDefinition.GT_RADIOACTIVE, "Lutetia", false, 0x00AAFF, 0x0059FF, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.LUTETIUM), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + beeSpecies.setNocturnal(); + beeSpecies.setHasEffect(); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWEST); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.LONGEST); + }, + dis -> { + IMutationBuilder mutation; + if (Loader.isModLoaded(GTValues.MODID_EB)) { + mutation = dis.registerMutation(THORIUM, ForestryUtil.getSpecies(GTValues.MODID_EB, "rotten"), 1); + } else { + mutation = dis.registerMutation(THORIUM, BeeDefinition.IMPERIAL, 1); + } + mutation.setIsSecret(); + mutation.requireResource("blockLutetium"); + } + ), + AMERICIUM(GTBranchDefinition.GT_RADIOACTIVE, "Libertas", false, 0x287869, 0x0C453A, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.AMERICIUM), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + beeSpecies.setNocturnal(); + beeSpecies.setHasEffect(); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWEST); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.LONGEST); + }, + dis -> { + IMutationBuilder mutation = dis.registerMutation(LUTETIUM, CHROME, 1).setIsSecret(); + mutation.requireResource("blockAmericium"); + } + ), + NEUTRONIUM(GTBranchDefinition.GT_RADIOACTIVE, "Media", false, 0xFFF0F0, 0xFAFAFA, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.NEUTRONIUM), 0.0001f); + beeSpecies.setHumidity(EnumHumidity.DAMP); + beeSpecies.setTemperature(EnumTemperature.HELLISH); + beeSpecies.setHasEffect(); + }, + template -> { + AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWEST); + AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.LONGEST); + AlleleHelper.getInstance().set(template, NEVER_SLEEPS, true); + }, + dis -> { + IMutationBuilder mutation = dis.registerMutation(NAQUADRIA, AMERICIUM, 1).setIsSecret(); + mutation.requireResource(new UnificationEntry(OrePrefix.block, Materials.Neutronium).toString()); + } + ), + + // Noble Gases + HELIUM(GTBranchDefinition.GT_NOBLEGAS, "Helium", false, 0xFFA9FF, 0xC8B8B4, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.HELIUM), 0.35f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.ICY); + beeSpecies.setNocturnal(); + beeSpecies.setHasEffect(); + }, + template -> AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTEST), + dis -> { + IBeeMutationBuilder mutation; + if (Loader.isModLoaded(GTValues.MODID_MB)) { + mutation = dis.registerMutation(STAINLESSSTEEL, ForestryUtil.getSpecies(GTValues.MODID_MB, "Watery"), 10); + } else { + mutation = dis.registerMutation(STAINLESSSTEEL, BeeDefinition.INDUSTRIOUS, 10); + } + mutation.restrictTemperature(EnumTemperature.ICY); + } + ), + ARGON(GTBranchDefinition.GT_NOBLEGAS, "Argon", false, 0x89D9E1, 0xBDA5C2, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.ARGON), 0.35f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.ICY); + beeSpecies.setNocturnal(); + beeSpecies.setHasEffect(); + }, + template -> AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTEST), + dis -> { + IBeeMutationBuilder mutation; + if (Loader.isModLoaded(GTValues.MODID_MB)) { + mutation = dis.registerMutation(HELIUM, ForestryUtil.getSpecies(GTValues.MODID_MB, "Supernatural"), 8); + } else { + mutation = dis.registerMutation(HELIUM, BeeDefinition.IMPERIAL, 8); + } + mutation.restrictTemperature(EnumTemperature.ICY); + } + ), + NEON(GTBranchDefinition.GT_NOBLEGAS, "Novum", false, 0xFFC826, 0xFF7200, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.NEON), 0.35f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.ICY); + beeSpecies.setNocturnal(); + beeSpecies.setHasEffect(); + }, + template -> AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTEST), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(ARGON, IRON, 6); + mutation.restrictTemperature(EnumTemperature.ICY); + } + ), + KRYPTON(GTBranchDefinition.GT_NOBLEGAS, "Kryptos", false, 0x8A97B0, 0x160822, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.KRYPTON), 0.35f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.ICY); + beeSpecies.setNocturnal(); + beeSpecies.setHasEffect(); + }, + template -> AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTEST), + dis -> { + IBeeMutationBuilder mutation; + if (Loader.isModLoaded(GTValues.MODID_MB)) { + mutation = dis.registerMutation(NEON, ForestryUtil.getSpecies(GTValues.MODID_MB, "Supernatural"), 4); + } else { + mutation = dis.registerMutation(NEON, BeeDefinition.AVENGING, 4); + } + mutation.restrictTemperature(EnumTemperature.ICY); + } + ), + XENON(GTBranchDefinition.GT_NOBLEGAS, "Hostis", false, 0x8A97B0, 0x160822, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.XENON), 0.525f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.ICY); + beeSpecies.setNocturnal(); + beeSpecies.setHasEffect(); + }, + template -> AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTEST), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(KRYPTON, BeeDefinition.EDENIC, 2); + mutation.restrictTemperature(EnumTemperature.ICY); + } + ), + OXYGEN(GTBranchDefinition.GT_NOBLEGAS, "Oxygeni", false, 0xFFFFFF, 0x8F8FFF, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.OXYGEN), 0.45f); + beeSpecies.addSpecialty(getGTComb(GTCombType.HYDROGEN), 0.20f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.ICY); + beeSpecies.setNocturnal(); + beeSpecies.setHasEffect(); + }, + template -> AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTEST), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(HELIUM, BeeDefinition.ENDED, 15); + mutation.restrictTemperature(EnumTemperature.ICY); + } + ), + HYDROGEN(GTBranchDefinition.GT_NOBLEGAS, "Hydrogenium", false, 0xFFFFFF, 0xFF1493, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.HYDROGEN), 0.45f); + beeSpecies.addSpecialty(getGTComb(GTCombType.NITROGEN), 0.20f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.ICY); + beeSpecies.setNocturnal(); + beeSpecies.setHasEffect(); + }, + template -> AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTEST), + dis -> { + IBeeMutationBuilder mutation; + if (Loader.isModLoaded(GTValues.MODID_MB)) { + mutation = dis.registerMutation(OXYGEN, ForestryUtil.getSpecies(GTValues.MODID_MB, "Watery"), 15); + } else { + mutation = dis.registerMutation(OXYGEN, BeeDefinition.INDUSTRIOUS, 15); + } + mutation.restrictTemperature(EnumTemperature.ICY); + } + ), + NITROGEN(GTBranchDefinition.GT_NOBLEGAS, "Nitrogenium", false, 0xFFC832, 0xA52A2A, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.NITROGEN), 0.45f); + beeSpecies.addSpecialty(getGTComb(GTCombType.FLUORINE), 0.20f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.ICY); + beeSpecies.setNocturnal(); + beeSpecies.setHasEffect(); + }, + template -> AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTEST), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(OXYGEN, HYDROGEN, 15); + mutation.restrictTemperature(EnumTemperature.ICY); + } + ), + FLUORINE(GTBranchDefinition.GT_NOBLEGAS, "Fluens", false, 0x86AFF0, 0xFF6D00, + beeSpecies -> { + beeSpecies.addProduct(getGTComb(GTCombType.FLUORINE), 0.45f); + beeSpecies.addSpecialty(getGTComb(GTCombType.OXYGEN), 0.20f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.ICY); + beeSpecies.setNocturnal(); + beeSpecies.setHasEffect(); + }, + template -> AlleleHelper.getInstance().set(template, LIFESPAN, EnumAllele.Lifespan.SHORTEST), + dis -> { + IBeeMutationBuilder mutation = dis.registerMutation(NITROGEN, HYDROGEN, 15); + mutation.restrictTemperature(EnumTemperature.ICY); + } + ); + + private final GTBranchDefinition branch; + private final GTAlleleBeeSpecies species; + private final Consumer speciesProperties; + private final Consumer alleles; + private final Consumer mutations; + private IAllele[] template; + private IBeeGenome genome; + private final Supplier generationCondition; + + GTBeeDefinition(GTBranchDefinition branch, + String binomial, + boolean dominant, + int primary, + int secondary, + Consumer speciesProperties, + Consumer alleles, + Consumer mutations) { + this(branch, binomial, dominant, primary, secondary, speciesProperties, alleles, mutations, () -> true); + } + + GTBeeDefinition(GTBranchDefinition branch, + String binomial, + boolean dominant, + int primary, + int secondary, + Consumer speciesProperties, + Consumer alleles, + Consumer mutations, + Supplier generationCondition) { + this.alleles = alleles; + this.mutations = mutations; + this.speciesProperties = speciesProperties; + String lowercaseName = this.toString().toLowerCase(Locale.ENGLISH); + String species = WordUtils.capitalize(lowercaseName); + + String uid = "gregtech.bee.species" + species; + String description = "for.bees.description." + lowercaseName; + String name = "for.bees.species." + lowercaseName; + + this.branch = branch; + this.species = new GTAlleleBeeSpecies(GTValues.MODID, uid, name, "GregTech", description, dominant, branch.getBranch(), binomial, primary, secondary); + this.generationCondition = generationCondition; + } + + public static void initBees() { + for (GTBeeDefinition bee : values()) { + bee.init(); + } + for (GTBeeDefinition bee : values()) { + bee.registerMutations(); + } + } + + private static ItemStack getForestryComb(EnumHoneyComb type) { + return ModuleApiculture.getItems().beeComb.get(type, 1); + } + + @Optional.Method(modid = GTValues.MODID_EB) + private static ItemStack getExtraBeesComb(int meta) { + return IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_comb", meta); + } + + @Optional.Method(modid = GTValues.MODID_MB) + private static ItemStack getMagicBeesComb(int meta) { + return IntegrationUtil.getModItem(GTValues.MODID_MB, "beecomb", meta); + } + + private static ItemStack getGTComb(GTCombType type) { + return new ItemStack(ForestryModule.COMBS, 1, type.ordinal()); + } + + private void setSpeciesProperties(GTAlleleBeeSpecies beeSpecies) { + this.speciesProperties.accept(beeSpecies); + } + + private void setAlleles(IAllele[] template) { + this.alleles.accept(template); + } + + private void registerMutations() { + if (generationCondition.get()) { + this.mutations.accept(this); + } + } + + private void init() { + if (generationCondition.get()) { + setSpeciesProperties(species); + + template = branch.getTemplate(); + AlleleHelper.getInstance().set(template, SPECIES, species); + setAlleles(template); + + //noinspection ConstantConditions + genome = BeeManager.beeRoot.templateAsGenome(template); + + BeeManager.beeRoot.registerTemplate(template); + } + } + + private IBeeMutationBuilder registerMutation(IBeeDefinition parent1, IBeeDefinition parent2, int chance) { + return registerMutation(parent1.getGenome().getPrimary(), parent2.getGenome().getPrimary(), chance); + } + + private IBeeMutationBuilder registerMutation(IAlleleBeeSpecies parent1, IBeeDefinition parent2, int chance) { + return registerMutation(parent1, parent2.getGenome().getPrimary(), chance); + } + + private IBeeMutationBuilder registerMutation(IBeeDefinition parent1, IAlleleBeeSpecies parent2, int chance) { + return registerMutation(parent1.getGenome().getPrimary(), parent2, chance); + } + + private IBeeMutationBuilder registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, int chance) { + //noinspection ConstantConditions + return BeeManager.beeMutationFactory.createMutation(parent1, parent2, getTemplate(), chance); + } + + @Override + public final IAllele @NotNull [] getTemplate() { + return Arrays.copyOf(template, template.length); + } + + @NotNull + @Override + public final IBeeGenome getGenome() { + return genome; + } + + @NotNull + @Override + public final IBee getIndividual() { + return new Bee(genome); + } + + @NotNull + @Override + public final ItemStack getMemberStack(@NotNull EnumBeeType beeType) { + //noinspection ConstantConditions + return BeeManager.beeRoot.getMemberStack(getIndividual(), beeType); + } +} diff --git a/src/main/java/gregtech/integration/forestry/bees/GTBranchDefinition.java b/src/main/java/gregtech/integration/forestry/bees/GTBranchDefinition.java new file mode 100644 index 00000000000..ce2c094e770 --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/bees/GTBranchDefinition.java @@ -0,0 +1,133 @@ +package gregtech.integration.forestry.bees; + +import forestry.api.apiculture.BeeManager; +import forestry.api.apiculture.EnumBeeChromosome; +import forestry.api.genetics.AlleleManager; +import forestry.api.genetics.IAllele; +import forestry.api.genetics.IClassification; +import forestry.apiculture.genetics.alleles.AlleleEffects; +import forestry.core.genetics.alleles.AlleleHelper; +import forestry.core.genetics.alleles.EnumAllele; + +import java.util.Arrays; +import java.util.function.Consumer; + +import static forestry.api.apiculture.EnumBeeChromosome.*; + +public enum GTBranchDefinition { + + GT_ORGANIC("Fuelis", alleles -> { + AlleleHelper.getInstance().set(alleles, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE); + AlleleHelper.getInstance().set(alleles, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_2); + AlleleHelper.getInstance().set(alleles, NEVER_SLEEPS, false); + AlleleHelper.getInstance().set(alleles, FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT); + AlleleHelper.getInstance().set(alleles, FLOWERING, EnumAllele.Flowering.SLOW); + AlleleHelper.getInstance().set(alleles, LIFESPAN, EnumAllele.Lifespan.SHORTER); + AlleleHelper.getInstance().set(alleles, SPEED, EnumAllele.Speed.SLOWEST); + }), + + GT_INDUSTRIAL("Industrialis", alleles -> { + AlleleHelper.getInstance().set(alleles, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1); + AlleleHelper.getInstance().set(alleles, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1); + AlleleHelper.getInstance().set(alleles, NEVER_SLEEPS, false); + AlleleHelper.getInstance().set(alleles, FLOWER_PROVIDER, EnumAllele.Flowers.SNOW); + AlleleHelper.getInstance().set(alleles, FLOWERING, EnumAllele.Flowering.FASTER); + AlleleHelper.getInstance().set(alleles, LIFESPAN, EnumAllele.Lifespan.SHORT); + AlleleHelper.getInstance().set(alleles, SPEED, EnumAllele.Speed.SLOW); + }), + + GT_ALLOY("Amalgamis", alleles -> { + AlleleHelper.getInstance().set(alleles, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE); + AlleleHelper.getInstance().set(alleles, TOLERATES_RAIN, true); + AlleleHelper.getInstance().set(alleles, NEVER_SLEEPS, false); + AlleleHelper.getInstance().set(alleles, FLOWER_PROVIDER, EnumAllele.Flowers.VANILLA); + AlleleHelper.getInstance().set(alleles, FLOWERING, EnumAllele.Flowering.AVERAGE); + AlleleHelper.getInstance().set(alleles, LIFESPAN, EnumAllele.Lifespan.SHORTEST); + AlleleHelper.getInstance().set(alleles, SPEED, EnumAllele.Speed.FAST); + }), + + GT_GEM("Ornamentis", alleles -> { + AlleleHelper.getInstance().set(alleles, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE); + AlleleHelper.getInstance().set(alleles, NEVER_SLEEPS, false); + AlleleHelper.getInstance().set(alleles, FLOWER_PROVIDER, EnumAllele.Flowers.NETHER); + AlleleHelper.getInstance().set(alleles, FLOWERING, EnumAllele.Flowering.AVERAGE); + }), + + GT_METAL("Metaliferis", alleles -> { + AlleleHelper.getInstance().set(alleles, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_2); + AlleleHelper.getInstance().set(alleles, CAVE_DWELLING, true); + AlleleHelper.getInstance().set(alleles, NEVER_SLEEPS, false); + AlleleHelper.getInstance().set(alleles, FLOWER_PROVIDER, EnumAllele.Flowers.JUNGLE); + AlleleHelper.getInstance().set(alleles, FLOWERING, EnumAllele.Flowering.SLOWER); + }), + + GT_RAREMETAL("Mineralis", alleles -> { + AlleleHelper.getInstance().set(alleles, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_1); + AlleleHelper.getInstance().set(alleles, NEVER_SLEEPS, false); + AlleleHelper.getInstance().set(alleles, FLOWER_PROVIDER, EnumAllele.Flowers.CACTI); + AlleleHelper.getInstance().set(alleles, FLOWERING, EnumAllele.Flowering.FAST); + }), + + GT_RADIOACTIVE("Criticalis", alleles -> { + AlleleHelper.getInstance().set(alleles, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE); + AlleleHelper.getInstance().set(alleles, NEVER_SLEEPS, false); + AlleleHelper.getInstance().set(alleles, FLOWER_PROVIDER, EnumAllele.Flowers.END); + AlleleHelper.getInstance().set(alleles, FLOWERING, EnumAllele.Flowering.AVERAGE); + AlleleHelper.getInstance().set(alleles, SPEED, GTAlleleBeeSpecies.speedBlinding); + AlleleHelper.getInstance().set(alleles, EFFECT, AlleleEffects.effectRadioactive); + }), + + GT_NOBLEGAS("Gasa Nobilia", alleles -> { + AlleleHelper.getInstance().set(alleles, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_2); + AlleleHelper.getInstance().set(alleles, TOLERATES_RAIN, true); + AlleleHelper.getInstance().set(alleles, FLOWERING, EnumAllele.Flowering.FASTEST); + AlleleHelper.getInstance().set(alleles, LIFESPAN, EnumAllele.Lifespan.NORMAL); + AlleleHelper.getInstance().set(alleles, SPEED, EnumAllele.Speed.FASTEST); + AlleleHelper.getInstance().set(alleles, TERRITORY, EnumAllele.Territory.AVERAGE); + }); + + private static IAllele[] defaultTemplate; + private final IClassification branch; + private final Consumer branchProperties; + + GTBranchDefinition(String scientific, Consumer branchProperties) { + //noinspection ConstantConditions + this.branch = BeeManager.beeFactory.createBranch(this.name().toLowerCase(), scientific); + AlleleManager.alleleRegistry.getClassification("family.apidae").addMemberGroup(this.branch); + this.branchProperties = branchProperties; + } + + private static IAllele[] getDefaultTemplate() { + if (defaultTemplate == null) { + defaultTemplate = new IAllele[EnumBeeChromosome.values().length]; + + AlleleHelper.getInstance().set(defaultTemplate, SPEED, EnumAllele.Speed.SLOWEST); + AlleleHelper.getInstance().set(defaultTemplate, LIFESPAN, EnumAllele.Lifespan.SHORTER); + AlleleHelper.getInstance().set(defaultTemplate, FERTILITY, EnumAllele.Fertility.NORMAL); + AlleleHelper.getInstance().set(defaultTemplate, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE); + AlleleHelper.getInstance().set(defaultTemplate, NEVER_SLEEPS, false); + AlleleHelper.getInstance().set(defaultTemplate, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE); + AlleleHelper.getInstance().set(defaultTemplate, TOLERATES_RAIN, false); + AlleleHelper.getInstance().set(defaultTemplate, CAVE_DWELLING, false); + AlleleHelper.getInstance().set(defaultTemplate, FLOWER_PROVIDER, EnumAllele.Flowers.VANILLA); + AlleleHelper.getInstance().set(defaultTemplate, FLOWERING, EnumAllele.Flowering.SLOWEST); + AlleleHelper.getInstance().set(defaultTemplate, TERRITORY, EnumAllele.Territory.AVERAGE); + AlleleHelper.getInstance().set(defaultTemplate, EFFECT, AlleleEffects.effectNone); + } + return Arrays.copyOf(defaultTemplate, defaultTemplate.length); + } + + private void setBranchProperties(IAllele[] template) { + this.branchProperties.accept(template); + } + + public IAllele[] getTemplate() { + IAllele[] template = getDefaultTemplate(); + setBranchProperties(template); + return template; + } + + public IClassification getBranch() { + return branch; + } +} diff --git a/src/main/java/gregtech/integration/forestry/bees/GTCombItem.java b/src/main/java/gregtech/integration/forestry/bees/GTCombItem.java new file mode 100644 index 00000000000..ba1593ce53d --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/bees/GTCombItem.java @@ -0,0 +1,70 @@ +package gregtech.integration.forestry.bees; + +import forestry.api.core.IItemModelRegister; +import forestry.api.core.IModelManager; +import forestry.api.core.Tabs; +import forestry.core.items.IColoredItem; +import forestry.core.utils.ItemTooltipUtil; +import gregtech.api.GTValues; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public class GTCombItem extends Item implements IColoredItem, IItemModelRegister { + + public GTCombItem() { + super(); + setHasSubtypes(true); + setCreativeTab(Tabs.tabApiculture); + setRegistryName(GTValues.MODID, "gt.comb"); + setTranslationKey("gt.comb"); + } + + @SuppressWarnings("deprecation") + @SideOnly(Side.CLIENT) + @Override + public void registerModel(@NotNull Item item, IModelManager manager) { + manager.registerItemModel(item, 0); + for (int i = 0; i < GTCombType.values().length; i++) { + manager.registerItemModel(item, i, GTValues.MODID_FR, "gt.comb"); + } + } + + @NotNull + @Override + public String getTranslationKey(ItemStack stack) { + GTCombType type = GTCombType.getComb(stack.getItemDamage()); + return super.getTranslationKey(stack) + "." + type.name; + } + + @Override + public void getSubItems(@NotNull CreativeTabs tab, @NotNull NonNullList items) { + if (tab == Tabs.tabApiculture) { + for (GTCombType type : GTCombType.VALUES) { + if (!type.showInList) continue; + items.add(new ItemStack(this, 1, type.ordinal())); + } + } + } + + @Override + public int getColorFromItemstack(ItemStack stack, int tintIndex) { + GTCombType type = GTCombType.getComb(stack.getItemDamage()); + return type.color[tintIndex >= 1 ? 1 : 0]; + } + + @Override + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + super.addInformation(stack, worldIn, tooltip, flagIn); + ItemTooltipUtil.addInformation(stack, worldIn, tooltip, flagIn); + } +} diff --git a/src/main/java/gregtech/integration/forestry/bees/GTCombType.java b/src/main/java/gregtech/integration/forestry/bees/GTCombType.java new file mode 100644 index 00000000000..ec773f29c8e --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/bees/GTCombType.java @@ -0,0 +1,116 @@ +package gregtech.integration.forestry.bees; + +import gregtech.api.GTValues; +import net.minecraftforge.fml.common.Loader; + +public enum GTCombType { + + // Organic + COAL("coal", 0x525252, 0x666666), + COKE("coke", 0x4B4B4B, 0x7D7D7D), + STICKY("stickyresin", 0x2E8F5B, 0xDCC289), + OIL("oil", 0x333333, 0x4C4C4C), + APATITE("apatite", 0xC1C1F6, 0x676784), + ASH("ash", 0x1E1A18, 0xC6C6C6), + BIOMASS("biomass", 0x17AF0E, 0x21E118), + PHOSPHORUS("phosphorus", 0xC1C1F6, 0xFFC826), + + // Industrial + ENERGY("energy", 0xC11F1F, 0xEBB9B9), + LAPOTRON("lapotron", 0x1414FF, 0x6478FF), + + // Alloy + REDALLOY("redalloy", 0xE60000, 0xB80000), + STAINLESSSTEEL("stainlesssteel", 0x778899, 0xC8C8DC), + + // Gem + STONE("stone", 0x808080, 0x999999), + CERTUS("certus", 0x57CFFB, 0xBBEEFF), + FLUIX("fluix", 0xA375FF, 0xB591FF, Loader.isModLoaded(GTValues.MODID_APPENG)), + REDSTONE("redstone", 0x7D0F0F, 0xD11919), + RAREEARTH("rareearth", 0x555643, 0x343428), + LAPIS("lapis", 0x1947D1, 0x476CDA), + RUBY("ruby", 0xE6005C, 0xCC0052), + SAPPHIRE("sapphire", 0x0033CC, 0x00248F), + DIAMOND("diamond", 0xCCFFFF, 0xA3CCCC), + OLIVINE("olivine", 0x248F24, 0xCCFFCC), + EMERALD("emerald", 0x248F24, 0x2EB82E), + PYROPE("pyrope", 0x763162, 0x8B8B8B), + GROSSULAR("grossular", 0x9B4E00, 0x8B8B8B), + SPARKLING("sparkling", 0x7A007A, 0xFFFFFF, Loader.isModLoaded(GTValues.MODID_MB)), + + // Metal + SLAG("slag", 0xD4D4D4, 0x58300B), + COPPER("copper", 0xFF6600, 0xE65C00), + TIN("tin", 0xD4D4D4, 0xDDDDDD), + LEAD("lead", 0x666699, 0xA3A3CC), + IRON("iron", 0xDA9147, 0xDE9C59), + STEEL("steel", 0x808080, 0x999999), + NICKEL("nickel", 0x8585AD, 0x9D9DBD), + ZINC("zinc", 0xF0DEF0, 0xF2E1F2), + SILVER("silver", 0xC2C2D6, 0xCECEDE), + GOLD("gold", 0xE6B800, 0xCFA600), + SULFUR("sulfur", 0x6F6F01, 0x8B8B8B), + GALLIUM("gallium", 0x8B8B8B, 0xC5C5E4), + ARSENIC("arsenic", 0x736C52, 0x292412), + + // Rare Metal + BAUXITE("bauxite", 0x6B3600, 0x8B8B8B), + ALUMINIUM("aluminium", 0x008AB8, 0xD6D6FF), + MANGANESE("manganese", 0xD5D5D5, 0xCDE1B9), + MAGNESIUM("magnesium", 0xF1D9D9, 0x8B8B8B), + TITANIUM("titanium", 0xCC99FF, 0xDBB8FF), + CHROME("chrome", 0xEBA1EB, 0xF2C3F2), + TUNGSTEN("tungsten", 0x62626D, 0x161620), + PLATINUM("platinum", 0xE6E6E6, 0xFFFFCC), + IRIDIUM("iridium", 0xDADADA, 0xA1E4E4), + MOLYBDENUM("molybdenum", 0xAEAED4, 0x8B8B8B), + OSMIUM("osmium", 0x2B2BDA, 0x8B8B8B), + LITHIUM("lithium", 0xF0328C, 0xE1DCFF), + SALT("salt", 0xF0C8C8, 0xFAFAFA), + ELECTROTINE("electrotine", 0x1E90FF, 0x3CB4C8), + ALMANDINE("almandine", 0xC60000, 0x8B8B8B), + INDIUM("indium", 0x8F5D99, 0xFFA9FF), + + // Radioactive + URANIUM("uranium", 0x19AF19, 0x169E16), + PLUTONIUM("plutonium", 0x240000, 0x570000), + NAQUADAH("naquadah", 0x000000, 0x004400), + NAQUADRIA("naquadria", 0x000000, 0x002400), + TRINIUM("trinium", 0x9973BD, 0xC8C8D2), + THORIUM("thorium", 0x001E00, 0x005000), + LUTETIUM("lutetium", 0x0059FF, 0x00AAFF), + AMERICIUM("americium", 0x0C453A, 0x287869), + NEUTRONIUM("neutronium", 0xFFF0F0, 0xFAFAFA), + + // Noble Gas + HELIUM("helium", 0xFFA9FF, 0xFFFFC3), + ARGON("argon", 0x00FF00, 0x160822), + XENON("xenon", 0x160822, 0x8A97B0), + NEON("neon", 0xFAB4B4, 0xFFC826), + KRYPTON("krypton", 0x80FF80, 0xFFFFC3), + NITROGEN("nitrogen", 0x00BFC1, 0xFFFFFF), + OXYGEN("oxygen", 0x8F8FFF, 0xFFFFFF), + HYDROGEN("hydrogen", 0x0000B5, 0xFFFFFF), + FLUORINE("fluorine", 0xFF6D00, 0x86AFF0); + + public static final GTCombType[] VALUES = values(); + + public final boolean showInList; + public final String name; + public final int[] color; + + GTCombType(String name, int primary, int secondary) { + this(name, primary, secondary, true); + } + + GTCombType(String name, int primary, int secondary, boolean show) { + this.name = name; + this.color = new int[]{primary, secondary}; + this.showInList = show; + } + + public static GTCombType getComb(int meta) { + return meta < 0 || meta > VALUES.length ? VALUES[0] : VALUES[meta]; + } +} diff --git a/src/main/java/gregtech/integration/forestry/bees/GTDropItem.java b/src/main/java/gregtech/integration/forestry/bees/GTDropItem.java new file mode 100644 index 00000000000..27df7cf87b4 --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/bees/GTDropItem.java @@ -0,0 +1,70 @@ +package gregtech.integration.forestry.bees; + +import forestry.api.apiculture.BeeManager; +import forestry.api.arboriculture.TreeManager; +import forestry.api.core.IItemModelRegister; +import forestry.api.core.IModelManager; +import forestry.api.core.Tabs; +import forestry.api.genetics.AlleleManager; +import forestry.api.genetics.ISpeciesRoot; +import forestry.api.lepidopterology.ButterflyManager; +import forestry.core.items.IColoredItem; +import gregtech.api.GTValues; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class GTDropItem extends Item implements IColoredItem, IItemModelRegister { + + public GTDropItem() { + super(); + setHasSubtypes(true); + setCreativeTab(Tabs.tabApiculture); + setTranslationKey("gt.honey_drop"); + setRegistryName(GTValues.MODID, "gt.honey_drop"); + setResearchSuitability(BeeManager.beeRoot); + setResearchSuitability(TreeManager.treeRoot); + setResearchSuitability(ButterflyManager.butterflyRoot); + setResearchSuitability(AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers")); + } + + private void setResearchSuitability(@Nullable ISpeciesRoot speciesRoot) { + if (speciesRoot != null) { + speciesRoot.setResearchSuitability(new ItemStack(this, 1, GTValues.W), 0.5f); + } + } + + @SuppressWarnings("deprecation") + @Override + public void registerModel(@NotNull Item item, @NotNull IModelManager manager) { + manager.registerItemModel(item, 0); + for (int i = 0; i < GTDropType.VALUES.length; i++) { + manager.registerItemModel(item, i, GTValues.MODID_FR, "gt.honey_drop"); + } + } + + @NotNull + @Override + public String getTranslationKey(@NotNull ItemStack stack) { + GTDropType type = GTDropType.getDrop(stack.getItemDamage()); + return super.getTranslationKey(stack) + "." + type.name; + } + + @Override + public void getSubItems(@NotNull CreativeTabs tab, @NotNull NonNullList items) { + if (tab == Tabs.tabApiculture) { + for (GTDropType type : GTDropType.VALUES) { + items.add(new ItemStack(this, 1, type.ordinal())); + } + } + } + + @Override + public int getColorFromItemstack(@NotNull ItemStack stack, int i) { + GTDropType type = GTDropType.getDrop(stack.getItemDamage()); + return type.color[i == 0 ? 0 : 1]; + } +} diff --git a/src/main/java/gregtech/integration/forestry/bees/GTDropType.java b/src/main/java/gregtech/integration/forestry/bees/GTDropType.java new file mode 100644 index 00000000000..f8781c4aafa --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/bees/GTDropType.java @@ -0,0 +1,23 @@ +package gregtech.integration.forestry.bees; + +public enum GTDropType { + + OIL("oil", 0x19191B, 0x303032), + BIOMASS("biomass", 0x21E118, 0x17AF0E), + ETHANOL("ethanol", 0xCE5504, 0x853703), + MUTAGEN("mutagen", 0xFFC100, 0x00FF11); + + public static final GTDropType[] VALUES = values(); + + public final String name; + public final int[] color; + + GTDropType(String name, int primary, int secondary) { + this.name = name; + this.color = new int[]{primary, secondary}; + } + + public static GTDropType getDrop(int meta) { + return meta < 0 || meta >= VALUES.length ? VALUES[0] : VALUES[meta]; + } +} diff --git a/src/main/java/gregtech/integration/forestry/frames/GTFrameType.java b/src/main/java/gregtech/integration/forestry/frames/GTFrameType.java new file mode 100644 index 00000000000..a6d6e80d1bc --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/frames/GTFrameType.java @@ -0,0 +1,103 @@ +package gregtech.integration.forestry.frames; + +import forestry.api.apiculture.IBeeGenome; +import forestry.api.apiculture.IBeeModifier; +import org.jetbrains.annotations.Nullable; + +public enum GTFrameType implements IBeeModifier { + + // increased mutation and production, slightly lower lifespan + ACCELERATED("Accelerated", 175, 1.0f, 1.2f, 0.9f, 1.8f, 1.0f, 1.0f), + + // significantly lower lifespan, much higher production and mutation + MUTAGENIC("Mutagenic", 3, 1.0f, 5.0f, 0.0001f, 10.0f, 1.0f, 1.0f), + + // no mutation, much higher production and lifespan + WORKING("Working", 2000, 1.0f, 0.0f, 3.0f, 4.0f, 1.0f, 1.0f), + + // enhances decay to 10x + DECAYING("Decaying", 240, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 10.0f), + + // reduces mutation and production, enhances lifespan + SLOWING("Slowing", 175, 1.0f, 0.5f, 2.0f, 0.5f, 1.0f, 1.0f), + + // reduces mutation, production, and decay + STABILIZING("Stabilizing", 60, 1.0f, 0.1f, 1.0f, 0.1f, 1.0f, 0.5f), + + // 3x territory and lifespan, but no mutation and production + ARBORIST("Arborist", 240, 3.0f, 0.0f, 3.0f, 0.0f, 1.0f, 1.0f); + + private final String frameName; + public final int maxDamage; + private final float territoryMod; + private final float mutationMod; + private final float lifespanMod; + private final float productionMod; + private final float floweringMod; + private final float geneticDecayMod; + + GTFrameType(String name, int maxDamage, float territory, float mutation, float lifespan, float production, float flowering, float geneticDecay) { + this.frameName = name; + this.maxDamage = maxDamage; + this.territoryMod = territory; + this.mutationMod = mutation; + this.lifespanMod = lifespan; + this.productionMod = production; + this.floweringMod = flowering; + this.geneticDecayMod = geneticDecay; + } + + public String getName() { + return frameName; + } + + @Override + public float getTerritoryModifier(@Nullable IBeeGenome iBeeGenome, float v) { + return territoryMod; + } + + @Override + public float getMutationModifier(@Nullable IBeeGenome iBeeGenome, @Nullable IBeeGenome iBeeGenome1, float v) { + return mutationMod; + } + + @Override + public float getLifespanModifier(@Nullable IBeeGenome iBeeGenome, @Nullable IBeeGenome iBeeGenome1, float v) { + return lifespanMod; + } + + @Override + public float getProductionModifier(@Nullable IBeeGenome iBeeGenome, float v) { + return productionMod; + } + + @Override + public float getFloweringModifier(@Nullable IBeeGenome iBeeGenome, float v) { + return floweringMod; + } + + @Override + public float getGeneticDecay(@Nullable IBeeGenome iBeeGenome, float v) { + return geneticDecayMod; + } + + @Override + public boolean isSealed() { + return false; + } + + @Override + public boolean isSelfLighted() { + return false; + } + + @Override + public boolean isSunlightSimulated() { + return false; + } + + @Override + public boolean isHellish() { + return false; + } +} diff --git a/src/main/java/gregtech/integration/forestry/frames/GTItemFrame.java b/src/main/java/gregtech/integration/forestry/frames/GTItemFrame.java new file mode 100644 index 00000000000..2bf1b1d4638 --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/frames/GTItemFrame.java @@ -0,0 +1,68 @@ +package gregtech.integration.forestry.frames; + +import forestry.api.apiculture.IBee; +import forestry.api.apiculture.IBeeHousing; +import forestry.api.apiculture.IBeeModifier; +import forestry.api.apiculture.IHiveFrame; +import forestry.api.core.IItemModelRegister; +import forestry.api.core.IModelManager; +import forestry.api.core.Tabs; +import gregtech.api.GTValues; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public class GTItemFrame extends Item implements IHiveFrame, IItemModelRegister { + + private final GTFrameType type; + + public GTItemFrame(GTFrameType type) { + super(); + this.type = type; + this.setMaxDamage(this.type.maxDamage); + this.setMaxStackSize(1); + this.setCreativeTab(Tabs.tabApiculture); + this.setRegistryName(GTValues.MODID, "gt.frame_" + type.getName()); + this.setTranslationKey("gt.frame_" + type.getName().toLowerCase()); + } + + @SideOnly(Side.CLIENT) + @Override + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + // TODO + super.addInformation(stack, worldIn, tooltip, flagIn); + } + + @NotNull + @Override + public ItemStack frameUsed(@NotNull IBeeHousing housing, ItemStack frame, @NotNull IBee bee, int wear) { + frame.setItemDamage(frame.getItemDamage() + wear); + if (frame.getItemDamage() >= frame.getMaxDamage()) { + return ItemStack.EMPTY; + } + return frame; + } + + @NotNull + @Override + public IBeeModifier getBeeModifier() { + return this.type; + } + + @SuppressWarnings("deprecation") + @Override + public void registerModel(@NotNull Item item, @NotNull IModelManager manager) { + manager.registerItemModel(item, 0, GTValues.MODID_FR, "gt.frame_" + type.getName().toLowerCase()); + } + + public ItemStack getItemStack() { + return new ItemStack(this); + } +} diff --git a/src/main/java/gregtech/integration/forestry/recipes/CombRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/CombRecipes.java new file mode 100644 index 00000000000..f78f52ff6ca --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/recipes/CombRecipes.java @@ -0,0 +1,422 @@ +package gregtech.integration.forestry.recipes; + +import appeng.core.Api; +import com.google.common.collect.ImmutableMap; +import forestry.api.recipes.ICentrifugeRecipe; +import forestry.api.recipes.RecipeManagers; +import forestry.core.ModuleCore; +import forestry.factory.MachineUIDs; +import forestry.factory.ModuleFactory; +import gregtech.api.GTValues; +import gregtech.api.metatileentity.multiblock.CleanroomType; +import gregtech.api.recipes.RecipeBuilder; +import gregtech.api.recipes.RecipeMaps; +import gregtech.api.unification.OreDictUnifier; +import gregtech.api.unification.material.Material; +import gregtech.api.unification.material.Materials; +import gregtech.api.unification.material.info.MaterialFlags; +import gregtech.api.unification.material.properties.OreProperty; +import gregtech.api.unification.material.properties.PropertyKey; +import gregtech.api.unification.ore.OrePrefix; +import gregtech.api.util.GTUtility; +import gregtech.common.items.MetaItems; +import gregtech.integration.IntegrationUtil; +import gregtech.integration.forestry.ForestryUtil; +import gregtech.integration.forestry.bees.GTCombItem; +import gregtech.integration.forestry.bees.GTCombType; +import gregtech.integration.forestry.bees.GTDropType; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fml.common.Loader; + +import java.util.Arrays; +import java.util.Map; + +public class CombRecipes { + + public static void initForestryCombs() { + if (!ModuleFactory.machineEnabled(MachineUIDs.CENTRIFUGE)) return; + for (ICentrifugeRecipe recipe : RecipeManagers.centrifugeManager.recipes()) { + // For some reason Forestry occasionally has recipes that have no outputs at all, which will + // cause us to error. Discard these if we come across them. + if (recipe.getAllProducts().isEmpty()) continue; + + ItemStack combStack = recipe.getInput(); + if (combStack.getItem() instanceof GTCombItem) continue; + RecipeBuilder builder = RecipeMaps.CENTRIFUGE_RECIPES.recipeBuilder() + .inputs(combStack.copy()) + .duration(Voltage.ULV.getCentrifugeTime()).EUt(Voltage.ULV.getCentrifugeEnergy()); + + for (Map.Entry entry : recipe.getAllProducts().entrySet()) { + if (entry.getValue() >= 1.0f) { + builder.outputs(entry.getKey()); + } else { + builder.chancedOutput(entry.getKey(), Math.max(1, Math.round(entry.getValue() * 10000)), 0); + } + } + builder.buildAndRegister(); + } + } + + // forgive me for the code i am about to write + public static void initGTCombs() { + // Organic + addProcessGT(GTCombType.COAL, new Material[]{Materials.Coal}, Voltage.LV); + addProcessGT(GTCombType.COKE, new Material[]{Materials.Coke}, Voltage.LV); + addCentrifugeToItemStack(GTCombType.STICKY, new ItemStack[]{MetaItems.STICKY_RESIN.getStackForm(), MetaItems.PLANT_BALL.getStackForm(), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{50 * 100, 15 * 100, 50 * 100}, Voltage.ULV); + addProcessGT(GTCombType.OIL, new Material[]{Materials.Oilsands}, Voltage.LV); + addProcessGT(GTCombType.APATITE, new Material[]{Materials.Apatite, Materials.TricalciumPhosphate}, Voltage.LV); + addCentrifugeToMaterial(GTCombType.ASH, new Material[]{Materials.DarkAsh, Materials.Ash}, new int[]{50 * 100, 50 * 100}, new int[]{9, 9}, Voltage.ULV, ItemStack.EMPTY, 50 * 100); + addCentrifugeToItemStack(GTCombType.BIOMASS, new ItemStack[]{ForestryUtil.getDropStack(GTDropType.BIOMASS), ForestryUtil.getDropStack(GTDropType.ETHANOL), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{70 * 100, 30 * 100, 50 * 100}, Voltage.ULV); + addCentrifugeToItemStack(GTCombType.PHOSPHORUS, new ItemStack[]{OreDictUnifier.get(OrePrefix.dust, Materials.Phosphorus), OreDictUnifier.get(OrePrefix.dust, Materials.TricalciumPhosphate), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{100 * 100, 100 * 100, 100 * 100}, Voltage.HV); + addCentrifugeToItemStack(GTCombType.COAL, new ItemStack[]{OreDictUnifier.get(OrePrefix.gem, Materials.Coal), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{5 * 100, 50 * 100}, Voltage.ULV); + addCentrifugeToItemStack(GTCombType.COKE, new ItemStack[]{OreDictUnifier.get(OrePrefix.gem, Materials.Coke), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{5 * 100, 50 * 100}, Voltage.ULV); + addCentrifugeToItemStack(GTCombType.OIL, new ItemStack[]{OreDictUnifier.get(OrePrefix.dustTiny, Materials.Oilsands), ForestryUtil.getDropStack(GTDropType.OIL), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{70 * 100, 100 * 100, 50 * 100}, Voltage.ULV); + + // Industrial + addCentrifugeToItemStack(GTCombType.ENERGY, new ItemStack[]{MetaItems.ENERGIUM_DUST.getStackForm(), ModuleCore.getItems().refractoryWax.getItemStack()}, new int[]{20 * 100, 50 * 100}, Voltage.HV, 196); + ItemStack wax = ModuleCore.getItems().beeswax.getItemStack(); + if (Loader.isModLoaded(GTValues.MODID_MB)) { + wax = IntegrationUtil.getModItem(GTValues.MODID_MB, "wax", 2); + } + addCentrifugeToItemStack(GTCombType.LAPOTRON, new ItemStack[]{OreDictUnifier.get(OrePrefix.dust, Materials.Lapotron), wax}, new int[]{100 * 100, 40 * 100}, Voltage.HV, 196); + + // Alloy + addProcessGT(GTCombType.REDALLOY, new Material[]{Materials.RedAlloy, Materials.Redstone, Materials.Copper}, Voltage.LV); + addProcessGT(GTCombType.STAINLESSSTEEL, new Material[]{Materials.StainlessSteel, Materials.Iron, Materials.Chrome, Materials.Manganese, Materials.Nickel}, Voltage.HV); + addCentrifugeToMaterial(GTCombType.REDALLOY, new Material[]{Materials.RedAlloy}, new int[]{100 * 100}, new int[]{9}, Voltage.ULV, ModuleCore.getItems().refractoryWax.getItemStack(), 50 * 100); + addCentrifugeToMaterial(GTCombType.STAINLESSSTEEL, new Material[]{Materials.StainlessSteel}, new int[]{50 * 100}, new int[]{9}, Voltage.HV, ModuleCore.getItems().refractoryWax.getItemStack(), 50 * 100); + + // Gem + addProcessGT(GTCombType.STONE, new Material[]{Materials.Soapstone, Materials.Talc, Materials.Apatite, Materials.Phosphate, Materials.TricalciumPhosphate}, Voltage.LV); + addProcessGT(GTCombType.CERTUS, new Material[]{Materials.CertusQuartz, Materials.Quartzite, Materials.Barite}, Voltage.LV); + addProcessGT(GTCombType.REDSTONE, new Material[]{Materials.Redstone, Materials.Cinnabar}, Voltage.LV); + addCentrifugeToMaterial(GTCombType.RAREEARTH, new Material[]{Materials.RareEarth}, new int[]{100 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addProcessGT(GTCombType.LAPIS, new Material[]{Materials.Lapis, Materials.Sodalite, Materials.Lazurite, Materials.Calcite}, Voltage.LV); + addProcessGT(GTCombType.RUBY, new Material[]{Materials.Ruby, Materials.Redstone}, Voltage.LV); + addProcessGT(GTCombType.SAPPHIRE, new Material[]{Materials.Sapphire, Materials.GreenSapphire, Materials.Almandine, Materials.Pyrope}, Voltage.LV); + addProcessGT(GTCombType.DIAMOND, new Material[]{Materials.Diamond, Materials.Graphite}, Voltage.LV); + addProcessGT(GTCombType.OLIVINE, new Material[]{Materials.Olivine, Materials.Bentonite, Materials.Magnesite, Materials.GlauconiteSand}, Voltage.LV); + addProcessGT(GTCombType.EMERALD, new Material[]{Materials.Emerald, Materials.Beryllium, Materials.Thorium}, Voltage.LV); + addProcessGT(GTCombType.PYROPE, new Material[]{Materials.Pyrope, Materials.Aluminium, Materials.Magnesium, Materials.Silicon}, Voltage.LV); + addProcessGT(GTCombType.GROSSULAR, new Material[]{Materials.Grossular, Materials.Aluminium, Materials.Silicon}, Voltage.LV); + addCentrifugeToMaterial(GTCombType.STONE, new Material[]{Materials.Stone, Materials.GraniteBlack, Materials.GraniteRed, Materials.Basalt, Materials.Marble}, new int[]{70 * 100, 50 * 100, 50 * 100, 50 * 100, 50 * 100}, new int[]{9, 9, 9, 9, 9}, Voltage.ULV, ItemStack.EMPTY, 50 * 100); + + // Metals + addProcessGT(GTCombType.COPPER, new Material[]{Materials.Copper, Materials.Tetrahedrite, Materials.Chalcopyrite, Materials.Malachite, Materials.Pyrite, Materials.Stibnite}, Voltage.LV); + addProcessGT(GTCombType.TIN, new Material[]{Materials.Tin, Materials.Cassiterite, Materials.CassiteriteSand}, Voltage.LV); + addProcessGT(GTCombType.LEAD, new Material[]{Materials.Lead, Materials.Galena}, Voltage.LV); + addProcessGT(GTCombType.NICKEL, new Material[]{Materials.Nickel, Materials.Garnierite, Materials.Pentlandite, Materials.Cobaltite, Materials.Wulfenite, Materials.Powellite}, Voltage.LV); + addProcessGT(GTCombType.ZINC, new Material[]{Materials.Sphalerite, Materials.Sulfur}, Voltage.LV); + addProcessGT(GTCombType.SILVER, new Material[]{Materials.Silver, Materials.Galena}, Voltage.LV); + addProcessGT(GTCombType.GOLD, new Material[]{Materials.Gold, Materials.Magnetite}, Voltage.LV); + addProcessGT(GTCombType.SULFUR, new Material[]{Materials.Sulfur, Materials.Pyrite, Materials.Sphalerite}, Voltage.LV); + addProcessGT(GTCombType.GALLIUM, new Material[]{Materials.Gallium, Materials.Niobium}, Voltage.LV); + addProcessGT(GTCombType.ARSENIC, new Material[]{Materials.Realgar, Materials.Cassiterite, Materials.Zeolite}, Voltage.LV); + addProcessGT(GTCombType.IRON, new Material[]{Materials.Iron, Materials.Magnetite, Materials.BrownLimonite, Materials.YellowLimonite, Materials.VanadiumMagnetite, Materials.BandedIron, Materials.Pyrite}, Voltage.LV); + + addCentrifugeToMaterial(GTCombType.SLAG, new Material[]{Materials.Stone, Materials.GraniteBlack, Materials.GraniteRed}, new int[]{50 * 100, 20 * 100, 20 * 100}, new int[]{9, 9, 9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addCentrifugeToMaterial(GTCombType.COPPER, new Material[]{Materials.Copper}, new int[]{70 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addCentrifugeToMaterial(GTCombType.TIN, new Material[]{Materials.Tin}, new int[]{60 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addCentrifugeToMaterial(GTCombType.LEAD, new Material[]{Materials.Lead}, new int[]{45 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addCentrifugeToMaterial(GTCombType.IRON, new Material[]{Materials.Iron}, new int[]{30 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addCentrifugeToMaterial(GTCombType.STEEL, new Material[]{Materials.Steel}, new int[]{40 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addCentrifugeToMaterial(GTCombType.SILVER, new Material[]{Materials.Silver}, new int[]{80 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + + // Rare Metals + addProcessGT(GTCombType.BAUXITE, new Material[]{Materials.Bauxite, Materials.Aluminium}, Voltage.LV); + addProcessGT(GTCombType.ALUMINIUM, new Material[]{Materials.Aluminium, Materials.Bauxite}, Voltage.LV); + addProcessGT(GTCombType.MANGANESE, new Material[]{Materials.Manganese, Materials.Grossular, Materials.Spessartine, Materials.Pyrolusite, Materials.Tantalite}, Voltage.LV); + addProcessGT(GTCombType.TITANIUM, new Material[]{Materials.Titanium, Materials.Ilmenite, Materials.Bauxite, Materials.Rutile}, Voltage.EV); + addProcessGT(GTCombType.MAGNESIUM, new Material[]{Materials.Magnesium, Materials.Magnesite}, Voltage.LV); + addProcessGT(GTCombType.CHROME, new Material[]{Materials.Chrome, Materials.Ruby, Materials.Chromite, Materials.Redstone, Materials.Neodymium, Materials.Bastnasite}, Voltage.HV); + addProcessGT(GTCombType.TUNGSTEN, new Material[]{Materials.Tungsten, Materials.Tungstate, Materials.Scheelite, Materials.Lithium}, Voltage.IV); + addProcessGT(GTCombType.PLATINUM, new Material[]{Materials.Platinum, Materials.Cooperite, Materials.Palladium}, Voltage.HV); + addProcessGT(GTCombType.MOLYBDENUM, new Material[]{Materials.Molybdenum, Materials.Molybdenite, Materials.Powellite, Materials.Wulfenite}, Voltage.LV); + addProcessGT(GTCombType.LITHIUM, new Material[]{Materials.Lithium, Materials.Lepidolite, Materials.Spodumene}, Voltage.MV); + addProcessGT(GTCombType.SALT, new Material[]{Materials.Salt, Materials.RockSalt, Materials.Saltpeter}, Voltage.MV); + addProcessGT(GTCombType.ELECTROTINE, new Material[]{Materials.Electrotine, Materials.Electrum, Materials.Redstone}, Voltage.MV); + addCentrifugeToMaterial(GTCombType.SALT, new Material[]{Materials.Salt, Materials.RockSalt, Materials.Saltpeter}, new int[]{100 * 100, 100 * 100, 25 * 100}, new int[]{9 * 6, 9 * 6, 9 * 6}, Voltage.MV, 160, ItemStack.EMPTY, 50 * 100); + + // Special Iridium Recipe + RecipeMaps.CHEMICAL_RECIPES.recipeBuilder() + .inputs(ForestryUtil.getCombStack(GTCombType.IRIDIUM, 4)) + .fluidInputs(Voltage.IV.getFluid()) + .output(OrePrefix.nugget, Materials.Iridium) + .output(OrePrefix.dust, Materials.IridiumMetalResidue, 5) + .cleanroom(CleanroomType.CLEANROOM) + .duration(1000).EUt(Voltage.IV.getChemicalEnergy()) + .buildAndRegister(); + + // Special Osmium Recipe + RecipeMaps.CHEMICAL_RECIPES.recipeBuilder() + .inputs(ForestryUtil.getCombStack(GTCombType.OSMIUM, 4)) + .fluidInputs(Voltage.IV.getFluid()) + .output(OrePrefix.nugget, Materials.Osmium) + .fluidOutputs(Materials.AcidicOsmiumSolution.getFluid(2000)) + .cleanroom(CleanroomType.CLEANROOM) + .duration(1000).EUt(Voltage.IV.getChemicalEnergy()) + .buildAndRegister(); + + // Special Indium Recipe + RecipeMaps.CHEMICAL_RECIPES.recipeBuilder() + .input(OrePrefix.dust, Materials.Aluminium, 4) + .inputs(ForestryUtil.getCombStack(GTCombType.INDIUM)) + .fluidInputs(Materials.IndiumConcentrate.getFluid(1000)) + .output(OrePrefix.dustSmall, Materials.Indium, 2) + .output(OrePrefix.dust, Materials.AluminiumSulfite, 4) + .fluidOutputs(Materials.LeadZincSolution.getFluid(1000)) + .duration(50).EUt(600).buildAndRegister(); + + // Radioactive + addProcessGT(GTCombType.ALMANDINE, new Material[]{Materials.Almandine, Materials.Pyrope, Materials.Sapphire, Materials.GreenSapphire}, Voltage.LV); + addProcessGT(GTCombType.URANIUM, new Material[]{Materials.Uranium238, Materials.Pitchblende, Materials.Uraninite, Materials.Uranium235}, Voltage.EV); + addProcessGT(GTCombType.PLUTONIUM, new Material[]{Materials.Plutonium239, Materials.Uranium235}, Voltage.EV); + addProcessGT(GTCombType.NAQUADAH, new Material[]{Materials.Naquadah, Materials.NaquadahEnriched, Materials.Naquadria}, Voltage.IV); + addProcessGT(GTCombType.NAQUADRIA, new Material[]{Materials.Naquadria, Materials.NaquadahEnriched, Materials.Naquadah}, Voltage.LUV); + addProcessGT(GTCombType.THORIUM, new Material[]{Materials.Thorium, Materials.Uranium238, Materials.Coal}, Voltage.EV); + addProcessGT(GTCombType.LUTETIUM, new Material[]{Materials.Lutetium, Materials.Thorium}, Voltage.IV); + addProcessGT(GTCombType.AMERICIUM, new Material[]{Materials.Americium, Materials.Lutetium}, Voltage.LUV); + addProcessGT(GTCombType.TRINIUM, new Material[]{Materials.Trinium, Materials.Naquadah, Materials.Naquadria}, Voltage.ZPM); + + // Special Neutronium Recipe + RecipeMaps.CHEMICAL_RECIPES.recipeBuilder() + .inputs(ForestryUtil.getCombStack(GTCombType.NEUTRONIUM, 4)) + .fluidInputs(Voltage.UV.getFluid()) + .output(OrePrefix.nugget, Materials.Neutronium) + .fluidOutputs(Materials.Neutronium.getFluid(GTValues.L * 4)) + .cleanroom(CleanroomType.CLEANROOM) + .duration(3000).EUt(Voltage.UV.getChemicalEnergy()).buildAndRegister(); + + if (Loader.isModLoaded(GTValues.MODID_MB)) { + addProcessGT(GTCombType.SPARKLING, new Material[]{Materials.NetherStar}, Voltage.EV); + addCentrifugeToItemStack(GTCombType.SPARKLING, new ItemStack[]{IntegrationUtil.getModItem(GTValues.MODID_MB, "wax", 0), IntegrationUtil.getModItem(GTValues.MODID_MB, "resource", 5), OreDictUnifier.get(OrePrefix.dustTiny, Materials.NetherStar)}, new int[]{50 * 100, 10 * 100, 10 * 100}, Voltage.EV); + } + + addExtractorProcess(GTCombType.HELIUM, Materials.Helium.getFluid(250), Voltage.HV, 100); + addExtractorProcess(GTCombType.ARGON, Materials.Argon.getFluid(250), Voltage.MV, 100); + addExtractorProcess(GTCombType.XENON, Materials.Xenon.getFluid(250), Voltage.IV, 50); + addExtractorProcess(GTCombType.NEON, Materials.Neon.getFluid(250), Voltage.IV, 15); + addExtractorProcess(GTCombType.KRYPTON, Materials.Krypton.getFluid(250), Voltage.IV, 25); + addExtractorProcess(GTCombType.NITROGEN, Materials.Nitrogen.getFluid(500), Voltage.MV, 100); + addExtractorProcess(GTCombType.OXYGEN, Materials.Oxygen.getFluid(500), Voltage.MV, 100); + addExtractorProcess(GTCombType.HYDROGEN, Materials.Hydrogen.getFluid(500), Voltage.MV, 100); + addExtractorProcess(GTCombType.FLUORINE, Materials.Fluorine.getFluid(250), Voltage.MV, 128); + + if (Loader.isModLoaded(GTValues.MODID_APPENG)) { + ItemStack fluixDust = OreDictUnifier.get("dustFluix"); + if (fluixDust == ItemStack.EMPTY) { + fluixDust = Api.INSTANCE.definitions().materials().fluixDust().maybeStack(1).orElse(ItemStack.EMPTY); + } + if (fluixDust != ItemStack.EMPTY) { + addCentrifugeToItemStack(GTCombType.FLUIX, new ItemStack[]{fluixDust, ModuleCore.getItems().beeswax.getItemStack()}, new int[]{25 * 100, 30 * 100}, Voltage.ULV); + } + } + } + + private static void addChemicalProcess(GTCombType comb, Material inMaterial, Material outMaterial, Voltage volt) { + if (OreDictUnifier.get(OrePrefix.crushedPurified, outMaterial, 4).isEmpty() || OreDictUnifier.get(OrePrefix.crushed, inMaterial).isEmpty() || inMaterial.hasFlag(MaterialFlags.DISABLE_ORE_BLOCK)) + return; + + RecipeBuilder builder = RecipeMaps.CHEMICAL_RECIPES.recipeBuilder() + .inputs(GTUtility.copy(9, ForestryUtil.getCombStack(comb))) + .input(OrePrefix.crushed, inMaterial) + .fluidInputs(volt.getFluid()) + .output(OrePrefix.crushedPurified, outMaterial, 4) + .duration(volt.getChemicalTime()) + .EUt(volt.getChemicalEnergy()); + + OreProperty property = inMaterial.getProperty(PropertyKey.ORE); + if (property != null && !property.getOreByProducts().isEmpty()) { + Material byproduct = property.getOreByProducts().get(0); + if (byproduct != null && byproduct.hasProperty(PropertyKey.FLUID)) { + if (!byproduct.hasProperty(PropertyKey.BLAST)) { + builder.fluidOutputs(byproduct.getFluid(GTValues.L)); + } + } + } + + if (volt.compareTo(Voltage.IV) > 0) { + builder.cleanroom(CleanroomType.CLEANROOM); + } + builder.buildAndRegister(); + } + + /** + * Currently only used separately for GTCombType.MOLYBDENUM + * + * @param circuitNumber should not conflict with addProcessGT + **/ + private static void addAutoclaveProcess(GTCombType comb, Material material, Voltage volt, int circuitNumber) { + if (OreDictUnifier.get(OrePrefix.crushedPurified, material, 4).isEmpty()) return; + + RecipeBuilder builder = RecipeMaps.AUTOCLAVE_RECIPES.recipeBuilder() + .inputs(GTUtility.copy(9, ForestryUtil.getCombStack(comb))) + .circuitMeta(circuitNumber) + .fluidInputs(Materials.Mutagen.getFluid((int) Math.max(1, material.getMass() + volt.getMutagenAmount()))) + .output(OrePrefix.crushedPurified, material, 4) + .duration((int) (material.getMass() * 128)) + .EUt(volt.getAutoclaveEnergy()); + + if (volt.compareTo(Voltage.HV) > 0) { + builder.cleanroom(CleanroomType.CLEANROOM); + } + builder.buildAndRegister(); + } + + private static void addExtractorProcess(GTCombType comb, FluidStack fluidStack, Voltage volt, int duration) { + RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder() + .inputs(ForestryUtil.getCombStack(comb)) + .fluidOutputs(fluidStack) + .duration(duration) + .EUt(volt.getCentrifugeEnergy() / 2) + .buildAndRegister(); + } + + /** + * this only adds Chemical and AutoClave process. + * If you need Centrifuge recipe. use addCentrifugeToMaterial or addCentrifugeToItemStack + * + * @param volt This determines the required Tier of process for these recipes. This decides the required aEU/t, progress time, required additional Mutagen, requirement of cleanRoom, needed fluid stack for Chemical. + * @param material result of Material that should be generated by this process. + **/ + private static void addProcessGT(GTCombType comb, Material[] material, Voltage volt) { + for (int i = 0; i < material.length; i++) { + addChemicalProcess(comb, material[i], material[i], volt); + addAutoclaveProcess(comb, material[i], volt, i + 1); + } + } + + /** + * this method only adds Centrifuge based on Material. If volt is lower than MV than it will also add forestry centrifuge recipe. + * + * @param comb BeeComb + * @param material resulting Material of processing. must be less than or equal to 9. + * @param chance chance to get result, 10000 == 100% + * @param volt required Voltage Tier for this recipe, this also affect the duration, amount of Mutagen, and needed liquid type and amount for chemical reactor + * @param stackSize This parameter can be null, in that case stack size will be just 1. This handle the stackSize of the resulting Item, and Also the Type of Item. if this value is multiple of 9, than related Material output will be dust, if this value is multiple of 4 than output will be Small dust, else the output will be Tiny dust + * @param beeWax if this is null, then the comb will product default Bee wax. But if material is more than 5, beeWax will be ignored in Gregtech Centrifuge. + * @param waxChance have same format like "chance" + **/ + private static void addCentrifugeToMaterial(GTCombType comb, Material[] material, int[] chance, int[] stackSize, Voltage volt, ItemStack beeWax, int waxChance) { + addCentrifugeToMaterial(comb, material, chance, stackSize, volt, volt.getCentrifugeTime(), beeWax, waxChance); + } + + private static void addCentrifugeToMaterial(GTCombType comb, Material[] material, int[] chance, int[] stackSize, Voltage volt, int duration, ItemStack beeWax, int waxChance) { + ItemStack[] output = new ItemStack[material.length + 1]; + stackSize = Arrays.copyOf(stackSize, material.length); + chance = Arrays.copyOf(chance, output.length); + chance[chance.length - 1] = waxChance; + for (int i = 0; i < material.length; i++) { + if (chance[i] == 0) continue; + + if (Math.max(1, stackSize[i]) % 9 == 0) { + output[i] = OreDictUnifier.get(OrePrefix.dust, material[i], Math.max(1, stackSize[i]) / 9); + } else if (Math.max(1, stackSize[i]) % 4 == 0) { + output[i] = OreDictUnifier.get(OrePrefix.dustSmall, material[i], Math.max(1, stackSize[i]) / 4); + } else { + output[i] = OreDictUnifier.get(OrePrefix.dustTiny, material[i], Math.max(1, stackSize[i])); + } + } + if (beeWax != ItemStack.EMPTY) { + output[output.length - 1] = beeWax; + } else { + output[output.length - 1] = ModuleCore.getItems().beeswax.getItemStack(); + } + + addCentrifugeToItemStack(comb, output, chance, volt, duration); + } + + /** + * @param volt required Tier of system. If it's lower than MV, it will also add forestry centrifuge. + * @param item must be less than or equal to 9. + **/ + private static void addCentrifugeToItemStack(GTCombType comb, ItemStack[] item, int[] chance, Voltage volt) { + addCentrifugeToItemStack(comb, item, chance, volt, volt.getCentrifugeTime()); + } + + private static void addCentrifugeToItemStack(GTCombType comb, ItemStack[] item, int[] chance, Voltage volt, int duration) { + ItemStack combStack = ForestryUtil.getCombStack(comb); + + // Start of the Forestry Map + ImmutableMap.Builder product = new ImmutableMap.Builder<>(); + // Start of the GregTech Map + RecipeBuilder builder = RecipeMaps.CENTRIFUGE_RECIPES.recipeBuilder() + .inputs(combStack) + .duration(duration) + .EUt(volt.getCentrifugeEnergy()); + + int numGTOutputs = 0; + for (int i = 0; i < item.length; i++) { + if (item[i] == null || item[i] == ItemStack.EMPTY) continue; + // Add to Forestry Map + product.put(item[i], chance[i] / 10000.0f); + // Add to GregTech Map + if (numGTOutputs < RecipeMaps.CENTRIFUGE_RECIPES.getMaxOutputs()) { + if (chance[i] >= 10000) { + builder.outputs(item[i]); + } else { + builder.chancedOutput(item[i], chance[i], 0); + } + numGTOutputs++; + } + } + + // Finalize Forestry Map + if (volt.compareTo(Voltage.MV) < 0) { + if (ModuleFactory.machineEnabled(MachineUIDs.CENTRIFUGE)) { + RecipeManagers.centrifugeManager.addRecipe(duration, combStack, product.build()); + } + } + // Finalize GregTech Map + builder.buildAndRegister(); + } + + private enum Voltage { + ULV, LV, MV, HV, EV, IV, LUV, ZPM, UV, UHV, UEV, UIV, UXV, OPV, MAX; + + public int getVoltage() { + return (int) GTValues.V[ordinal()]; + } + + public int getChemicalEnergy() { + return getVoltage() * 3 / 4; + } + + public int getAutoclaveEnergy() { + return (int) ((getVoltage() * 3 / 4) * Math.max(1, Math.pow(2, 5 - ordinal()))); + } + + public int getCentrifugeEnergy() { + return this == Voltage.ULV ? 5 : (getVoltage() / 16) * 15; + } + + public int getChemicalTime() { + return 64 + ordinal() * 32; + } + + public int getCentrifugeTime() { + return 128 * (Math.max(1, ordinal())); + } + + public FluidStack getFluid() { + if (this.compareTo(Voltage.MV) < 0) { + return Materials.Water.getFluid((this.compareTo(Voltage.ULV) > 0) ? 1000 : 500); + } else if (this.compareTo(Voltage.HV) < 0) { + return Materials.DistilledWater.getFluid(1000); + } else if (this.compareTo(Voltage.EV) < 0) { + return Materials.SulfuricAcid.getFluid(125); + } else if (this.compareTo(Voltage.IV) < 0) { + return Materials.HydrochloricAcid.getFluid(125); + } else if (this.compareTo(Voltage.LUV) < 0) { + return Materials.HydrofluoricAcid.getFluid((int) (Math.pow(2, this.compareTo(Voltage.HV)) * 125)); + } else { + return Materials.FluoroantimonicAcid.getFluid((int) (Math.pow(2, this.compareTo(Voltage.LUV)) * 125)); + } + } + + public int getMutagenAmount() { + return 9 * ((this.compareTo(Voltage.MV) < 0) ? 10 : 10 * this.compareTo(Voltage.MV)); + } + } +} diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryElectrodeRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryElectrodeRecipes.java new file mode 100644 index 00000000000..40be7c4dc01 --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryElectrodeRecipes.java @@ -0,0 +1,322 @@ +package gregtech.integration.forestry.recipes; + +import forestry.api.recipes.RecipeManagers; +import forestry.core.ModuleCore; +import forestry.core.fluids.Fluids; +import forestry.core.items.EnumElectronTube; +import forestry.core.items.ItemElectronTube; +import forestry.factory.MachineUIDs; +import forestry.factory.ModuleFactory; +import forestry.factory.recipes.FabricatorRecipeManager; +import gregtech.api.GTValues; +import gregtech.api.unification.stack.UnificationEntry; +import gregtech.integration.forestry.ForestryModule; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fml.common.Loader; + +import static gregtech.api.recipes.RecipeMaps.CIRCUIT_ASSEMBLER_RECIPES; +import static gregtech.api.recipes.RecipeMaps.FORMING_PRESS_RECIPES; +import static gregtech.api.unification.material.Materials.*; +import static gregtech.api.unification.ore.OrePrefix.*; + +public class ForestryElectrodeRecipes { + + public static void onRecipeEvent() { + addGregTechMachineRecipes(); + } + + public static void onInit() { + removeForestryRecipes(); + addForestryMachineRecipes(); + } + + public static void addGregTechMachineRecipes() { + CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) + .input(ForestryModule.ELECTRODE_APATITE) + .fluidInputs(Glass.getFluid(100)) + .outputs(ModuleCore.getItems().tubes.get(EnumElectronTube.APATITE, 1)) + .buildAndRegister(); + + FORMING_PRESS_RECIPES.recipeBuilder().duration(200).EUt(24) + .input(stick, Apatite, 4) + .input(bolt, Apatite, 2) + .input(dust, Redstone) + .output(ForestryModule.ELECTRODE_APATITE, 2) + .buildAndRegister(); + + CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) + .input(ForestryModule.ELECTRODE_BLAZE) + .fluidInputs(Glass.getFluid(100)) + .outputs(ModuleCore.getItems().tubes.get(EnumElectronTube.BLAZE, 1)) + .buildAndRegister(); + + FORMING_PRESS_RECIPES.recipeBuilder().duration(400).EUt(24) + .input(dust, Blaze, 5) + .input(dust, Redstone, 2) + .output(ForestryModule.ELECTRODE_BLAZE, 4) + .buildAndRegister(); + + CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) + .input(ForestryModule.ELECTRODE_BRONZE) + .fluidInputs(Glass.getFluid(100)) + .outputs(ModuleCore.getItems().tubes.get(EnumElectronTube.BRONZE, 1)) + .buildAndRegister(); + + FORMING_PRESS_RECIPES.recipeBuilder().duration(200).EUt(24) + .input(stick, Bronze, 4).input(bolt, Bronze, 2) + .input(dust, Redstone) + .output(ForestryModule.ELECTRODE_BRONZE, 2) + .buildAndRegister(); + + CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) + .input(ForestryModule.ELECTRODE_COPPER) + .fluidInputs(Glass.getFluid(100)) + .outputs(ModuleCore.getItems().tubes.get(EnumElectronTube.COPPER, 1)) + .buildAndRegister(); + + FORMING_PRESS_RECIPES.recipeBuilder().duration(200).EUt(24) + .input(stick, Copper, 4) + .input(bolt, Copper, 2) + .input(dust, Redstone) + .output(ForestryModule.ELECTRODE_COPPER, 2) + .buildAndRegister(); + + CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) + .input(ForestryModule.ELECTRODE_DIAMOND) + .fluidInputs(Glass.getFluid(100)) + .outputs(ModuleCore.getItems().tubes.get(EnumElectronTube.DIAMOND, 1)) + .buildAndRegister(); + + FORMING_PRESS_RECIPES.recipeBuilder().duration(200).EUt(24) + .input(stick, Diamond, 4) + .input(bolt, Diamond, 2) + .input(dust, Redstone) + .output(ForestryModule.ELECTRODE_DIAMOND, 2) + .buildAndRegister(); + + CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) + .input(ForestryModule.ELECTRODE_EMERALD) + .fluidInputs(Glass.getFluid(100)) + .outputs(ModuleCore.getItems().tubes.get(EnumElectronTube.EMERALD, 1)) + .buildAndRegister(); + + FORMING_PRESS_RECIPES.recipeBuilder().duration(200).EUt(24) + .input(stick, Emerald, 4) + .input(bolt, Emerald, 2) + .input(dust, Redstone) + .output(ForestryModule.ELECTRODE_EMERALD, 2) + .buildAndRegister(); + + CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) + .input(ForestryModule.ELECTRODE_ENDER) + .fluidInputs(Glass.getFluid(100)) + .outputs(ModuleCore.getItems().tubes.get(EnumElectronTube.ENDER, 1)) + .buildAndRegister(); + + FORMING_PRESS_RECIPES.recipeBuilder().duration(400).EUt(24) + .input(dust, Endstone, 5) + .input(dust, EnderEye, 2) + .output(ForestryModule.ELECTRODE_ENDER, 4) + .buildAndRegister(); + + CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) + .input(ForestryModule.ELECTRODE_GOLD) + .fluidInputs(Glass.getFluid(100)) + .outputs(ModuleCore.getItems().tubes.get(EnumElectronTube.GOLD, 1)) + .buildAndRegister(); + + FORMING_PRESS_RECIPES.recipeBuilder().duration(200).EUt(24) + .input(stick, Gold, 4) + .input(bolt, Gold, 2) + .input(dust, Redstone) + .output(ForestryModule.ELECTRODE_GOLD, 2) + .buildAndRegister(); + + if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_BINNIE)) { + CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) + .input(ForestryModule.ELECTRODE_IRON) + .fluidInputs(Glass.getFluid(100)) + .outputs(ModuleCore.getItems().tubes.get(EnumElectronTube.IRON, 1)) + .buildAndRegister(); + + FORMING_PRESS_RECIPES.recipeBuilder().duration(200).EUt(24) + .input(stick, Iron, 4).input(bolt, Iron, 2) + .input(dust, Redstone) + .output(ForestryModule.ELECTRODE_IRON, 2) + .buildAndRegister(); + + } + CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) + .input(ForestryModule.ELECTRODE_LAPIS) + .fluidInputs(Glass.getFluid(100)) + .outputs(ModuleCore.getItems().tubes.get(EnumElectronTube.LAPIS, 1)) + .buildAndRegister(); + + FORMING_PRESS_RECIPES.recipeBuilder().duration(200).EUt(24) + .input(stick, Lapis, 4) + .input(bolt, Lapis, 2) + .input(dust, Redstone) + .output(ForestryModule.ELECTRODE_LAPIS, 2) + .buildAndRegister(); + + CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) + .input(ForestryModule.ELECTRODE_OBSIDIAN) + .fluidInputs(Glass.getFluid(100)) + .outputs(ModuleCore.getItems().tubes.get(EnumElectronTube.OBSIDIAN, 1)) + .buildAndRegister(); + + FORMING_PRESS_RECIPES.recipeBuilder().duration(400).EUt(24) + .input(dust, Obsidian, 5) + .input(dust, Redstone, 2) + .output(ForestryModule.ELECTRODE_OBSIDIAN, 4) + .buildAndRegister(); + + if (Loader.isModLoaded(GTValues.MODID_XU2)) { + CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) + .input(ForestryModule.ELECTRODE_ORCHID) + .fluidInputs(Glass.getFluid(100)) + .outputs(ModuleCore.getItems().tubes.get(EnumElectronTube.ORCHID, 1)) + .buildAndRegister(); + + FORMING_PRESS_RECIPES.recipeBuilder().duration(400).EUt(24) + .inputs(new ItemStack(Blocks.REDSTONE_ORE, 5)) + .input(dust, Redstone) + .output(ForestryModule.ELECTRODE_ORCHID, 4) + .buildAndRegister(); + } + + // todo mixin forestry to allow this tube always, since we have rubber (once mixin port is done) + if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_TR) || Loader.isModLoaded(GTValues.MODID_BINNIE)) { + CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) + .input(ForestryModule.ELECTRODE_RUBBER) + .fluidInputs(Glass.getFluid(100)) + .outputs(ModuleCore.getItems().tubes.get(EnumElectronTube.RUBBER, 1)) + .buildAndRegister(); + + FORMING_PRESS_RECIPES.recipeBuilder().duration(200).EUt(24) + .input(stick, Rubber, 4) + .input(bolt, Rubber, 2) + .input(dust, Redstone) + .output(ForestryModule.ELECTRODE_RUBBER, 2) + .buildAndRegister(); + } + CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) + .input(ForestryModule.ELECTRODE_TIN) + .fluidInputs(Glass.getFluid(100)) + .outputs(ModuleCore.getItems().tubes.get(EnumElectronTube.TIN, 1)) + .buildAndRegister(); + + FORMING_PRESS_RECIPES.recipeBuilder().duration(200).EUt(24) + .input(stick, Tin, 4) + .input(bolt, Tin, 2) + .input(dust, Redstone) + .output(ForestryModule.ELECTRODE_TIN, 2) + .buildAndRegister(); + } + + private static void removeForestryRecipes() { + if (ModuleFactory.machineEnabled(MachineUIDs.FABRICATOR)) { + ItemElectronTube electronTube = ModuleCore.getItems().tubes; + for (EnumElectronTube tube : EnumElectronTube.VALUES) { + removeFabricatorRecipe(electronTube.get(tube, 4)); + } + } + } + + private static void addForestryMachineRecipes() { + addFabricatorRecipe(EnumElectronTube.COPPER, + "SXS", "#X#", "XXX", + 'S', new UnificationEntry(screw, Copper).toString(), + '#', new UnificationEntry(wireGtSingle, RedAlloy).toString(), + 'X', new UnificationEntry(plate, Copper).toString()); + + addFabricatorRecipe(EnumElectronTube.TIN, + "SXS", "#X#", "XXX", + 'S', new UnificationEntry(screw, Tin).toString(), + '#', new UnificationEntry(wireGtSingle, RedAlloy).toString(), + 'X', new UnificationEntry(plate, Tin).toString()); + + addFabricatorRecipe(EnumElectronTube.BRONZE, + "SXS", "#X#", "XXX", + 'S', new UnificationEntry(screw, Bronze).toString(), + '#', new UnificationEntry(wireGtSingle, RedAlloy).toString(), + 'X', new UnificationEntry(plate, Bronze).toString()); + + if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_BINNIE)) { + addFabricatorRecipe(EnumElectronTube.IRON, + "SXS", "#X#", "XXX", + 'S', new UnificationEntry(screw, Iron).toString(), + '#', new UnificationEntry(wireGtSingle, RedAlloy).toString(), + 'X', new UnificationEntry(plate, Iron).toString()); + } + + addFabricatorRecipe(EnumElectronTube.GOLD, + "SXS", "#X#", "XXX", + 'S', new UnificationEntry(screw, Gold).toString(), + '#', new UnificationEntry(wireGtSingle, RedAlloy).toString(), + 'X', new UnificationEntry(plate, Gold).toString()); + + addFabricatorRecipe(EnumElectronTube.DIAMOND, + "SXS", "#X#", "XXX", + 'S', new UnificationEntry(screw, Diamond).toString(), + '#', new UnificationEntry(wireGtSingle, RedAlloy).toString(), + 'X', new UnificationEntry(plate, Gold).toString()); + + addFabricatorRecipe(EnumElectronTube.OBSIDIAN, + " X ", "#X#", "XXX", + '#', new UnificationEntry(wireGtSingle, RedAlloy).toString(), + 'X', new UnificationEntry(plate, Obsidian).toString()); + + addFabricatorRecipe(EnumElectronTube.BLAZE, + " X ", "#X#", "XXX", + '#', new UnificationEntry(wireGtSingle, RedAlloy).toString(), + 'X', new ItemStack(Items.BLAZE_POWDER)); + + addFabricatorRecipe(EnumElectronTube.EMERALD, + "SXS", "#X#", "XXX", + 'S', new UnificationEntry(screw, Emerald).toString(), + '#', new UnificationEntry(wireGtSingle, RedAlloy).toString(), + 'X', new UnificationEntry(plate, Emerald).toString()); + + addFabricatorRecipe(EnumElectronTube.APATITE, + "SXS", "#X#", "XXX", + 'S', new UnificationEntry(screw, Apatite).toString(), + '#', new UnificationEntry(wireGtSingle, RedAlloy).toString(), + 'X', new UnificationEntry(plate, Apatite).toString()); + + addFabricatorRecipe(EnumElectronTube.LAPIS, + "SXS", "#X#", "XXX", + 'S', new UnificationEntry(screw, Lapis).toString(), + '#', new UnificationEntry(wireGtSingle, RedAlloy).toString(), + 'X', new UnificationEntry(plate, Lapis).toString()); + + addFabricatorRecipe(EnumElectronTube.ENDER, + " X ", "#X#", "XXX", + '#', new UnificationEntry(plate, EnderEye).toString(), + 'X', new ItemStack(Blocks.END_STONE)); + + if (Loader.isModLoaded(GTValues.MODID_XU2)) { + addFabricatorRecipe(EnumElectronTube.ORCHID, + " X ", "#X#", "XXX", + '#', new ItemStack(Items.REPEATER), + 'X', new ItemStack(Blocks.REDSTONE_ORE)); + } + + // todo rubber + } + + private static void removeFabricatorRecipe(ItemStack stack) { + FabricatorRecipeManager.getRecipes(stack).forEach(r -> RecipeManagers.fabricatorManager.removeRecipe(r)); + } + + private static void addFabricatorRecipe(EnumElectronTube tube, Object... recipe) { + ItemElectronTube electronTube = ModuleCore.getItems().tubes; + FluidStack liquidGlass = Fluids.GLASS.getFluid(500); + if (liquidGlass != null && ModuleFactory.machineEnabled(MachineUIDs.FABRICATOR)) { + RecipeManagers.fabricatorManager.addRecipe(ItemStack.EMPTY, liquidGlass, electronTube.get(tube, 2), recipe); + } + } +} diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryExtractorRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryExtractorRecipes.java new file mode 100644 index 00000000000..148be3f207b --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryExtractorRecipes.java @@ -0,0 +1,167 @@ +package gregtech.integration.forestry.recipes; + +import forestry.core.fluids.Fluids; +import gregtech.api.GTValues; +import gregtech.api.recipes.RecipeBuilder; +import gregtech.api.recipes.RecipeMaps; +import gregtech.api.unification.material.Materials; +import gregtech.api.util.GTUtility; +import gregtech.integration.IntegrationUtil; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fml.common.Loader; + +public class ForestryExtractorRecipes { + + public static void init() { + + // Commonly used items + ItemStack mulch = IntegrationUtil.getModItem(GTValues.MODID_FR, "mulch", 0); + ItemStack propolis = IntegrationUtil.getModItem(GTValues.MODID_FR, "propolis", 0); + + // Vanilla Fruit Juice items + addFruitJuiceRecipe(new ItemStack(Items.CARROT), 200, GTUtility.copy(mulch), 2000); + addFruitJuiceRecipe(new ItemStack(Items.APPLE), 200, GTUtility.copy(mulch), 2000); + + // Forestry fruits + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 0), 50, GTUtility.copy(mulch), 500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 1), 180, GTUtility.copy(mulch), 500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 2), 220, GTUtility.copy(mulch), 200); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 3), 400, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 4), 100, GTUtility.copy(mulch), 6000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 5), 50, GTUtility.copy(mulch), 2000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 6), 600, GTUtility.copy(mulch), 1000); + + // Honey, Honeydew + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "honey_drop", 0), 100, GTUtility.copy(propolis), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "honeydew", 0), 100); + + if (Loader.isModLoaded(GTValues.MODID_EB)) { + // Propolis + addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 0), Materials.Water.getFluid(500)); + addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 1), Materials.Oil.getFluid(500)); + addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 2), Materials.Creosote.getFluid(500)); + + // Drops + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 3), 200); + addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 6), Fluids.MILK.getFluid(200)); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 13), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 19), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 14), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 20), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 15), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 21), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 16), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 22), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 17), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 24), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 18), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 23), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 19), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 25), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 20), 200, new ItemStack(Items.DYE, 1, 14), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 21), 200, new ItemStack(Items.DYE, 1, 6), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 22), 200, new ItemStack(Items.DYE, 1, 5), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 23), 200, new ItemStack(Items.DYE, 1, 8), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 24), 200, new ItemStack(Items.DYE, 1, 12), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 25), 200, new ItemStack(Items.DYE, 1, 9), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 26), 200, new ItemStack(Items.DYE, 1, 10), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 27), 200, new ItemStack(Items.DYE, 1, 13), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 28), 200, new ItemStack(Items.DYE, 1, 7), 0); + } + + if (Loader.isModLoaded(GTValues.MODID_ET)) { + + // Fruits + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 0), 150, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 1), 400, GTUtility.copy(mulch), 1500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 2), 300, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 3), 300, GTUtility.copy(mulch), 1000); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 4), 50, GTUtility.copy(mulch), 500); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 5), 50, GTUtility.copy(mulch), 300); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 6), 50, GTUtility.copy(mulch), 500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 7), 50, GTUtility.copy(mulch), 500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 8), 100, GTUtility.copy(mulch), 6000); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 9), 80, GTUtility.copy(mulch), 500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 10), 150, GTUtility.copy(mulch), 4000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 11), 500, GTUtility.copy(mulch), 1500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 12), 150, GTUtility.copy(mulch), 4000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 13), 300, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 14), 400, GTUtility.copy(mulch), 1500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 15), 400, GTUtility.copy(mulch), 1500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 16), 300, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 17), 300, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 18), 400, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 19), 150, GTUtility.copy(mulch), 4000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 20), 300, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 21), 300, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 22), 300, GTUtility.copy(mulch), 2000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 23), 200, GTUtility.copy(mulch), 1000); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 24), 150, GTUtility.copy(mulch), 500); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 25), 180, GTUtility.copy(mulch), 500); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 26), 100, GTUtility.copy(mulch), 400); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 27), 50, GTUtility.copy(mulch), 200); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 28), 100, GTUtility.copy(mulch), 3000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 29), 100, GTUtility.copy(mulch), 3000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 30), 100, GTUtility.copy(mulch), 4000); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 31), 20, GTUtility.copy(mulch), 200); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 32), 50, GTUtility.copy(mulch), 300); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 33), 50, GTUtility.copy(mulch), 300); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 34), 100, GTUtility.copy(mulch), 500); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 35), 50, GTUtility.copy(mulch), 300); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 36), 50, GTUtility.copy(mulch), 500); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 37), 20, GTUtility.copy(mulch), 200); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 38), 300, GTUtility.copy(mulch), 1500); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 39), 25, GTUtility.copy(mulch), 200); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 46), 50, GTUtility.copy(mulch), 500); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 50), 300, GTUtility.copy(mulch), 2500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 51), 150, GTUtility.copy(mulch), 1500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 52), 300, GTUtility.copy(mulch), 1500); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 53), 50, GTUtility.copy(mulch), 1000); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 54), 50, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 55), 100, GTUtility.copy(mulch), 1000); + addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 56), 100, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 57), 400, GTUtility.copy(mulch), 2000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 58), 300, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 59), 50, GTUtility.copy(mulch), 1000); + } + } + + private static void addSeedOilRecipe(ItemStack inputStack, int outputAmount) { + addExtractorRecipe(inputStack, Materials.SeedOil.getFluid(outputAmount), ItemStack.EMPTY, 0); + } + + private static void addSeedOilRecipe(ItemStack inputStack, int outputAmount, ItemStack extraOutput, int chance) { + addExtractorRecipe(inputStack, Materials.SeedOil.getFluid(outputAmount), extraOutput, chance); + } + + private static void addHoneyRecipe(ItemStack inputStack, int outputAmount) { + addExtractorRecipe(inputStack, Fluids.FOR_HONEY.getFluid(outputAmount), ItemStack.EMPTY, 0); + } + + private static void addHoneyRecipe(ItemStack inputStack, int outputAmount, ItemStack extraOutput, int chance) { + addExtractorRecipe(inputStack, Fluids.FOR_HONEY.getFluid(outputAmount), extraOutput, chance); + } + + private static void addFruitJuiceRecipe(ItemStack inputStack, int outputAmount) { + addExtractorRecipe(inputStack, Fluids.JUICE.getFluid(outputAmount), ItemStack.EMPTY, 0); + } + + private static void addFruitJuiceRecipe(ItemStack inputStack, int outputAmount, ItemStack extraOutput, int chance) { + addExtractorRecipe(inputStack, Fluids.JUICE.getFluid(outputAmount), extraOutput, chance); + } + + private static void addExtractorRecipe(ItemStack inputStack, FluidStack outputFluid) { + addExtractorRecipe(inputStack, outputFluid, ItemStack.EMPTY, 0); + } + + private static void addExtractorRecipe(ItemStack inputStack, FluidStack outputFluid, ItemStack extraOutput, int chance) { + RecipeBuilder builder = RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder() + .inputs(inputStack) + .fluidOutputs(outputFluid); + + if (extraOutput != ItemStack.EMPTY) { + if (chance > 0) { + builder.chancedOutput(extraOutput, chance, 0); + } else { + builder.outputs(extraOutput); + } + } + + builder.duration(32).EUt(7).buildAndRegister(); + } +} diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryFrameRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryFrameRecipes.java new file mode 100644 index 00000000000..b9fffb8c773 --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryFrameRecipes.java @@ -0,0 +1,97 @@ +package gregtech.integration.forestry.recipes; + +import forestry.api.recipes.RecipeManagers; +import forestry.apiculture.ModuleApiculture; +import forestry.factory.MachineUIDs; +import forestry.factory.ModuleFactory; +import gregtech.api.GTValues; +import gregtech.api.recipes.RecipeMaps; +import gregtech.api.unification.OreDictUnifier; +import gregtech.api.unification.stack.UnificationEntry; +import gregtech.api.util.GTUtility; +import gregtech.integration.forestry.ForestryModule; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import static gregtech.api.unification.material.Materials.*; +import static gregtech.api.unification.ore.OrePrefix.*; + +public class ForestryFrameRecipes { + + public static void init() { + registerRecipe( // Accelerated Frame + new UnificationEntry(stickLong, Electrum), + new UnificationEntry(stick, Electrum), + new UnificationEntry(foil, Electrum), + Redstone.getFluid(GTValues.L * 4), + ForestryModule.FRAME_ACCELERATED.getItemStack(), + ModuleApiculture.getItems().frameImpregnated.getItemStack()); + + registerRecipe( // Mutagenic Frame + new UnificationEntry(stickLong, Uranium235), + new UnificationEntry(stick, Plutonium241), + new UnificationEntry(foil, Plutonium241), + Redstone.getFluid(GTValues.L * 4), + ForestryModule.FRAME_MUTAGENIC.getItemStack(), + ModuleApiculture.getItems().frameImpregnated.getItemStack()); + + registerRecipe( // Working Frame + new UnificationEntry(stickLong, BlueSteel), + new UnificationEntry(stick, BlueSteel), + new UnificationEntry(gem, NetherStar), + Redstone.getFluid(GTValues.L * 4), + ForestryModule.FRAME_WORKING.getItemStack(), + ModuleApiculture.getItems().frameImpregnated.getItemStack()); + + registerRecipe( // Decaying Frame + new UnificationEntry(stickLong, WroughtIron), + new UnificationEntry(stick, WroughtIron), + new UnificationEntry(foil, WroughtIron), + Redstone.getFluid(GTValues.L * 4), + ForestryModule.FRAME_DECAYING.getItemStack(), + ModuleApiculture.getItems().frameImpregnated.getItemStack()); + + registerRecipe( // Slowing Frame + new UnificationEntry(stickLong, Potin), + new UnificationEntry(stick, Potin), + new UnificationEntry(foil, Electrum), + Redstone.getFluid(GTValues.L * 4), + ForestryModule.FRAME_SLOWING.getItemStack(), + ModuleApiculture.getItems().frameImpregnated.getItemStack()); + + registerRecipe( // Stabilizing Frame + new UnificationEntry(stickLong, Osmiridium), + new UnificationEntry(stick, Osmiridium), + new UnificationEntry(foil, Osmiridium), + Redstone.getFluid(GTValues.L * 4), + ForestryModule.FRAME_STABILIZING.getItemStack(), + ModuleApiculture.getItems().frameImpregnated.getItemStack()); + + registerRecipe( // Arborist Frame + new UnificationEntry(stickLong, TreatedWood), + new UnificationEntry(stick, TreatedWood), + new UnificationEntry(plate, Paper), + Redstone.getFluid(GTValues.L * 4), + ForestryModule.FRAME_ARBORIST.getItemStack(), + ModuleApiculture.getItems().frameImpregnated.getItemStack()); + } + + private static void registerRecipe(UnificationEntry cornerItem, UnificationEntry edgeItem, UnificationEntry centerItem, + FluidStack fluid, ItemStack output, ItemStack frame) { + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() + .inputs(GTUtility.copy(4, OreDictUnifier.get(cornerItem))) + .inputs(GTUtility.copy(4, OreDictUnifier.get(edgeItem))) + .inputs(OreDictUnifier.get(centerItem)) + .fluidInputs(fluid) + .outputs(output) + .duration(300).EUt(GTValues.VA[GTValues.LV]).buildAndRegister(); + + if (ModuleFactory.machineEnabled(MachineUIDs.CARPENTER)) { + RecipeManagers.carpenterManager.addRecipe(15, fluid.copy(), frame.copy(), output.copy(), + "CEC", "E#E", "CEC", + 'C', cornerItem.toString(), + 'E', edgeItem.toString(), + '#', centerItem.toString()); + } + } +} diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryMiscRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryMiscRecipes.java new file mode 100644 index 00000000000..ca7dcfa44e2 --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryMiscRecipes.java @@ -0,0 +1,442 @@ +package gregtech.integration.forestry.recipes; + +import forestry.api.recipes.RecipeManagers; +import forestry.apiculture.ModuleApiculture; +import forestry.apiculture.items.EnumPropolis; +import forestry.core.config.Config; +import forestry.core.fluids.Fluids; +import forestry.factory.MachineUIDs; +import forestry.factory.ModuleFactory; +import gregtech.api.GTValues; +import gregtech.api.recipes.ModHandler; +import gregtech.api.recipes.RecipeMaps; +import gregtech.api.unification.material.Materials; +import gregtech.api.unification.ore.OrePrefix; +import gregtech.api.util.GTUtility; +import gregtech.common.items.MetaItems; +import gregtech.integration.IntegrationUtil; +import gregtech.integration.forestry.ForestryConfig; +import gregtech.integration.forestry.ForestryUtil; +import gregtech.integration.forestry.bees.GTDropType; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.Loader; + +public class ForestryMiscRecipes { + + public static void init() { + + if (ForestryConfig.enableGTBees) { + // Oil Drop + ItemStack dropStack = ForestryUtil.getDropStack(GTDropType.OIL); + RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder() + .inputs(dropStack) + .chancedOutput(ModuleApiculture.getItems().propolis.get(EnumPropolis.NORMAL, 1), 3000, 0) + .fluidOutputs(Materials.OilHeavy.getFluid(100)) + .duration(32).EUt(8).buildAndRegister(); + + if (ModuleFactory.machineEnabled(MachineUIDs.SQUEEZER)) { + RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.OilHeavy.getFluid(100), ModuleApiculture.getItems().propolis.get(EnumPropolis.NORMAL, 1), 30); + } + + // Biomass Drop + dropStack = ForestryUtil.getDropStack(GTDropType.BIOMASS); + ItemStack propolisStack = ModuleApiculture.getItems().propolis.get(EnumPropolis.NORMAL, 1); + if (Loader.isModLoaded(GTValues.MODID_EB)) { + propolisStack = IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 7); + } + RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder() + .inputs(dropStack) + .chancedOutput(propolisStack, 3000, 0) + .fluidOutputs(Materials.Biomass.getFluid(100)) + .duration(32).EUt(8).buildAndRegister(); + + if (ModuleFactory.machineEnabled(MachineUIDs.SQUEEZER)) { + RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.Biomass.getFluid(100), propolisStack, 30); + } + + // Ethanol Drop + dropStack = ForestryUtil.getDropStack(GTDropType.ETHANOL); + RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder() + .inputs(dropStack) + .chancedOutput(propolisStack, 3000, 0) + .fluidOutputs(Materials.Ethanol.getFluid(100)) + .duration(32).EUt(8).buildAndRegister(); + + if (ModuleFactory.machineEnabled(MachineUIDs.SQUEEZER)) { + RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.Ethanol.getFluid(100), propolisStack, 30); + } + + // Mutagen Drop + dropStack = ForestryUtil.getDropStack(GTDropType.MUTAGEN); + RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder() + .inputs(dropStack) + .chancedOutput(propolisStack, 3000, 0) + .fluidOutputs(Materials.Mutagen.getFluid(100)) + .duration(32).EUt(8).buildAndRegister(); + + if (ModuleFactory.machineEnabled(MachineUIDs.SQUEEZER)) { + RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.Mutagen.getFluid(100), propolisStack, 30); + } + } + + // Honey and Juice recipes + if (Config.isFluidEnabled(Fluids.FOR_HONEY)) { + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input(MetaItems.PLANT_BALL) + .fluidInputs(Fluids.FOR_HONEY.getFluid(180)) + .fluidOutputs(Materials.Biomass.getFluid(270)) + .duration(1440).EUt(3).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input("treeSapling", 1) + .fluidInputs(Fluids.FOR_HONEY.getFluid(100)) + .fluidOutputs(Materials.Biomass.getFluid(150)) + .duration(600).EUt(3).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input(Items.POTATO) + .fluidInputs(Fluids.FOR_HONEY.getFluid(20)) + .fluidOutputs(Materials.Biomass.getFluid(30)) + .duration(160).EUt(3).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input(Items.CARROT) + .fluidInputs(Fluids.FOR_HONEY.getFluid(20)) + .fluidOutputs(Materials.Biomass.getFluid(30)) + .duration(160).EUt(3).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input(Blocks.CACTUS) + .fluidInputs(Fluids.FOR_HONEY.getFluid(20)) + .fluidOutputs(Materials.Biomass.getFluid(30)) + .duration(160).EUt(3).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input(Items.REEDS) + .fluidInputs(Fluids.FOR_HONEY.getFluid(20)) + .fluidOutputs(Materials.Biomass.getFluid(30)) + .duration(160).EUt(3).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input(Blocks.BROWN_MUSHROOM) + .fluidInputs(Fluids.FOR_HONEY.getFluid(20)) + .fluidOutputs(Materials.Biomass.getFluid(30)) + .duration(160).EUt(3).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input(Blocks.RED_MUSHROOM) + .fluidInputs(Fluids.FOR_HONEY.getFluid(20)) + .fluidOutputs(Materials.Biomass.getFluid(30)) + .duration(160).EUt(3).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input(Items.BEETROOT) + .fluidInputs(Fluids.FOR_HONEY.getFluid(20)) + .fluidOutputs(Materials.Biomass.getFluid(30)) + .duration(160).EUt(3).buildAndRegister(); + } + + if (Config.isFluidEnabled(Fluids.JUICE)) { + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input(MetaItems.PLANT_BALL) + .fluidInputs(Fluids.JUICE.getFluid(180)) + .fluidOutputs(Materials.Biomass.getFluid(270)) + .duration(1440).EUt(3).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input("treeSapling", 1) + .fluidInputs(Fluids.JUICE.getFluid(100)) + .fluidOutputs(Materials.Biomass.getFluid(150)) + .duration(600).EUt(3).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input(Items.POTATO) + .fluidInputs(Fluids.JUICE.getFluid(20)) + .fluidOutputs(Materials.Biomass.getFluid(30)) + .duration(160).EUt(3).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input(Items.CARROT) + .fluidInputs(Fluids.JUICE.getFluid(20)) + .fluidOutputs(Materials.Biomass.getFluid(30)) + .duration(160).EUt(3).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input(Blocks.CACTUS) + .fluidInputs(Fluids.JUICE.getFluid(20)) + .fluidOutputs(Materials.Biomass.getFluid(30)) + .duration(160).EUt(3).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input(Items.REEDS) + .fluidInputs(Fluids.JUICE.getFluid(20)) + .fluidOutputs(Materials.Biomass.getFluid(30)) + .duration(160).EUt(3).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input(Blocks.BROWN_MUSHROOM) + .fluidInputs(Fluids.JUICE.getFluid(20)) + .fluidOutputs(Materials.Biomass.getFluid(30)) + .duration(160).EUt(3).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input(Blocks.RED_MUSHROOM) + .fluidInputs(Fluids.JUICE.getFluid(20)) + .fluidOutputs(Materials.Biomass.getFluid(30)) + .duration(160).EUt(3).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .input(Items.BEETROOT) + .fluidInputs(Fluids.JUICE.getFluid(20)) + .fluidOutputs(Materials.Biomass.getFluid(30)) + .duration(160).EUt(3).buildAndRegister(); + } + + // Fertilizer + ItemStack fertilizer = IntegrationUtil.getModItem(GTValues.MODID_FR, "fertilizer_compound", 0); + RecipeMaps.MIXER_RECIPES.recipeBuilder() + .input("sand", 2) + .input(OrePrefix.dust, Materials.Apatite) + .fluidInputs(Materials.Water.getFluid(100)) + .outputs(GTUtility.copy(5, fertilizer)) + .duration(100).EUt(16).buildAndRegister(); + + RecipeMaps.MIXER_RECIPES.recipeBuilder() + .input(OrePrefix.dust, Materials.Ash, 8) + .input(OrePrefix.dust, Materials.Apatite) + .fluidInputs(Materials.Water.getFluid(100)) + .outputs(GTUtility.copy(10, fertilizer)) + .duration(100).EUt(16).buildAndRegister(); + + RecipeMaps.MIXER_RECIPES.recipeBuilder() + .input(MetaItems.FERTILIZER, 8) + .input(OrePrefix.dust, Materials.Apatite) + .fluidInputs(Materials.Water.getFluid(1000)) + .outputs(GTUtility.copy(30, fertilizer)) + .duration(100).EUt(16).buildAndRegister(); + + if (Loader.isModLoaded(GTValues.MODID_MB)) { + ItemStack concentratedCompound = IntegrationUtil.getModItem(GTValues.MODID_MB, "resource", 2); + RecipeMaps.MIXER_RECIPES.recipeBuilder() + .input("sand", 2) + .inputs(GTUtility.copy(concentratedCompound)) + .fluidInputs(Materials.Water.getFluid(100)) + .outputs(GTUtility.copy(6, fertilizer)) + .duration(100).EUt(16).buildAndRegister(); + + RecipeMaps.MIXER_RECIPES.recipeBuilder() + .input(OrePrefix.dust, Materials.Ash, 8) + .inputs(GTUtility.copy(concentratedCompound)) + .fluidInputs(Materials.Water.getFluid(100)) + .outputs(GTUtility.copy(12, fertilizer)) + .duration(100).EUt(16).buildAndRegister(); + + RecipeMaps.MIXER_RECIPES.recipeBuilder() + .input(MetaItems.FERTILIZER, 8) + .inputs(GTUtility.copy(concentratedCompound)) + .fluidInputs(Materials.Water.getFluid(1000)) + .outputs(GTUtility.copy(32, fertilizer)) + .duration(100).EUt(16).buildAndRegister(); + } + + // Compost + ItemStack compost = IntegrationUtil.getModItem(GTValues.MODID_FR, "fertilizer_bio", 0); + RecipeMaps.MIXER_RECIPES.recipeBuilder() + .input(Blocks.DIRT, 1, true) + .input(Items.WHEAT, 4) + .fluidInputs(Materials.Water.getFluid(100)) + .outputs(GTUtility.copy(4, compost)) + .duration(200).EUt(16).buildAndRegister(); + + RecipeMaps.MIXER_RECIPES.recipeBuilder() + .input(Blocks.DIRT, 1, true) + .input(OrePrefix.dust, Materials.Ash, 4) + .fluidInputs(Materials.Water.getFluid(100)) + .outputs(GTUtility.copy(4, compost)) + .duration(200).EUt(16).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .inputs(GTUtility.copy(2, compost)) + .fluidInputs(Materials.Water.getFluid(375)) + .fluidOutputs(Materials.Biomass.getFluid(375)) + .duration(64).EUt(4).buildAndRegister(); + + RecipeMaps.PYROLYSE_RECIPES.recipeBuilder() + .inputs(GTUtility.copy(4, compost)) + .circuitMeta(1) + .fluidInputs(Materials.Water.getFluid(4000)) + .fluidOutputs(Materials.Biomass.getFluid(5000)) + .duration(900).EUt(10).buildAndRegister(); + + // Phosphor + RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder() + .inputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "phosphor", 0)) + .chancedOutput(OrePrefix.dust, Materials.Phosphorus, 1000, 0) + .fluidOutputs(Materials.Lava.getFluid(800)) + .duration(256).EUt(GTValues.VA[GTValues.MV]).buildAndRegister(); + + // Ice Shard + RecipeMaps.MACERATOR_RECIPES.recipeBuilder() + .inputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "crafting_material", 5)) + .output(OrePrefix.dust, Materials.Ice) + .duration(16).EUt(4).buildAndRegister(); + + // Mulch + ItemStack mulch = IntegrationUtil.getModItem(GTValues.MODID_FR, "mulch", 0); + RecipeMaps.CHEMICAL_BATH_RECIPES.recipeBuilder() + .input(MetaItems.BIO_CHAFF) + .fluidInputs(Materials.Water.getFluid(750)) + .outputs(GTUtility.copy(8, mulch)) + .chancedOutput(GTUtility.copy(4, mulch), 3300, 0) + .chancedOutput(GTUtility.copy(4, mulch), 2000, 0) + .duration(500).EUt(GTValues.VA[GTValues.LV]).buildAndRegister(); + + if (Loader.isModLoaded(GTValues.MODID_ET)) { + RecipeMaps.MIXER_RECIPES.recipeBuilder() + .inputs(IntegrationUtil.getModItem(GTValues.MODID_ET, "misc", 1)) + .fluidInputs(Materials.Water.getFluid(500)) + .outputs(GTUtility.copy(mulch)) + .duration(600).EUt(2).buildAndRegister(); + } + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .inputs(GTUtility.copy(8, mulch)) + .fluidInputs(Materials.DistilledWater.getFluid(375)) + .fluidOutputs(Materials.Biomass.getFluid(375)) + .duration(64).EUt(4).buildAndRegister(); + + RecipeMaps.BREWING_RECIPES.recipeBuilder() + .inputs(GTUtility.copy(4, mulch)) + .fluidInputs(Fluids.JUICE.getFluid(250)) + .fluidOutputs(Materials.Biomass.getFluid(375)) + .duration(64).EUt(4).buildAndRegister(); + + RecipeMaps.PYROLYSE_RECIPES.recipeBuilder() + .inputs(GTUtility.copy(32, mulch)) + .fluidInputs(Materials.Water.getFluid(4000)) + .circuitMeta(1) + .fluidOutputs(Materials.Biomass.getFluid(5000)) + .duration(900).EUt(10).buildAndRegister(); + + // Humus + ItemStack humus = IntegrationUtil.getModItem(GTValues.MODID_FR, "humus", 0); + RecipeMaps.MIXER_RECIPES.recipeBuilder() + .inputs(GTUtility.copy(2, mulch)) + .input(Blocks.DIRT, 2, true) + .fluidInputs(Materials.Water.getFluid(250)) + .outputs(GTUtility.copy(2, humus)) + .duration(16).EUt(16).buildAndRegister(); + + RecipeMaps.MIXER_RECIPES.recipeBuilder() + .inputs(GTUtility.copy(compost)) + .input(Blocks.DIRT, 8, true) + .fluidInputs(Materials.Water.getFluid(1000)) + .outputs(GTUtility.copy(8, humus)) + .duration(64).EUt(16).buildAndRegister(); + + RecipeMaps.MIXER_RECIPES.recipeBuilder() + .inputs(GTUtility.copy(fertilizer)) + .input(Blocks.DIRT, 8, true) + .fluidInputs(Materials.Water.getFluid(1000)) + .outputs(GTUtility.copy(8, humus)) + .duration(64).EUt(16).buildAndRegister(); + + RecipeMaps.MIXER_RECIPES.recipeBuilder() + .input(MetaItems.FERTILIZER) + .input(Blocks.DIRT, 8, true) + .fluidInputs(Materials.Water.getFluid(1000)) + .outputs(GTUtility.copy(8, humus)) + .duration(64).EUt(16).buildAndRegister(); + + // Cans, Capsules, etc + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() + .input(OrePrefix.plate, Materials.Tin, 2) + .input(Blocks.GLASS_PANE) + .circuitMeta(1) + .outputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "can", 0)) + .duration(120).EUt(7).buildAndRegister(); + + RecipeMaps.EXTRUDER_RECIPES.recipeBuilder() + .inputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "beeswax", 0)) + .notConsumable(MetaItems.SHAPE_EXTRUDER_CELL) + .outputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "capsule", 0)) + .duration(64).EUt(16).buildAndRegister(); + + RecipeMaps.EXTRUDER_RECIPES.recipeBuilder() + .inputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "refractory_wax", 0)) + .notConsumable(MetaItems.SHAPE_EXTRUDER_CELL) + .outputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "refractory", 0)) + .duration(128).EUt(16).buildAndRegister(); + + // Propolis + RecipeMaps.CENTRIFUGE_RECIPES.recipeBuilder() + .inputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "propolis", 0)) + .output(MetaItems.STICKY_RESIN) + .duration(128).EUt(5).buildAndRegister(); + + if (Loader.isModLoaded(GTValues.MODID_GENETICS)) { + + // DNA Dye + RecipeMaps.MIXER_RECIPES.recipeBuilder() + .input(OrePrefix.dust, Materials.Glowstone) + .input("dyePurple") + .input("dyeBlue") + .outputs(IntegrationUtil.getModItem(GTValues.MODID_GENETICS, "misc", 1, 8)) + .duration(100).EUt(GTValues.VA[GTValues.LV]).buildAndRegister(); + + // Fluorescent Dye + RecipeMaps.MIXER_RECIPES.recipeBuilder() + .input(OrePrefix.dust, Materials.Glowstone) + .input("dyeOrange") + .input("dyeYellow") + .outputs(IntegrationUtil.getModItem(GTValues.MODID_GENETICS, "misc", 2, 2)) + .duration(100).EUt(GTValues.VA[GTValues.LV]).buildAndRegister(); + + // Growth Medium + RecipeMaps.MIXER_RECIPES.recipeBuilder() + .input(OrePrefix.dust, Materials.Sugar) + .input(OrePrefix.dust, Materials.Bone) + .outputs(IntegrationUtil.getModItem(GTValues.MODID_GENETICS, "misc", 4, 2)) + .duration(400).EUt(16).buildAndRegister(); + } + + // Random honey stuff + RecipeMaps.FLUID_SOLIDFICATION_RECIPES.recipeBuilder() + .notConsumable(MetaItems.SHAPE_MOLD_NUGGET) + .fluidInputs(Fluids.FOR_HONEY.getFluid(200)) + .outputs(IntegrationUtil.getModItem(GTValues.MODID_FR, "honey_drop", 0)) + .duration(400).EUt(7).buildAndRegister(); + + RecipeMaps.CENTRIFUGE_RECIPES.recipeBuilder() + .fluidInputs(Fluids.FOR_HONEY.getFluid(1000)) + .output(OrePrefix.dust, Materials.Sugar, 9) + .duration(1020).EUt(7).buildAndRegister(); + } + + public static void initRemoval() { + ModHandler.removeRecipeByName("forestry:sand_to_fertilizer"); + ModHandler.removeRecipeByName("forestry:ash_to_fertilizer"); + if (Loader.isModLoaded(GTValues.MODID_MB)) { + ModHandler.removeRecipeByName("magicbees:fertilizer1"); + ModHandler.removeRecipeByName("magicbees:fertilizer2"); + ModHandler.removeRecipeByName("magicbees:fertilizer3"); + } + ModHandler.removeRecipeByName("forestry:wheat_to_compost"); + ModHandler.removeRecipeByName("forestry:ash_to_compost"); + ModHandler.removeRecipeByName("forestry:compost_humus"); + ModHandler.removeRecipeByName("forestry:fertilizer_humus"); + ModHandler.removeRecipeByName("forestry:tin_can"); + ModHandler.removeRecipeByName("forestry:wax_capsule"); + ModHandler.removeRecipeByName("forestry:refractory_capsule"); + if (Loader.isModLoaded(GTValues.MODID_GENETICS)) { + ModHandler.removeRecipeByName("genetics:dna_dye_from_glowstone"); + ModHandler.removeRecipeByName("genetics:dna_dye"); + ModHandler.removeRecipeByName("genetics:fluorescent_dye"); + ModHandler.removeRecipeByName("genetics:growth_medium"); + } + } +} diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryToolRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryToolRecipes.java new file mode 100644 index 00000000000..17977a86d2f --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryToolRecipes.java @@ -0,0 +1,26 @@ +package gregtech.integration.forestry.recipes; + +import gregtech.api.GTValues; +import gregtech.api.unification.material.Material; +import gregtech.api.unification.material.properties.PropertyKey; +import gregtech.api.unification.material.properties.ToolProperty; +import gregtech.api.unification.ore.OrePrefix; +import gregtech.api.unification.stack.UnificationEntry; +import gregtech.integration.forestry.ForestryModule; +import gregtech.loaders.recipe.handlers.ToolRecipeHandler; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; + +public class ForestryToolRecipes { + + public static void registerHandlers() { + OrePrefix.stick.addProcessingHandler(PropertyKey.TOOL, ForestryToolRecipes::processScoop); + } + + private static void processScoop(OrePrefix prefix, Material material, ToolProperty property) { + ToolRecipeHandler.addToolRecipe(material, ForestryModule.SCOOP, false, + "SWS", "SSS", "xSh", + 'S', new UnificationEntry(OrePrefix.stick, material), + 'W', new ItemStack(Blocks.WOOL, 1, GTValues.W)); + } +} diff --git a/src/main/java/gregtech/integration/forestry/tools/ScoopBehavior.java b/src/main/java/gregtech/integration/forestry/tools/ScoopBehavior.java new file mode 100644 index 00000000000..b1be87d366e --- /dev/null +++ b/src/main/java/gregtech/integration/forestry/tools/ScoopBehavior.java @@ -0,0 +1,55 @@ +package gregtech.integration.forestry.tools; + +import forestry.api.lepidopterology.EnumFlutterType; +import forestry.api.lepidopterology.IAlleleButterflySpecies; +import forestry.api.lepidopterology.IEntityButterfly; +import gregtech.api.GTValues; +import gregtech.api.items.toolitem.ToolHelper; +import gregtech.api.items.toolitem.behavior.IToolBehavior; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraftforge.event.ForgeEventFactory; +import net.minecraftforge.fml.common.Loader; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public class ScoopBehavior implements IToolBehavior { + + public static final ScoopBehavior INSTANCE = new ScoopBehavior(); + + private ScoopBehavior() {/**/} + + @Override + public void hitEntity(@NotNull ItemStack stack, @NotNull EntityLivingBase target, @NotNull EntityLivingBase attacker) { + if (!Loader.isModLoaded(GTValues.MODID_FR)) return; + if (!(target instanceof IEntityButterfly butterfly)) return; + if (!(attacker instanceof EntityPlayer player)) return; + if (attacker.world == null || attacker.world.isRemote) return; + + IAlleleButterflySpecies species = butterfly.getButterfly().getGenome().getPrimary(); + species.getRoot().getBreedingTracker(target.world, player.getGameProfile()).registerCatch(butterfly.getButterfly()); + + ItemStack memberStack = species.getRoot().getMemberStack(butterfly.getButterfly().copy(), EnumFlutterType.BUTTERFLY); + EntityItem entityItem = new EntityItem(player.world, target.posX, target.posY, target.posZ, memberStack); + target.setDead(); + NBTTagCompound behaviorTag = ToolHelper.getBehaviorsTag(stack); + if (behaviorTag.getBoolean(ToolHelper.RELOCATE_MINED_BLOCKS_KEY)) { + if (ForgeEventFactory.onItemPickup(entityItem, player) == -1) return; + if (player.addItemStackToInventory(memberStack)) return; + } + player.world.spawnEntity(entityItem); + } + + @Override + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, @NotNull ITooltipFlag flag) { + tooltip.add(I18n.format("item.gt.tool.behavior.scoop")); + } +} diff --git a/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java b/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java index b60e5b90509..7259ba0d9b4 100644 --- a/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java +++ b/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java @@ -49,7 +49,7 @@ containerID = GTValues.MODID, modDependencies = GTValues.MODID_GROOVYSCRIPT, name = "GregTech GroovyScript Integration", - descriptionKey = "gregtech.modules.grs_integration.description" + description = "GroovyScript Integration Module" ) public class GroovyScriptModule extends IntegrationSubmodule { diff --git a/src/main/java/gregtech/integration/hwyla/HWYLAModule.java b/src/main/java/gregtech/integration/hwyla/HWYLAModule.java index b4cde0666d5..9287220af66 100644 --- a/src/main/java/gregtech/integration/hwyla/HWYLAModule.java +++ b/src/main/java/gregtech/integration/hwyla/HWYLAModule.java @@ -17,7 +17,7 @@ containerID = GTValues.MODID, modDependencies = GTValues.MODID_HWYLA, name = "GregTech HWYLA Integration", - descriptionKey = "gregtech.modules.hwyla_integration.description" + description = "HWYLA (WAILA) Integration Module" ) public class HWYLAModule extends IntegrationSubmodule implements IWailaPlugin { @@ -33,6 +33,7 @@ public void register(IWailaRegistrar registrar) { MultiRecipeMapDataProvider.INSTANCE.register(registrar); ConverterDataProvider.INSTANCE.register(registrar); RecipeLogicDataProvider.INSTANCE.register(registrar); + SteamBoilerDataProvider.INSTANCE.register(registrar); PrimitivePumpDataProvider.INSTANCE.register(registrar); // one day, if cover provider is ported to waila, register it right here BlockOreDataProvider.INSTANCE.register(registrar); diff --git a/src/main/java/gregtech/integration/hwyla/provider/RecipeLogicDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/RecipeLogicDataProvider.java index 3901d93e5e6..70ab53b5c9a 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/RecipeLogicDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/RecipeLogicDataProvider.java @@ -68,7 +68,7 @@ public List getWailaBody(ItemStack itemStack, List tooltip, IWai if (accessor.getTileEntity() instanceof IGregTechTileEntity gtte) { MetaTileEntity mte = gtte.getMetaTileEntity(); if (mte instanceof SteamMetaTileEntity || mte instanceof MetaTileEntityLargeBoiler || mte instanceof RecipeMapSteamMultiblockController) { - endText = ": " + absEUt + TextFormatting.RESET + " L/t " + I18n.format("gregtech.top.of") + " " + I18n.format(Materials.Steam.getUnlocalizedName()); + endText = ": " + absEUt + TextFormatting.RESET + " L/t " + I18n.format(Materials.Steam.getUnlocalizedName()); } AbstractRecipeLogic arl = mte.getRecipeLogic(); if (arl != null) { diff --git a/src/main/java/gregtech/integration/hwyla/provider/SteamBoilerDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/SteamBoilerDataProvider.java new file mode 100644 index 00000000000..a4443d710e8 --- /dev/null +++ b/src/main/java/gregtech/integration/hwyla/provider/SteamBoilerDataProvider.java @@ -0,0 +1,80 @@ +package gregtech.integration.hwyla.provider; + +import gregtech.api.GTValues; +import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.api.unification.material.Materials; +import gregtech.common.metatileentities.steam.boiler.SteamBoiler; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaDataProvider; +import mcp.mobius.waila.api.IWailaRegistrar; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +public class SteamBoilerDataProvider implements IWailaDataProvider { + + public static final SteamBoilerDataProvider INSTANCE = new SteamBoilerDataProvider(); + + public void register(@NotNull IWailaRegistrar registrar) { + registrar.registerBodyProvider(this, IGregTechTileEntity.class); + registrar.registerNBTProvider(this, IGregTechTileEntity.class); + registrar.addConfig(GTValues.MODID, "gregtech.steam_boiler"); + } + + @NotNull + @Override + public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) { + if (te instanceof IGregTechTileEntity gtte) { + if (gtte.getMetaTileEntity() instanceof SteamBoiler boiler) { + NBTTagCompound subTag = new NBTTagCompound(); + subTag.setBoolean("IsBurning", boiler.isBurning()); + subTag.setBoolean("HasWater", boiler.hasWater()); + subTag.setInteger("SteamRate", boiler.getTotalSteamOutput()); + tag.setTag("gregtech.SteamBoiler", subTag); + } + } + return tag; + } + + @NotNull + @Override + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + if (!config.getConfig("gregtech.steam_boiler") + || !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) + || !(gtte.getMetaTileEntity() instanceof SteamBoiler)) { + return tooltip; + } + + if (accessor.getNBTData().hasKey("gregtech.SteamBoiler")) { + NBTTagCompound tag = accessor.getNBTData().getCompoundTag("gregtech.SteamBoiler"); + if (tag.getBoolean("IsBurning")) { + int steamRate = tag.getInteger("SteamRate"); + boolean hasWater = tag.getBoolean("HasWater"); + + // Creating steam + if (steamRate > 0 && hasWater) { + tooltip.add(I18n.format("gregtech.top.energy_production") + ": " + (steamRate / 10) + " L/t " + I18n.format(Materials.Steam.getUnlocalizedName())); + } + + // Initial heat-up + if (steamRate <= 0) { + tooltip.add(I18n.format("gregtech.top.steam_heating_up")); + } + + // No water + if (!hasWater) { + tooltip.add(I18n.format("gregtech.top.steam_no_water")); + } + } + } + return tooltip; + } +} diff --git a/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java b/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java index dcc49334d81..1af01b4533a 100644 --- a/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java +++ b/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java @@ -16,6 +16,7 @@ import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.category.GTRecipeCategory; import gregtech.api.recipes.ingredients.IntCircuitIngredient; +import gregtech.api.recipes.machines.IScannerRecipeMap; import gregtech.api.recipes.machines.RecipeMapFurnace; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.PropertyKey; @@ -67,7 +68,7 @@ containerID = GTValues.MODID, modDependencies = GTValues.MODID_JEI, name = "GregTech JEI Integration", - descriptionKey = "gregtech.modules.jei_integration.description" + description = "JustEnoughItems Integration Module" ) public class JustEnoughItemsModule extends IntegrationSubmodule implements IModPlugin { @@ -149,6 +150,15 @@ public void register(IModRegistry registry) { recipeStream = recipeStream.filter(recipe -> !smallRecipes.contains(recipe)); } + if (recipeMap instanceof IScannerRecipeMap scannerMap) { + List scannerRecipes = scannerMap.getRepresentativeRecipes(); + if (!scannerRecipes.isEmpty()) { + registry.addRecipes(scannerRecipes.stream() + .map(r -> new GTRecipeWrapper(recipeMap, r)) + .collect(Collectors.toList()), entry.getKey().getUniqueID()); + } + } + registry.addRecipes(recipeStream.map(r -> new GTRecipeWrapper(recipeMap, r)) .collect(Collectors.toList()), entry.getKey().getUniqueID() diff --git a/src/main/java/gregtech/integration/jei/basic/GTOreCategory.java b/src/main/java/gregtech/integration/jei/basic/GTOreCategory.java index a6886245981..29e91bca4a5 100644 --- a/src/main/java/gregtech/integration/jei/basic/GTOreCategory.java +++ b/src/main/java/gregtech/integration/jei/basic/GTOreCategory.java @@ -13,6 +13,7 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; import javax.annotation.Nonnull; @@ -107,18 +108,18 @@ public void drawExtras(@Nonnull Minecraft minecraft) { //Give room for 5 lines of 5 ores each, so 25 unique ores in the vein //73 is SLOT_HEIGHT * (NUM_OF_SLOTS - 1) + 1 if (baseYPos >= SLOT_HEIGHT * NUM_OF_SLOTS) { - minecraft.fontRenderer.drawString("Spawn Range: " + minHeight + "-" + maxHeight, baseXPos, baseYPos + 1, 0x111111); + minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.spawn_range", minHeight, maxHeight), baseXPos, baseYPos + 1, 0x111111); } else { - minecraft.fontRenderer.drawString("Spawn Range: " + minHeight + "-" + maxHeight, baseXPos, SLOT_HEIGHT * (NUM_OF_SLOTS - 1) + 1, 0x111111); + minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.spawn_range", minHeight, maxHeight), baseXPos, SLOT_HEIGHT * (NUM_OF_SLOTS - 1) + 1, 0x111111); //Update the position at which the spawn information ends baseYPos = 73; } //Create the Weight - minecraft.fontRenderer.drawString("Vein Weight: " + weight, baseXPos, baseYPos + FONT_HEIGHT, 0x111111); + minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.vein_weight", weight), baseXPos, baseYPos + FONT_HEIGHT, 0x111111); //Create the Dimensions - minecraft.fontRenderer.drawString("Dimensions: ", baseXPos, baseYPos + (2 * FONT_HEIGHT), 0x111111); + minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.dimension"), baseXPos, baseYPos + (2 * FONT_HEIGHT), 0x111111); JEIResourceDepositCategoryUtils.drawMultiLineCommaSeparatedDimensionList(WorldGenRegistry.getNamedDimensions(), dimension, @@ -128,6 +129,6 @@ public void drawExtras(@Nonnull Minecraft minecraft) { dimDisplayPos); //Label the Surface Identifier - minecraft.fontRenderer.drawSplitString("SurfaceMaterial", 15, 92, minecraft.fontRenderer.getStringWidth("Surface"), 0x111111); + minecraft.fontRenderer.drawSplitString(I18n.format("gregtech.jei.ore.surfacematerial"), 15, 92, baseXPos - 20, 0x111111); } } diff --git a/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java index 1283f00f103..5de2af0b991 100644 --- a/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java @@ -15,6 +15,7 @@ import gregtech.api.recipes.machines.IScannerRecipeMap; import gregtech.api.recipes.recipeproperties.ComputationProperty; import gregtech.api.recipes.recipeproperties.RecipeProperty; +import gregtech.api.recipes.recipeproperties.ScanProperty; import gregtech.api.recipes.recipeproperties.TotalComputationProperty; import gregtech.api.util.AssemblyLineManager; import gregtech.api.util.ClipboardUtil; @@ -163,7 +164,9 @@ public void addItemTooltip(int slotIndex, boolean input, Object ingredient, List } } // If we are here, we know this is not the data item, so add the tooltip - tooltip.add(TooltipHelper.BLINKING_CYAN + I18n.format("gregtech.recipe.research_result")); + if (recipe.hasProperty(ScanProperty.getInstance())) { + tooltip.add(TooltipHelper.BLINKING_CYAN + I18n.format("gregtech.recipe.research_result")); + } } } diff --git a/src/main/java/gregtech/integration/opencomputers/OpenComputersModule.java b/src/main/java/gregtech/integration/opencomputers/OpenComputersModule.java index 47268be1d4f..ae311f1e3df 100644 --- a/src/main/java/gregtech/integration/opencomputers/OpenComputersModule.java +++ b/src/main/java/gregtech/integration/opencomputers/OpenComputersModule.java @@ -6,7 +6,10 @@ import gregtech.integration.IntegrationSubmodule; import gregtech.integration.IntegrationUtil; import gregtech.integration.opencomputers.drivers.*; -import gregtech.integration.opencomputers.drivers.specific.*; +import gregtech.integration.opencomputers.drivers.specific.DriverConverter; +import gregtech.integration.opencomputers.drivers.specific.DriverFusionReactor; +import gregtech.integration.opencomputers.drivers.specific.DriverPowerSubstation; +import gregtech.integration.opencomputers.drivers.specific.DriverWorldAccelerator; import gregtech.modules.GregTechModules; import li.cil.oc.api.Driver; import li.cil.oc.api.driver.DriverBlock; @@ -18,7 +21,7 @@ containerID = GTValues.MODID, modDependencies = GTValues.MODID_OC, name = "GregTech OpenComputers Integration", - descriptionKey = "gregtech.modules.oc_integration.description" + description = "OpenComputers Integration Module" ) public class OpenComputersModule extends IntegrationSubmodule { diff --git a/src/main/java/gregtech/integration/theoneprobe/TheOneProbeModule.java b/src/main/java/gregtech/integration/theoneprobe/TheOneProbeModule.java index c9ba35aa28c..9afdb46c5d5 100644 --- a/src/main/java/gregtech/integration/theoneprobe/TheOneProbeModule.java +++ b/src/main/java/gregtech/integration/theoneprobe/TheOneProbeModule.java @@ -16,7 +16,7 @@ containerID = GTValues.MODID, modDependencies = GTValues.MODID_TOP, name = "GregTech TheOneProbe Integration", - descriptionKey = "gregtech.modules.top_integration.description" + description = "TheOneProbe Integration Module" ) public class TheOneProbeModule extends IntegrationSubmodule { @@ -34,6 +34,7 @@ public void init(FMLInitializationEvent event) { oneProbe.registerProvider(new MultiRecipeMapInfoProvider()); oneProbe.registerProvider(new ConverterInfoProvider()); oneProbe.registerProvider(new RecipeLogicInfoProvider()); + oneProbe.registerProvider(new SteamBoilerInfoProvider()); oneProbe.registerProvider(new PrimitivePumpInfoProvider()); oneProbe.registerProvider(new CoverInfoProvider()); oneProbe.registerProvider(new BlockOreInfoProvider()); diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java index c6166f00f3d..b999a84cbeb 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java @@ -49,7 +49,7 @@ protected void addProbeInfo(@Nonnull AbstractRecipeLogic capability, @Nonnull IP IGregTechTileEntity gtTileEntity = (IGregTechTileEntity) tileEntity; MetaTileEntity mte = gtTileEntity.getMetaTileEntity(); if (mte instanceof SteamMetaTileEntity || mte instanceof MetaTileEntityLargeBoiler || mte instanceof RecipeMapSteamMultiblockController) { - text = TextFormatting.RED.toString() + absEUt + TextStyleClass.INFO + " L/t {*gregtech.top.of*} {*" + Materials.Steam.getUnlocalizedName() + "*}"; + text = TextFormatting.AQUA.toString() + absEUt + TextStyleClass.INFO + " L/t {*" + Materials.Steam.getUnlocalizedName() + "*}"; } } if (text == null) { diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/SteamBoilerInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/SteamBoilerInfoProvider.java new file mode 100644 index 00000000000..2ee863d7d82 --- /dev/null +++ b/src/main/java/gregtech/integration/theoneprobe/provider/SteamBoilerInfoProvider.java @@ -0,0 +1,56 @@ +package gregtech.integration.theoneprobe.provider; + +import gregtech.api.GTValues; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.api.unification.material.Materials; +import gregtech.common.metatileentities.steam.boiler.SteamBoiler; +import mcjty.theoneprobe.api.*; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.world.World; + +public class SteamBoilerInfoProvider implements IProbeInfoProvider { + + @Override + public String getID() { + return GTValues.MODID + ":steam_boiler_provider"; + } + + @Override + public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState state, IProbeHitData data) { + if (state.getBlock().hasTileEntity(state)) { + TileEntity te = world.getTileEntity(data.getPos()); + if (te instanceof IGregTechTileEntity igtte) { + MetaTileEntity mte = igtte.getMetaTileEntity(); + if (mte instanceof SteamBoiler boiler) { + if (boiler.isBurning()) { + // Boiler is active + int steamOutput = boiler.getTotalSteamOutput(); + + // Creating steam + if (steamOutput > 0 && boiler.hasWater()) { + probeInfo.text(TextStyleClass.INFO + + "{*gregtech.top.energy_production*} " + + TextFormatting.AQUA + (steamOutput / 10) + + TextStyleClass.INFO + " L/t" + + " {*" + Materials.Steam.getUnlocalizedName() + "*}"); + } + + // Initial heat-up + if (steamOutput <= 0) { + probeInfo.text(TextStyleClass.INFO.toString() + TextFormatting.RED + "{*gregtech.top.steam_heating_up*}"); + } + + // No water + if (!boiler.hasWater()) { + probeInfo.text(TextStyleClass.WARNING + "{*gregtech.top.steam_no_water*}"); + } + } + } + } + } + } +} diff --git a/src/main/java/gregtech/loaders/MaterialInfoLoader.java b/src/main/java/gregtech/loaders/MaterialInfoLoader.java index b196d5b36f1..ea8dc81215c 100644 --- a/src/main/java/gregtech/loaders/MaterialInfoLoader.java +++ b/src/main/java/gregtech/loaders/MaterialInfoLoader.java @@ -163,15 +163,20 @@ public static void init() { )); OreDictUnifier.registerOre(MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.PLASCRETE), new ItemMaterialInfo( - new MaterialStack(Materials.Steel, M), // frame / 2 - new MaterialStack(Materials.Polyethylene, M * 3), // 6 sheets / 2 - new MaterialStack(Materials.Concrete, M / 2) // 1 block / 2 + new MaterialStack(Materials.Steel, (M * 2) / ConfigHolder.recipes.casingsPerCraft), // frame / config + new MaterialStack(Materials.Polyethylene, (M * 6) / ConfigHolder.recipes.casingsPerCraft), // 6 sheets / config + new MaterialStack(Materials.Concrete, M / ConfigHolder.recipes.casingsPerCraft) // 1 block / config )); OreDictUnifier.registerOre(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.CLEANROOM_GLASS), new ItemMaterialInfo( - new MaterialStack(Materials.Steel, M), // frame / 2 - new MaterialStack(Materials.Polyethylene, M * 3), // 6 sheets / 2 - new MaterialStack(Materials.Glass, M / 2) // 1 block / 2 + new MaterialStack(Materials.Steel, (M * 2) / ConfigHolder.recipes.casingsPerCraft), // frame / config + new MaterialStack(Materials.Polyethylene, (M * 6) / ConfigHolder.recipes.casingsPerCraft), // 6 sheets / config + new MaterialStack(Materials.Glass, M / ConfigHolder.recipes.casingsPerCraft) // 1 block / config + )); + + OreDictUnifier.registerOre(MetaBlocks.METAL_CASING.getItemVariant(BlockMetalCasing.MetalCasingType.PTFE_INERT_CASING), new ItemMaterialInfo( + new MaterialStack(Materials.Steel, (M * 8) / ConfigHolder.recipes.casingsPerCraft), // casing / config + new MaterialStack(Materials.Polytetrafluoroethylene, M * 3 / 2) // 1.5 ingots PTFE (fluid in recipe) )); OreDictUnifier.registerOre(MetaBlocks.METAL_CASING.getItemVariant(BlockMetalCasing.MetalCasingType.PRIMITIVE_BRICKS), new ItemMaterialInfo(new MaterialStack(Materials.Fireclay, M * 4))); @@ -309,14 +314,21 @@ public static void init() { new MaterialStack(Materials.Obsidian, M * 3), new MaterialStack(Materials.Glass, M * 4))); - OreDictUnifier.registerOre(new ItemStack(Blocks.ENCHANTING_TABLE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 4), new MaterialStack(Materials.Obsidian, M * 3), new MaterialStack(Materials.Paper, M * 9))); + OreDictUnifier.registerOre(new ItemStack(Blocks.ENCHANTING_TABLE, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Diamond, M * 4), + new MaterialStack(Materials.Obsidian, M * 3), + new MaterialStack(Materials.Paper, M * 9))); + + OreDictUnifier.registerOre(new ItemStack(Blocks.ENDER_CHEST, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Wood, M * 8), // chest + new MaterialStack(Materials.Obsidian, M * 9 * 6), // 6 dense plates + new MaterialStack(Materials.EnderEye, M))); } else { OreDictUnifier.registerOre(new ItemStack(Blocks.BEACON, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.NetherStar, M), new MaterialStack(Materials.Obsidian, M * 3), new MaterialStack(Materials.Glass, M * 5))); OreDictUnifier.registerOre(new ItemStack(Blocks.ENCHANTING_TABLE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 2), new MaterialStack(Materials.Obsidian, M * 4), new MaterialStack(Materials.Paper, M * 3))); + OreDictUnifier.registerOre(new ItemStack(Blocks.ENDER_CHEST, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.EnderEye, M), new MaterialStack(Materials.Obsidian, M * 8))); } - OreDictUnifier.registerOre(new ItemStack(Blocks.ENDER_CHEST, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.EnderEye, M), new MaterialStack(Materials.Obsidian, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Blocks.FURNACE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 8))); OreDictUnifier.registerOre(new ItemStack(Blocks.STONEBRICK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); OreDictUnifier.registerOre(new ItemStack(Blocks.COBBLESTONE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); diff --git a/src/main/java/gregtech/loaders/WoodTypeEntry.java b/src/main/java/gregtech/loaders/WoodTypeEntry.java index a7983eb61d6..03a293da5ec 100644 --- a/src/main/java/gregtech/loaders/WoodTypeEntry.java +++ b/src/main/java/gregtech/loaders/WoodTypeEntry.java @@ -39,6 +39,8 @@ public final class WoodTypeEntry { public final String doorRecipeName; @Nonnull public final ItemStack slab; + @Nullable + public final String slabRecipeName; public final boolean addSlabCraftingRecipe; public final ItemStack fence; @Nullable @@ -77,9 +79,9 @@ public final class WoodTypeEntry { private WoodTypeEntry(@Nonnull String modid, @Nonnull String woodName, @Nonnull ItemStack log, boolean removeCharcoalRecipe, boolean addCharcoalRecipe, @Nonnull ItemStack planks, @Nullable String planksRecipeName, @Nonnull ItemStack door, @Nullable String doorRecipeName, - @Nonnull ItemStack slab, boolean addSlabCraftingRecipe, @Nonnull ItemStack fence, - @Nullable String fenceRecipeName, @Nonnull ItemStack fenceGate, - @Nullable String fenceGateRecipeName, @Nonnull ItemStack stairs, + @Nonnull ItemStack slab, @Nullable String slabRecipeName, boolean addSlabCraftingRecipe, + @Nonnull ItemStack fence, @Nullable String fenceRecipeName, + @Nonnull ItemStack fenceGate, @Nullable String fenceGateRecipeName, @Nonnull ItemStack stairs, boolean addStairsCraftingRecipe, @Nonnull ItemStack boat, @Nullable String boatRecipeName, @Nullable Material material, boolean addLogOreDict, boolean addPlanksOreDict, boolean addDoorsOreDict, boolean addSlabsOreDict, boolean addFencesOreDict, @@ -97,6 +99,7 @@ private WoodTypeEntry(@Nonnull String modid, @Nonnull String woodName, @Nonnull this.door = door; this.doorRecipeName = doorRecipeName; this.slab = slab; + this.slabRecipeName = slabRecipeName; this.addSlabCraftingRecipe = addSlabCraftingRecipe; this.fence = fence; this.fenceRecipeName = fenceRecipeName; @@ -142,6 +145,7 @@ public static class Builder { private ItemStack door = ItemStack.EMPTY; private String doorRecipeName; private ItemStack slab = ItemStack.EMPTY; + private String slabRecipeName; private boolean addSlabsCraftingRecipe; private ItemStack fence = ItemStack.EMPTY; private String fenceRecipeName; @@ -244,8 +248,9 @@ public Builder door(@Nonnull ItemStack door, @Nullable String doorRecipeName) { * @param slab the slab to add * @return this */ - public Builder slab(@Nonnull ItemStack slab) { + public Builder slab(@Nonnull ItemStack slab, @Nullable String slabRecipeName) { this.slab = slab; + this.slabRecipeName = slabRecipeName; return this; } @@ -403,7 +408,7 @@ public Builder registerUnificationInfo(boolean planks, boolean door, boolean sla public WoodTypeEntry build() { Preconditions.checkArgument(!planks.isEmpty(), "Planks cannot be empty."); return new WoodTypeEntry(modid, woodName, log, removeCharcoalRecipe, addCharcoalRecipe, planks, - planksRecipeName, door, doorRecipeName, slab, addSlabsCraftingRecipe, fence, fenceRecipeName, + planksRecipeName, door, doorRecipeName, slab, slabRecipeName, addSlabsCraftingRecipe, fence, fenceRecipeName, fenceGate, fenceGateRecipeName, stairs, addStairsCraftingRecipe, boat, boatRecipeName, material, addLogOreDict, addPlanksOreDict, addDoorsOreDict, addSlabsOreDict, addFencesOreDict, addFenceGatesOreDict, addStairsOreDict, addPlanksUnificationInfo, addDoorsUnificationInfo, diff --git a/src/main/java/gregtech/loaders/recipe/ComputerRecipes.java b/src/main/java/gregtech/loaders/recipe/ComputerRecipes.java index e662543ac87..00d33bc11d4 100644 --- a/src/main/java/gregtech/loaders/recipe/ComputerRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/ComputerRecipes.java @@ -4,6 +4,7 @@ import gregtech.api.recipes.ingredients.nbtmatch.NBTCondition; import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher; import gregtech.api.unification.material.MarkerMaterials.Tier; +import gregtech.common.ConfigHolder; import gregtech.common.blocks.BlockComputerCasing; import gregtech.common.blocks.BlockGlassCasing; import net.minecraft.item.ItemStack; @@ -47,7 +48,7 @@ public static void init() { .input(wireFine, Cobalt, 16) .input(wireFine, Copper, 16) .input(wireGtSingle, NiobiumTitanium, 2) - .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.HIGH_POWER_CASING, 2)) + .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.HIGH_POWER_CASING, ConfigHolder.recipes.casingsPerCraft)) .duration(100).EUt(VA[IV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() @@ -57,7 +58,7 @@ public static void init() { .input(wireFine, Cobalt, 32) .input(wireFine, Copper, 32) .input(wireGtSingle, VanadiumGallium, 2) - .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.COMPUTER_CASING, 2)) + .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.COMPUTER_CASING, ConfigHolder.recipes.casingsPerCraft)) .duration(200).EUt(VA[LuV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() @@ -76,7 +77,7 @@ public static void init() { .input(pipeTinyFluid, StainlessSteel, 16) .input(plate, Copper, 16) .input(wireGtSingle, SamariumIronArsenicOxide) - .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.COMPUTER_HEAT_VENT, 2)) + .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.COMPUTER_HEAT_VENT, ConfigHolder.recipes.casingsPerCraft)) .duration(100).EUt(VA[EV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() diff --git a/src/main/java/gregtech/loaders/recipe/CraftingRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/CraftingRecipeLoader.java index f1bd3c711cf..061bd7e2cd9 100644 --- a/src/main/java/gregtech/loaders/recipe/CraftingRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/CraftingRecipeLoader.java @@ -92,8 +92,8 @@ private static void loadCraftingRecipes() { ModHandler.addShapedRecipe("blacklight", BLACKLIGHT.getStackForm(), "SPS", "GRG", "CPK", 'S', new UnificationEntry(OrePrefix.screw, TungstenCarbide), 'P', new UnificationEntry(OrePrefix.plate, TungstenCarbide), 'G', MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.LAMINATED_GLASS), 'R', new UnificationEntry(OrePrefix.spring, Europium), 'C', new UnificationEntry(OrePrefix.circuit, Tier.IV), 'K', new UnificationEntry(OrePrefix.cableGtSingle, Platinum)); - ModHandler.addShapedRecipe(true, "filter_casing", MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.FILTER_CASING, 2), "BBB", "III", "MFR", 'B', new ItemStack(Blocks.IRON_BARS), 'I', ITEM_FILTER.getStackForm(), 'M', ELECTRIC_MOTOR_MV.getStackForm(), 'F', new UnificationEntry(OrePrefix.frameGt, Steel), 'R', new UnificationEntry(OrePrefix.rotor, Steel)); - ModHandler.addShapedRecipe(true, "filter_casing_sterile", MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.FILTER_CASING_STERILE, 2), "BEB", "ISI", "MFR", 'B', new UnificationEntry(OrePrefix.pipeLargeFluid, Polybenzimidazole), 'E', EMITTER_ZPM.getStackForm(), 'I', ITEM_FILTER.getStackForm(), 'S', BLACKLIGHT.getStackForm(), 'M', ELECTRIC_MOTOR_ZPM.getStackForm(), 'F', new UnificationEntry(OrePrefix.frameGt, Tritanium), 'R', new UnificationEntry(OrePrefix.rotor, NaquadahAlloy)); + ModHandler.addShapedRecipe(true, "filter_casing", MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.FILTER_CASING, ConfigHolder.recipes.casingsPerCraft), "BBB", "III", "MFR", 'B', new ItemStack(Blocks.IRON_BARS), 'I', ITEM_FILTER.getStackForm(), 'M', ELECTRIC_MOTOR_MV.getStackForm(), 'F', new UnificationEntry(OrePrefix.frameGt, Steel), 'R', new UnificationEntry(OrePrefix.rotor, Steel)); + ModHandler.addShapedRecipe(true, "filter_casing_sterile", MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.FILTER_CASING_STERILE, ConfigHolder.recipes.casingsPerCraft), "BEB", "ISI", "MFR", 'B', new UnificationEntry(OrePrefix.pipeLargeFluid, Polybenzimidazole), 'E', EMITTER_ZPM.getStackForm(), 'I', ITEM_FILTER.getStackForm(), 'S', BLACKLIGHT.getStackForm(), 'M', ELECTRIC_MOTOR_ZPM.getStackForm(), 'F', new UnificationEntry(OrePrefix.frameGt, Tritanium), 'R', new UnificationEntry(OrePrefix.rotor, NaquadahAlloy)); /////////////////////////////////////////////////// // Shapes and Molds // diff --git a/src/main/java/gregtech/loaders/recipe/MachineRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/MachineRecipeLoader.java index 2f475b8403f..51382767fa0 100644 --- a/src/main/java/gregtech/loaders/recipe/MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/MachineRecipeLoader.java @@ -14,6 +14,8 @@ import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.MaterialStack; +import gregtech.api.unification.stack.UnificationEntry; +import gregtech.common.ConfigHolder; import gregtech.common.blocks.*; import gregtech.common.blocks.BlockMachineCasing.MachineCasingType; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; @@ -607,15 +609,15 @@ private static void registerAssemblerRecipes() { RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]).input(OrePrefix.wireGtDouble, Materials.Trinium, 8).input(OrePrefix.foil, Materials.NaquadahEnriched, 8).fluidInputs(Materials.Naquadah.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.TRINIUM)).duration(800).buildAndRegister(); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]).input(OrePrefix.wireGtDouble, Materials.Tritanium, 8).input(OrePrefix.foil, Materials.Naquadria, 8).fluidInputs(Materials.Trinium.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.TRITANIUM)).duration(900).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Bronze, 6).inputs(new ItemStack(Blocks.BRICK_BLOCK, 1)).circuitMeta(6).outputs(METAL_CASING.getItemVariant(BRONZE_BRICKS, 2)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Invar, 6).input(OrePrefix.frameGt, Materials.Invar, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.INVAR_HEATPROOF, 2)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Steel, 6).input(OrePrefix.frameGt, Materials.Steel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.STEEL_SOLID, 2)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Aluminium, 6).input(OrePrefix.frameGt, Materials.Aluminium, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.ALUMINIUM_FROSTPROOF, 2)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.TungstenSteel, 6).input(OrePrefix.frameGt, Materials.TungstenSteel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.TUNGSTENSTEEL_ROBUST, 2)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.StainlessSteel, 6).input(OrePrefix.frameGt, Materials.StainlessSteel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.STAINLESS_CLEAN, 2)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Titanium, 6).input(OrePrefix.frameGt, Materials.Titanium, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.TITANIUM_STABLE, 2)).duration(50).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(plate, HSSE, 6).input(frameGt, Europium).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.HSSE_STURDY, 2)).duration(50).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(plate, Palladium, 6).input(frameGt, Iridium).circuitMeta(6).outputs(METAL_CASING.getItemVariant(MetalCasingType.PALLADIUM_SUBSTATION, 2)).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Bronze, 6).inputs(new ItemStack(Blocks.BRICK_BLOCK, 1)).circuitMeta(6).outputs(METAL_CASING.getItemVariant(BRONZE_BRICKS, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Invar, 6).input(OrePrefix.frameGt, Materials.Invar, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.INVAR_HEATPROOF, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Steel, 6).input(OrePrefix.frameGt, Materials.Steel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.STEEL_SOLID, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Aluminium, 6).input(OrePrefix.frameGt, Materials.Aluminium, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.ALUMINIUM_FROSTPROOF, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.TungstenSteel, 6).input(OrePrefix.frameGt, Materials.TungstenSteel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.TUNGSTENSTEEL_ROBUST, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.StainlessSteel, 6).input(OrePrefix.frameGt, Materials.StainlessSteel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.STAINLESS_CLEAN, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Titanium, 6).input(OrePrefix.frameGt, Materials.Titanium, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.TITANIUM_STABLE, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(plate, HSSE, 6).input(frameGt, Europium).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.HSSE_STURDY, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(plate, Palladium, 6).input(frameGt, Iridium).circuitMeta(6).outputs(METAL_CASING.getItemVariant(MetalCasingType.PALLADIUM_SUBSTATION, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).inputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.STEEL_SOLID)).fluidInputs(Materials.Polytetrafluoroethylene.getFluid(216)).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.PTFE_INERT_CASING)).duration(50).buildAndRegister(); @@ -626,19 +628,19 @@ private static void registerAssemblerRecipes() { RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]).inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)).inputs(MetaItems.FIELD_GENERATOR_IV.getStackForm(2)).inputs(MetaItems.ELECTRIC_PUMP_IV.getStackForm()).inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm(2)).input(OrePrefix.circuit, MarkerMaterials.Tier.LuV, 4).input(OrePrefix.pipeSmallFluid, Materials.Naquadah, 4).input(OrePrefix.plate, Materials.Europium, 4).fluidInputs(Materials.VanadiumGallium.getFluid(GTValues.L * 4)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)).duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]).inputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.LAMINATED_GLASS)).input(OrePrefix.plate, Materials.Naquadah, 4).inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm(4)).outputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.FUSION_GLASS, 2)).fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L)).duration(50).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]).inputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.LAMINATED_GLASS)).input(OrePrefix.plate, Materials.Naquadah, 4).inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm(4)).outputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.FUSION_GLASS, ConfigHolder.recipes.casingsPerCraft)).fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L)).duration(50).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LuV)).inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)).inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm()).inputs(MetaItems.ELECTRIC_PUMP_LuV.getStackForm()).input(OrePrefix.plate, Materials.TungstenSteel, 6).fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING, 2)).duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ZPM)).inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)).inputs(MetaItems.VOLTAGE_COIL_ZPM.getStackForm(2)).inputs(MetaItems.FIELD_GENERATOR_LuV.getStackForm()).input(OrePrefix.plate, Materials.Europium, 6).fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L * 2)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING_MK2, 2)).duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UV)).inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)).inputs(MetaItems.VOLTAGE_COIL_UV.getStackForm(2)).inputs(MetaItems.FIELD_GENERATOR_ZPM.getStackForm()).input(OrePrefix.plate, Materials.Americium, 6).fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L * 4)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING_MK3, 2)).duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LuV)).inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)).inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm()).inputs(MetaItems.ELECTRIC_PUMP_LuV.getStackForm()).input(OrePrefix.plate, Materials.TungstenSteel, 6).fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING, ConfigHolder.recipes.casingsPerCraft)).duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ZPM)).inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)).inputs(MetaItems.VOLTAGE_COIL_ZPM.getStackForm(2)).inputs(MetaItems.FIELD_GENERATOR_LuV.getStackForm()).input(OrePrefix.plate, Materials.Europium, 6).fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L * 2)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING_MK2, ConfigHolder.recipes.casingsPerCraft)).duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UV)).inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)).inputs(MetaItems.VOLTAGE_COIL_UV.getStackForm(2)).inputs(MetaItems.FIELD_GENERATOR_ZPM.getStackForm()).input(OrePrefix.plate, Materials.Americium, 6).fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L * 4)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING_MK3, ConfigHolder.recipes.casingsPerCraft)).duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Magnalium, 6).input(OrePrefix.frameGt, Materials.BlueSteel, 1).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING, 2)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)).input(OrePrefix.plate, Materials.StainlessSteel, 6).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STAINLESS_TURBINE_CASING, 2)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)).input(OrePrefix.plate, Materials.Titanium, 6).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.TITANIUM_TURBINE_CASING, 2)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)).input(OrePrefix.plate, Materials.TungstenSteel, 6).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.TUNGSTENSTEEL_TURBINE_CASING, 2)).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Magnalium, 6).input(OrePrefix.frameGt, Materials.BlueSteel, 1).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)).input(OrePrefix.plate, Materials.StainlessSteel, 6).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STAINLESS_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)).input(OrePrefix.plate, Materials.Titanium, 6).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.TITANIUM_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)).input(OrePrefix.plate, Materials.TungstenSteel, 6).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.TUNGSTENSTEEL_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(48).input(OrePrefix.frameGt, Materials.Steel).input(OrePrefix.plate, Materials.Polyethylene, 6).fluidInputs(Concrete.getFluid(L)).outputs(MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.PLASCRETE, 2)).duration(200).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(48).input(OrePrefix.frameGt, Materials.Steel).input(OrePrefix.plate, Materials.Polyethylene, 6).fluidInputs(Glass.getFluid(L)).outputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.CLEANROOM_GLASS, 2)).duration(200).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(48).input(OrePrefix.frameGt, Materials.Steel).input(OrePrefix.plate, Materials.Polyethylene, 6).fluidInputs(Concrete.getFluid(L)).outputs(MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.PLASCRETE, ConfigHolder.recipes.casingsPerCraft)).duration(200).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(48).input(OrePrefix.frameGt, Materials.Steel).input(OrePrefix.plate, Materials.Polyethylene, 6).fluidInputs(Glass.getFluid(L)).outputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.CLEANROOM_GLASS, ConfigHolder.recipes.casingsPerCraft)).duration(200).buildAndRegister(); // If these recipes are changed, change the values in MaterialInfoLoader.java @@ -678,6 +680,9 @@ private static void registerAssemblerRecipes() { ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, Polycaprolactam, 2).input(CARBON_MESH).fluidInputs(Polyethylene.getFluid(144)).output(DUCT_TAPE, 4).duration(100).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, Polybenzimidazole).input(CARBON_MESH).fluidInputs(Polyethylene.getFluid(72)).output(DUCT_TAPE, 8).duration(100).buildAndRegister(); + ModHandler.addShapedRecipe("basic_tape", BASIC_TAPE.getStackForm(), " P ", "PSP", " P ", 'P', new UnificationEntry(plate, Paper), 'S', STICKY_RESIN.getStackForm()); + ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ULV]).input(plate, Paper, 2).input(STICKY_RESIN).output(BASIC_TAPE, 2).duration(100).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder() .input(plateDouble, Steel, 2) .input(ring, Bronze, 2) @@ -710,16 +715,75 @@ private static void registerAssemblerRecipes() { } private static void registerBlastFurnaceRecipes() { + // Steel + BLAST_RECIPES.recipeBuilder().duration(500).EUt(VA[MV]) + .input(ingot, Iron) + .fluidInputs(Oxygen.getFluid(200)) + .output(ingot, Steel) + .output(dustTiny, Ash) + .blastFurnaceTemp(1000) + .buildAndRegister(); + + BLAST_RECIPES.recipeBuilder().duration(400).EUt(VA[MV]) + .input(dust, Iron) + .fluidInputs(Oxygen.getFluid(200)) + .output(ingot, Steel) + .output(dustTiny, Ash) + .circuitMeta(2) + .blastFurnaceTemp(1000) + .buildAndRegister(); + + BLAST_RECIPES.recipeBuilder().duration(300).EUt(VA[MV]) + .input(ingot, WroughtIron) + .fluidInputs(Oxygen.getFluid(200)) + .output(ingot, Steel) + .output(dustTiny, Ash) + .blastFurnaceTemp(1000) + .buildAndRegister(); + + BLAST_RECIPES.recipeBuilder().duration(100).EUt(VA[MV]) + .input(dust, WroughtIron) + .fluidInputs(Oxygen.getFluid(200)) + .output(ingot, Steel) + .output(dustTiny, Ash) + .circuitMeta(2) + .blastFurnaceTemp(1000) + .buildAndRegister(); + + BLAST_RECIPES.recipeBuilder().duration(250).EUt(VA[EV]) + .input(dust, Iron, 4) + .input(dust, Carbon) + .output(ingot, Steel, 4) + .output(dustTiny, Ash) + .blastFurnaceTemp(2000) + .buildAndRegister(); + + BLAST_RECIPES.recipeBuilder().duration(50).EUt(VA[EV]) + .input(dust, WroughtIron, 4) + .input(dust, Carbon) + .output(ingot, Steel, 4) + .output(dustTiny, Ash) + .blastFurnaceTemp(2000) + .buildAndRegister(); + + // Aluminium from aluminium oxide gems BLAST_RECIPES.recipeBuilder().duration(400).EUt(100).input(dust, Ruby).output(nugget, Aluminium, 3).output(dustTiny, DarkAsh).blastFurnaceTemp(1200).buildAndRegister(); BLAST_RECIPES.recipeBuilder().duration(320).EUt(100).input(gem, Ruby).output(nugget, Aluminium, 3).output(dustTiny, DarkAsh).blastFurnaceTemp(1200).buildAndRegister(); BLAST_RECIPES.recipeBuilder().duration(400).EUt(100).input(dust, GreenSapphire).output(nugget, Aluminium, 3).output(dustTiny, DarkAsh).blastFurnaceTemp(1200).buildAndRegister(); BLAST_RECIPES.recipeBuilder().duration(320).EUt(100).input(gem, GreenSapphire).output(nugget, Aluminium, 3).output(dustTiny, DarkAsh).blastFurnaceTemp(1200).buildAndRegister(); BLAST_RECIPES.recipeBuilder().duration(400).EUt(100).input(dust, Sapphire).output(nugget, Aluminium, 3).blastFurnaceTemp(1200).buildAndRegister(); BLAST_RECIPES.recipeBuilder().duration(320).EUt(100).input(gem, Sapphire).output(nugget, Aluminium, 3).blastFurnaceTemp(1200).buildAndRegister(); - BLAST_RECIPES.recipeBuilder().duration(800).EUt(VA[HV]).input(dust, Magnesium, 2).fluidInputs(TitaniumTetrachloride.getFluid(1000)).outputs(OreDictUnifier.get(OrePrefix.ingotHot, Materials.Titanium), OreDictUnifier.get(OrePrefix.dust, Materials.MagnesiumChloride, 6)).blastFurnaceTemp(Materials.Titanium.getBlastTemperature() + 200).buildAndRegister(); - BLAST_RECIPES.recipeBuilder().duration(500).EUt(VA[MV]).input(ingot, Iron).fluidInputs(Oxygen.getFluid(200)).output(ingot, Steel).output(dustTiny, Ash).blastFurnaceTemp(1000).buildAndRegister(); - BLAST_RECIPES.recipeBuilder().duration(300).EUt(VA[MV]).input(ingot, WroughtIron).fluidInputs(Oxygen.getFluid(200)).output(ingot, Steel).output(dustTiny, Ash).blastFurnaceTemp(1000).buildAndRegister(); + // Titanium tetrachloride + BLAST_RECIPES.recipeBuilder().duration(800).EUt(VA[HV]) + .input(dust, Magnesium, 2) + .fluidInputs(TitaniumTetrachloride.getFluid(1000)) + .output(ingotHot, Titanium) + .output(dust, MagnesiumChloride, 6) + .blastFurnaceTemp(Titanium.getBlastTemperature() + 200) + .buildAndRegister(); + + // Rutile from ilmenite BLAST_RECIPES.recipeBuilder() .input(dust, Ilmenite, 10) .input(dust, Carbon, 4) diff --git a/src/main/java/gregtech/loaders/recipe/MetaTileEntityLoader.java b/src/main/java/gregtech/loaders/recipe/MetaTileEntityLoader.java index f16c11efcee..cf52d5862a0 100644 --- a/src/main/java/gregtech/loaders/recipe/MetaTileEntityLoader.java +++ b/src/main/java/gregtech/loaders/recipe/MetaTileEntityLoader.java @@ -78,41 +78,41 @@ public static void init() { } ModHandler.addShapedRecipe(true, "casing_coke_bricks", MetaBlocks.METAL_CASING.getItemVariant(COKE_BRICKS, 1), "XX", "XX", 'X', MetaItems.COKE_OVEN_BRICK); - ModHandler.addShapedRecipe(true, "casing_bronze_bricks", MetaBlocks.METAL_CASING.getItemVariant(BRONZE_BRICKS, 2), "PhP", "PBP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Bronze), 'B', new ItemStack(Blocks.BRICK_BLOCK, 1)); - ModHandler.addShapedRecipe(true, "casing_steel_solid", MetaBlocks.METAL_CASING.getItemVariant(STEEL_SOLID, 2), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Steel)); - ModHandler.addShapedRecipe(true, "casing_titanium_stable", MetaBlocks.METAL_CASING.getItemVariant(TITANIUM_STABLE, 2), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Titanium), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Titanium)); - ModHandler.addShapedRecipe(true, "casing_invar_heatproof", MetaBlocks.METAL_CASING.getItemVariant(INVAR_HEATPROOF, 2), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Invar), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Invar)); - ModHandler.addShapedRecipe(true, "casing_aluminium_frostproof", MetaBlocks.METAL_CASING.getItemVariant(ALUMINIUM_FROSTPROOF, 2), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Aluminium), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Aluminium)); - ModHandler.addShapedRecipe(true, "casing_stainless_clean", MetaBlocks.METAL_CASING.getItemVariant(STAINLESS_CLEAN, 2), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.StainlessSteel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.StainlessSteel)); - ModHandler.addShapedRecipe(true, "casing_tungstensteel_robust", MetaBlocks.METAL_CASING.getItemVariant(TUNGSTENSTEEL_ROBUST, 2), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.TungstenSteel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.TungstenSteel)); - ModHandler.addShapedRecipe(true, "casing_hssg_robust", MetaBlocks.METAL_CASING.getItemVariant(HSSE_STURDY, 2), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.HSSE), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Europium)); - ModHandler.addShapedRecipe(true, "casing_palladium_substation", MetaBlocks.METAL_CASING.getItemVariant(PALLADIUM_SUBSTATION, 2), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Palladium), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Iridium)); - - ModHandler.addShapedRecipe(true, "casing_steel_turbine_casing", MetaBlocks.TURBINE_CASING.getItemVariant(STEEL_TURBINE_CASING, 2), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Magnalium), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.BlueSteel)); - ModHandler.addShapedRecipe(true, "casing_stainless_turbine_casing", MetaBlocks.TURBINE_CASING.getItemVariant(STAINLESS_TURBINE_CASING, 2), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.StainlessSteel), 'F', MetaBlocks.TURBINE_CASING.getItemVariant(STEEL_TURBINE_CASING)); - ModHandler.addShapedRecipe(true, "casing_titanium_turbine_casing", MetaBlocks.TURBINE_CASING.getItemVariant(TITANIUM_TURBINE_CASING, 2), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Titanium), 'F', MetaBlocks.TURBINE_CASING.getItemVariant(STEEL_TURBINE_CASING)); - ModHandler.addShapedRecipe(true, "casing_tungstensteel_turbine_casing", MetaBlocks.TURBINE_CASING.getItemVariant(TUNGSTENSTEEL_TURBINE_CASING, 2), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.TungstenSteel), 'F', MetaBlocks.TURBINE_CASING.getItemVariant(STEEL_TURBINE_CASING)); - - - ModHandler.addShapedRecipe(true, "casing_bronze_pipe", MetaBlocks.BOILER_CASING.getItemVariant(BRONZE_PIPE, 2), "PIP", "IFI", "PIP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Bronze), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Bronze), 'I', new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Bronze)); - ModHandler.addShapedRecipe(true, "casing_steel_pipe", MetaBlocks.BOILER_CASING.getItemVariant(STEEL_PIPE, 2), "PIP", "IFI", "PIP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Steel), 'I', new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Steel)); - ModHandler.addShapedRecipe(true, "casing_titanium_pipe", MetaBlocks.BOILER_CASING.getItemVariant(TITANIUM_PIPE, 2), "PIP", "IFI", "PIP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Titanium), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Titanium), 'I', new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Titanium)); - ModHandler.addShapedRecipe(true, "casing_tungstensteel_pipe", MetaBlocks.BOILER_CASING.getItemVariant(TUNGSTENSTEEL_PIPE, 2), "PIP", "IFI", "PIP", 'P', new UnificationEntry(OrePrefix.plate, Materials.TungstenSteel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.TungstenSteel), 'I', new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.TungstenSteel)); - ModHandler.addShapedRecipe(true, "casing_ptfe_pipe", MetaBlocks.BOILER_CASING.getItemVariant(POLYTETRAFLUOROETHYLENE_PIPE, 2), "PIP", "IFI", "PIP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Polytetrafluoroethylene), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Polytetrafluoroethylene), 'I', new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Polytetrafluoroethylene)); - ModHandler.addShapedRecipe(true, "casing_bronze_firebox", MetaBlocks.BOILER_FIREBOX_CASING.getItemVariant(BRONZE_FIREBOX, 2), "PSP", "SFS", "PSP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Bronze), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Bronze), 'S', new UnificationEntry(OrePrefix.stick, Materials.Bronze)); - ModHandler.addShapedRecipe(true, "casing_steel_firebox", MetaBlocks.BOILER_FIREBOX_CASING.getItemVariant(STEEL_FIREBOX, 2), "PSP", "SFS", "PSP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Steel), 'S', new UnificationEntry(OrePrefix.stick, Materials.Steel)); - ModHandler.addShapedRecipe(true, "casing_titanium_firebox", MetaBlocks.BOILER_FIREBOX_CASING.getItemVariant(TITANIUM_FIREBOX, 2), "PSP", "SFS", "PSP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Titanium), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Titanium), 'S', new UnificationEntry(OrePrefix.stick, Materials.Titanium)); - ModHandler.addShapedRecipe(true, "casing_tungstensteel_firebox", MetaBlocks.BOILER_FIREBOX_CASING.getItemVariant(TUNGSTENSTEEL_FIREBOX, 2), "PSP", "SFS", "PSP", 'P', new UnificationEntry(OrePrefix.plate, Materials.TungstenSteel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.TungstenSteel), 'S', new UnificationEntry(OrePrefix.stick, Materials.TungstenSteel)); - - ModHandler.addShapedRecipe(true, "casing_bronze_gearbox", MetaBlocks.TURBINE_CASING.getItemVariant(BRONZE_GEARBOX, 2), "PhP", "GFG", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Bronze), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Bronze), 'G', new UnificationEntry(OrePrefix.gear, Materials.Bronze)); - ModHandler.addShapedRecipe(true, "casing_steel_gearbox", MetaBlocks.TURBINE_CASING.getItemVariant(STEEL_GEARBOX, 2), "PhP", "GFG", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Steel), 'G', new UnificationEntry(OrePrefix.gear, Materials.Steel)); - ModHandler.addShapedRecipe(true, "casing_stainless_steel_gearbox", MetaBlocks.TURBINE_CASING.getItemVariant(STAINLESS_STEEL_GEARBOX, 2), "PhP", "GFG", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.StainlessSteel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.StainlessSteel), 'G', new UnificationEntry(OrePrefix.gear, Materials.StainlessSteel)); - ModHandler.addShapedRecipe(true, "casing_titanium_gearbox", MetaBlocks.TURBINE_CASING.getItemVariant(TITANIUM_GEARBOX, 2), "PhP", "GFG", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Titanium), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Titanium), 'G', new UnificationEntry(OrePrefix.gear, Materials.Titanium)); - ModHandler.addShapedRecipe(true, "casing_tungstensteel_gearbox", MetaBlocks.TURBINE_CASING.getItemVariant(TUNGSTENSTEEL_GEARBOX, 2), "PhP", "GFG", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.TungstenSteel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.TungstenSteel), 'G', new UnificationEntry(OrePrefix.gear, Materials.TungstenSteel)); - - ModHandler.addShapedRecipe(true, "casing_grate_casing", MetaBlocks.MULTIBLOCK_CASING.getItemVariant(GRATE_CASING, 2), "PVP", "PFP", "PMP", 'P', new ItemStack(Blocks.IRON_BARS, 1), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Steel), 'M', MetaItems.ELECTRIC_MOTOR_MV, 'V', new UnificationEntry(OrePrefix.rotor, Materials.Steel)); - ModHandler.addShapedRecipe(true, "casing_assembly_control", MetaBlocks.MULTIBLOCK_CASING.getItemVariant(ASSEMBLY_CONTROL, 2), "CPC", "SFE", "CMC", 'C', new UnificationEntry(OrePrefix.circuit, MarkerMaterials.Tier.LuV), 'P', MetaItems.HIGH_POWER_INTEGRATED_CIRCUIT, 'S', MetaItems.SENSOR_IV.getStackForm(), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.TungstenSteel), 'E', MetaItems.EMITTER_IV.getStackForm(), 'M', MetaItems.ELECTRIC_MOTOR_IV); - ModHandler.addShapedRecipe(true, "casing_assembly_line", MetaBlocks.MULTIBLOCK_CASING.getItemVariant(ASSEMBLY_LINE_CASING, 2), "PGP", "AFA", "PGP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel), 'G', new UnificationEntry(OrePrefix.gear, Materials.Ruridit), 'A', MetaItems.ROBOT_ARM_IV.getStackForm(), 'F', OreDictUnifier.get(OrePrefix.frameGt, Materials.TungstenSteel)); + ModHandler.addShapedRecipe(true, "casing_bronze_bricks", MetaBlocks.METAL_CASING.getItemVariant(BRONZE_BRICKS, ConfigHolder.recipes.casingsPerCraft), "PhP", "PBP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Bronze), 'B', new ItemStack(Blocks.BRICK_BLOCK, 1)); + ModHandler.addShapedRecipe(true, "casing_steel_solid", MetaBlocks.METAL_CASING.getItemVariant(STEEL_SOLID, ConfigHolder.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Steel)); + ModHandler.addShapedRecipe(true, "casing_titanium_stable", MetaBlocks.METAL_CASING.getItemVariant(TITANIUM_STABLE, ConfigHolder.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Titanium), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Titanium)); + ModHandler.addShapedRecipe(true, "casing_invar_heatproof", MetaBlocks.METAL_CASING.getItemVariant(INVAR_HEATPROOF, ConfigHolder.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Invar), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Invar)); + ModHandler.addShapedRecipe(true, "casing_aluminium_frostproof", MetaBlocks.METAL_CASING.getItemVariant(ALUMINIUM_FROSTPROOF, ConfigHolder.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Aluminium), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Aluminium)); + ModHandler.addShapedRecipe(true, "casing_stainless_clean", MetaBlocks.METAL_CASING.getItemVariant(STAINLESS_CLEAN, ConfigHolder.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.StainlessSteel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.StainlessSteel)); + ModHandler.addShapedRecipe(true, "casing_tungstensteel_robust", MetaBlocks.METAL_CASING.getItemVariant(TUNGSTENSTEEL_ROBUST, ConfigHolder.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.TungstenSteel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.TungstenSteel)); + ModHandler.addShapedRecipe(true, "casing_hssg_robust", MetaBlocks.METAL_CASING.getItemVariant(HSSE_STURDY, ConfigHolder.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.HSSE), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Europium)); + ModHandler.addShapedRecipe(true, "casing_palladium_substation", MetaBlocks.METAL_CASING.getItemVariant(PALLADIUM_SUBSTATION, ConfigHolder.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Palladium), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Iridium)); + + ModHandler.addShapedRecipe(true, "casing_steel_turbine_casing", MetaBlocks.TURBINE_CASING.getItemVariant(STEEL_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Magnalium), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.BlueSteel)); + ModHandler.addShapedRecipe(true, "casing_stainless_turbine_casing", MetaBlocks.TURBINE_CASING.getItemVariant(STAINLESS_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.StainlessSteel), 'F', MetaBlocks.TURBINE_CASING.getItemVariant(STEEL_TURBINE_CASING)); + ModHandler.addShapedRecipe(true, "casing_titanium_turbine_casing", MetaBlocks.TURBINE_CASING.getItemVariant(TITANIUM_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Titanium), 'F', MetaBlocks.TURBINE_CASING.getItemVariant(STEEL_TURBINE_CASING)); + ModHandler.addShapedRecipe(true, "casing_tungstensteel_turbine_casing", MetaBlocks.TURBINE_CASING.getItemVariant(TUNGSTENSTEEL_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.TungstenSteel), 'F', MetaBlocks.TURBINE_CASING.getItemVariant(STEEL_TURBINE_CASING)); + + + ModHandler.addShapedRecipe(true, "casing_bronze_pipe", MetaBlocks.BOILER_CASING.getItemVariant(BRONZE_PIPE, ConfigHolder.recipes.casingsPerCraft), "PIP", "IFI", "PIP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Bronze), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Bronze), 'I', new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Bronze)); + ModHandler.addShapedRecipe(true, "casing_steel_pipe", MetaBlocks.BOILER_CASING.getItemVariant(STEEL_PIPE, ConfigHolder.recipes.casingsPerCraft), "PIP", "IFI", "PIP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Steel), 'I', new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Steel)); + ModHandler.addShapedRecipe(true, "casing_titanium_pipe", MetaBlocks.BOILER_CASING.getItemVariant(TITANIUM_PIPE, ConfigHolder.recipes.casingsPerCraft), "PIP", "IFI", "PIP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Titanium), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Titanium), 'I', new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Titanium)); + ModHandler.addShapedRecipe(true, "casing_tungstensteel_pipe", MetaBlocks.BOILER_CASING.getItemVariant(TUNGSTENSTEEL_PIPE, ConfigHolder.recipes.casingsPerCraft), "PIP", "IFI", "PIP", 'P', new UnificationEntry(OrePrefix.plate, Materials.TungstenSteel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.TungstenSteel), 'I', new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.TungstenSteel)); + ModHandler.addShapedRecipe(true, "casing_ptfe_pipe", MetaBlocks.BOILER_CASING.getItemVariant(POLYTETRAFLUOROETHYLENE_PIPE, ConfigHolder.recipes.casingsPerCraft), "PIP", "IFI", "PIP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Polytetrafluoroethylene), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Polytetrafluoroethylene), 'I', new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Polytetrafluoroethylene)); + ModHandler.addShapedRecipe(true, "casing_bronze_firebox", MetaBlocks.BOILER_FIREBOX_CASING.getItemVariant(BRONZE_FIREBOX, ConfigHolder.recipes.casingsPerCraft), "PSP", "SFS", "PSP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Bronze), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Bronze), 'S', new UnificationEntry(OrePrefix.stick, Materials.Bronze)); + ModHandler.addShapedRecipe(true, "casing_steel_firebox", MetaBlocks.BOILER_FIREBOX_CASING.getItemVariant(STEEL_FIREBOX, ConfigHolder.recipes.casingsPerCraft), "PSP", "SFS", "PSP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Steel), 'S', new UnificationEntry(OrePrefix.stick, Materials.Steel)); + ModHandler.addShapedRecipe(true, "casing_titanium_firebox", MetaBlocks.BOILER_FIREBOX_CASING.getItemVariant(TITANIUM_FIREBOX, ConfigHolder.recipes.casingsPerCraft), "PSP", "SFS", "PSP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Titanium), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Titanium), 'S', new UnificationEntry(OrePrefix.stick, Materials.Titanium)); + ModHandler.addShapedRecipe(true, "casing_tungstensteel_firebox", MetaBlocks.BOILER_FIREBOX_CASING.getItemVariant(TUNGSTENSTEEL_FIREBOX, ConfigHolder.recipes.casingsPerCraft), "PSP", "SFS", "PSP", 'P', new UnificationEntry(OrePrefix.plate, Materials.TungstenSteel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.TungstenSteel), 'S', new UnificationEntry(OrePrefix.stick, Materials.TungstenSteel)); + + ModHandler.addShapedRecipe(true, "casing_bronze_gearbox", MetaBlocks.TURBINE_CASING.getItemVariant(BRONZE_GEARBOX, ConfigHolder.recipes.casingsPerCraft), "PhP", "GFG", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Bronze), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Bronze), 'G', new UnificationEntry(OrePrefix.gear, Materials.Bronze)); + ModHandler.addShapedRecipe(true, "casing_steel_gearbox", MetaBlocks.TURBINE_CASING.getItemVariant(STEEL_GEARBOX, ConfigHolder.recipes.casingsPerCraft), "PhP", "GFG", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Steel), 'G', new UnificationEntry(OrePrefix.gear, Materials.Steel)); + ModHandler.addShapedRecipe(true, "casing_stainless_steel_gearbox", MetaBlocks.TURBINE_CASING.getItemVariant(STAINLESS_STEEL_GEARBOX, ConfigHolder.recipes.casingsPerCraft), "PhP", "GFG", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.StainlessSteel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.StainlessSteel), 'G', new UnificationEntry(OrePrefix.gear, Materials.StainlessSteel)); + ModHandler.addShapedRecipe(true, "casing_titanium_gearbox", MetaBlocks.TURBINE_CASING.getItemVariant(TITANIUM_GEARBOX, ConfigHolder.recipes.casingsPerCraft), "PhP", "GFG", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Titanium), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Titanium), 'G', new UnificationEntry(OrePrefix.gear, Materials.Titanium)); + ModHandler.addShapedRecipe(true, "casing_tungstensteel_gearbox", MetaBlocks.TURBINE_CASING.getItemVariant(TUNGSTENSTEEL_GEARBOX, ConfigHolder.recipes.casingsPerCraft), "PhP", "GFG", "PwP", 'P', new UnificationEntry(OrePrefix.plate, Materials.TungstenSteel), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.TungstenSteel), 'G', new UnificationEntry(OrePrefix.gear, Materials.TungstenSteel)); + + ModHandler.addShapedRecipe(true, "casing_grate_casing", MetaBlocks.MULTIBLOCK_CASING.getItemVariant(GRATE_CASING, ConfigHolder.recipes.casingsPerCraft), "PVP", "PFP", "PMP", 'P', new ItemStack(Blocks.IRON_BARS, 1), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.Steel), 'M', MetaItems.ELECTRIC_MOTOR_MV, 'V', new UnificationEntry(OrePrefix.rotor, Materials.Steel)); + ModHandler.addShapedRecipe(true, "casing_assembly_control", MetaBlocks.MULTIBLOCK_CASING.getItemVariant(ASSEMBLY_CONTROL, ConfigHolder.recipes.casingsPerCraft), "CPC", "SFE", "CMC", 'C', new UnificationEntry(OrePrefix.circuit, MarkerMaterials.Tier.LuV), 'P', MetaItems.HIGH_POWER_INTEGRATED_CIRCUIT, 'S', MetaItems.SENSOR_IV.getStackForm(), 'F', new UnificationEntry(OrePrefix.frameGt, Materials.TungstenSteel), 'E', MetaItems.EMITTER_IV.getStackForm(), 'M', MetaItems.ELECTRIC_MOTOR_IV); + ModHandler.addShapedRecipe(true, "casing_assembly_line", MetaBlocks.MULTIBLOCK_CASING.getItemVariant(ASSEMBLY_LINE_CASING, ConfigHolder.recipes.casingsPerCraft), "PGP", "AFA", "PGP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel), 'G', new UnificationEntry(OrePrefix.gear, Materials.Ruridit), 'A', MetaItems.ROBOT_ARM_IV.getStackForm(), 'F', OreDictUnifier.get(OrePrefix.frameGt, Materials.TungstenSteel)); ModHandler.addShapedRecipe(true, "warning_sign_yellow_stripes", MetaBlocks.WARNING_SIGN.getItemVariant(YELLOW_STRIPES), "Y ", " M ", " B", 'M', MetaBlocks.METAL_CASING.getItemVariant(STEEL_SOLID), 'Y', "dyeYellow", 'B', "dyeBlack"); ModHandler.addShapedRecipe(true, "warning_sign_small_yellow_stripes", MetaBlocks.WARNING_SIGN.getItemVariant(SMALL_YELLOW_STRIPES), " Y", " M ", "B ", 'M', MetaBlocks.METAL_CASING.getItemVariant(STEEL_SOLID), 'Y', "dyeYellow", 'B', "dyeBlack"); @@ -213,8 +213,8 @@ public static void init() { ModHandler.addShapedRecipe(true, "pyrolyse_oven", MetaTileEntities.PYROLYSE_OVEN.getStackForm(), "WEP", "EME", "WCP", 'M', MetaTileEntities.HULL[GTValues.MV].getStackForm(), 'W', MetaItems.ELECTRIC_PISTON_MV, 'P', new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Cupronickel), 'E', new UnificationEntry(OrePrefix.circuit, MarkerMaterials.Tier.MV), 'C', MetaItems.ELECTRIC_PUMP_MV); ModHandler.addShapedRecipe(true, "large_combustion_engine", MetaTileEntities.LARGE_COMBUSTION_ENGINE.getStackForm(), "PCP", "EME", "GWG", 'M', MetaTileEntities.HULL[GTValues.EV].getStackForm(), 'P', MetaItems.ELECTRIC_PISTON_EV.getStackForm(), 'E', MetaItems.ELECTRIC_MOTOR_EV.getStackForm(), 'C', new UnificationEntry(OrePrefix.circuit, Tier.IV), 'W', new UnificationEntry(OrePrefix.cableGtSingle, Materials.Aluminium), 'G', new UnificationEntry(OrePrefix.gear, Materials.Titanium)); ModHandler.addShapedRecipe(true, "extreme_combustion_engine", MetaTileEntities.EXTREME_COMBUSTION_ENGINE.getStackForm(), "PCP", "EME", "GWG", 'M', MetaTileEntities.HULL[GTValues.IV].getStackForm(), 'P', MetaItems.ELECTRIC_PISTON_IV.getStackForm(), 'E', MetaItems.ELECTRIC_MOTOR_IV.getStackForm(), 'C', new UnificationEntry(OrePrefix.circuit, Tier.LuV), 'W', new UnificationEntry(OrePrefix.cableGtSingle, Materials.HSSG), 'G', new UnificationEntry(OrePrefix.gear, Materials.TungstenSteel)); - ModHandler.addShapedRecipe(true, "engine_intake_casing", MetaBlocks.MULTIBLOCK_CASING.getItemVariant(MultiblockCasingType.ENGINE_INTAKE_CASING, 2), "PhP", "RFR", "PwP", 'R', new UnificationEntry(OrePrefix.rotor, Materials.Titanium), 'F', MetaBlocks.METAL_CASING.getItemVariant(TITANIUM_STABLE), 'P', new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Titanium)); - ModHandler.addShapedRecipe(true, "extreme_engine_intake_casing", MetaBlocks.MULTIBLOCK_CASING.getItemVariant(MultiblockCasingType.EXTREME_ENGINE_INTAKE_CASING, 2), "PhP", "RFR", "PwP", 'R', new UnificationEntry(OrePrefix.rotor, Materials.TungstenSteel), 'F', MetaBlocks.METAL_CASING.getItemVariant(TUNGSTENSTEEL_ROBUST), 'P', new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.TungstenSteel)); + ModHandler.addShapedRecipe(true, "engine_intake_casing", MetaBlocks.MULTIBLOCK_CASING.getItemVariant(MultiblockCasingType.ENGINE_INTAKE_CASING, ConfigHolder.recipes.casingsPerCraft), "PhP", "RFR", "PwP", 'R', new UnificationEntry(OrePrefix.rotor, Materials.Titanium), 'F', MetaBlocks.METAL_CASING.getItemVariant(TITANIUM_STABLE), 'P', new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Titanium)); + ModHandler.addShapedRecipe(true, "extreme_engine_intake_casing", MetaBlocks.MULTIBLOCK_CASING.getItemVariant(MultiblockCasingType.EXTREME_ENGINE_INTAKE_CASING, ConfigHolder.recipes.casingsPerCraft), "PhP", "RFR", "PwP", 'R', new UnificationEntry(OrePrefix.rotor, Materials.TungstenSteel), 'F', MetaBlocks.METAL_CASING.getItemVariant(TUNGSTENSTEEL_ROBUST), 'P', new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.TungstenSteel)); ModHandler.addShapedRecipe(true, "multi_furnace", MetaTileEntities.MULTI_FURNACE.getStackForm(), "PPP", "ASA", "CAC", 'P', Blocks.FURNACE, 'A', new UnificationEntry(OrePrefix.circuit, MarkerMaterials.Tier.HV), 'S', MetaBlocks.METAL_CASING.getItemVariant(INVAR_HEATPROOF), 'C', new UnificationEntry(OrePrefix.cableGtSingle, Materials.Copper)); ModHandler.addShapedRecipe(true, "large_steam_turbine", MetaTileEntities.LARGE_STEAM_TURBINE.getStackForm(), "PSP", "SAS", "CSC", 'S', new UnificationEntry(OrePrefix.gear, Materials.Steel), 'P', new UnificationEntry(OrePrefix.circuit, MarkerMaterials.Tier.HV), 'A', MetaTileEntities.HULL[GTValues.HV].getStackForm(), 'C', new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Steel)); diff --git a/src/main/java/gregtech/loaders/recipe/MetaTileEntityMachineRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/MetaTileEntityMachineRecipeLoader.java index aa727ac912d..ef3da2ffa86 100644 --- a/src/main/java/gregtech/loaders/recipe/MetaTileEntityMachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/MetaTileEntityMachineRecipeLoader.java @@ -233,6 +233,14 @@ public static void init() { .output(NONUPLE_EXPORT_HATCH[5]) .duration(600).EUt(VA[UV]).buildAndRegister(); + // Reservoir Hatch + ASSEMBLER_RECIPES.recipeBuilder() + .input(COVER_INFINITE_WATER) + .input(FLUID_IMPORT_HATCH[EV]) + .input(ELECTRIC_PUMP_EV) + .output(RESERVOIR_HATCH) + .duration(300).EUt(VA[EV]).buildAndRegister(); + // Item Buses registerHatchBusRecipe(ULV, ITEM_IMPORT_BUS[ULV], ITEM_EXPORT_BUS[ULV], new ItemStack(Blocks.CHEST)); registerHatchBusRecipe(LV, ITEM_IMPORT_BUS[LV], ITEM_EXPORT_BUS[LV], new ItemStack(Blocks.CHEST)); diff --git a/src/main/java/gregtech/loaders/recipe/VanillaOverrideRecipes.java b/src/main/java/gregtech/loaders/recipe/VanillaOverrideRecipes.java index a2fc33aa17d..cddb4ad2767 100644 --- a/src/main/java/gregtech/loaders/recipe/VanillaOverrideRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/VanillaOverrideRecipes.java @@ -15,6 +15,7 @@ import gregtech.common.items.MetaItems; import net.minecraft.init.Blocks; import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -45,6 +46,7 @@ public static void init() { ModHandler.addShapedRecipe("brick_from_water", new ItemStack(Blocks.BRICK_BLOCK, 2), "BBB", "BWB", "BBB", 'B', new ItemStack(Items.BRICK), 'W', new ItemStack(Items.WATER_BUCKET)); + ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.NETHERRACK)); } removeCompressionRecipes(); toolArmorRecipes(); @@ -137,7 +139,7 @@ private static void redstoneRecipes() { 'C', OreDictNames.stoneCobble, 'R', new UnificationEntry(OrePrefix.plate, Materials.RedAlloy), 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Iron), - 'F', "fenceWood" + 'F', OreDictNames.fenceWood ); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() @@ -264,6 +266,7 @@ private static void redstoneRecipes() { ); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:daylight_detector")); + ModHandler.removeRecipeByName(new ResourceLocation("appliedenergistics2:misc/vanilla_daylight_detector")); ModHandler.addShapedRecipe("daylight_detector", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "PPP", "SRS", 'G', new ItemStack(Blocks.GLASS, 1, GTValues.W), 'P', new UnificationEntry(OrePrefix.plate, Materials.NetherQuartz), @@ -343,6 +346,7 @@ private static void redstoneRecipes() { ); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:comparator")); + ModHandler.removeRecipeByName(new ResourceLocation("appliedenergistics2:misc/vanilla_comparator")); ModHandler.addShapedRecipe("comparator", new ItemStack(Items.COMPARATOR), "STS", "TQT", "PdP", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'T', new ItemStack(Blocks.REDSTONE_TORCH), @@ -397,7 +401,7 @@ private static void redstoneRecipes() { ); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:redstone_torch")); - ModHandler.addShapedRecipe("redstone_torch", new ItemStack(Blocks.REDSTONE_TORCH), "R", "T", 'R', new UnificationEntry(OrePrefix.dust, Materials.Redstone), 'T', new UnificationEntry(OrePrefix.stick, Materials.Wood)); + ModHandler.addShapedRecipe("redstone_torch", new ItemStack(Blocks.REDSTONE_TORCH), "R", "T", 'R', new UnificationEntry(OrePrefix.dust, Materials.Redstone), 'T', new ItemStack(Blocks.TORCH)); } /** @@ -474,8 +478,12 @@ private static void metalAdvancedRecipes() { * Replaces Vanilla Enchantment Table recipe * Replaces Vanilla Jukebox recipe * Replaces Vanilla Note Block recipe - * Replaces Vanilla Furnace - * - Removes Vanilla TNT recipe + * Replaces Vanilla Furnace recipe + * Replaces Vanilla Flower Pot recipe + * Replaces Vanilla Armor Stand recipe + * Replaces Vanilla Trapped Chest recipe + * Replaces Vanilla Ender Chest recipe + * Replaces Vanilla Bed recipes * - Removes Vanilla Golden Apple Recipe * - Removes Vanilla Ender Eye Recipe * - Removes Vanilla Glistering Melon Recipe @@ -483,6 +491,8 @@ private static void metalAdvancedRecipes() { * - Removes Vanilla Magma Cream Recipe * - Removes Vanilla Polished Stone Variant Recipes * - Removes Vanilla Brick Smelting Recipe + * - Removes Vanilla Fermented Spider Eye recipe + * - Removes Vanilla Fire Charge recipe */ private static void miscRecipes() { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:tnt")); @@ -620,6 +630,57 @@ private static void miscRecipes() { ModHandler.addShapedRecipe("furnace_minecart", new ItemStack(Items.FURNACE_MINECART), "hIw", " M ", " d ", 'I', new ItemStack(Blocks.FURNACE), 'M', new ItemStack(Items.MINECART)); ModHandler.addShapedRecipe("tnt_minecart", new ItemStack(Items.TNT_MINECART), "hIw", " M ", " d ", 'I', new ItemStack(Blocks.TNT), 'M', new ItemStack(Items.MINECART)); ModHandler.addShapedRecipe("hopper_minecart", new ItemStack(Items.HOPPER_MINECART), "hIw", " M ", " d ", 'I', new ItemStack(Blocks.HOPPER), 'M', new ItemStack(Items.MINECART)); + + ModHandler.removeRecipeByName(new ResourceLocation("minecraft:flower_pot")); + ModHandler.addShapedRecipe("flower_pot", new ItemStack(Items.FLOWER_POT), "BfB", " B ", + 'B', new ItemStack(Items.BRICK)); + + ModHandler.removeRecipeByName(new ResourceLocation("minecraft:armor_stand")); + ModHandler.addShapedRecipe("armor_stand", new ItemStack(Items.ARMOR_STAND), "BSB", "hSs", "IPI", + 'B', new UnificationEntry(OrePrefix.bolt, Materials.Wood), + 'S', new UnificationEntry(OrePrefix.stick, Materials.Wood), + 'I', new UnificationEntry(OrePrefix.plate, Materials.Iron), + 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE)); + ASSEMBLER_RECIPES.recipeBuilder() + .input(Blocks.STONE_PRESSURE_PLATE) + .input(OrePrefix.plate, Materials.Iron, 2) + .input(OrePrefix.stick, Materials.Wood, 2) + .output(Items.ARMOR_STAND) + .duration(100).EUt(VA[ULV]).buildAndRegister(); + + ModHandler.removeRecipeByName(new ResourceLocation("minecraft:trapped_chest")); + ModHandler.addShapedRecipe("trapped_chest", new ItemStack(Blocks.TRAPPED_CHEST), " H ", "SCS", " d ", + 'H', new ItemStack(Blocks.TRIPWIRE_HOOK), + 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), + 'C', new ItemStack(Blocks.CHEST)); + + ModHandler.removeRecipeByName(new ResourceLocation("minecraft:ender_chest")); + ASSEMBLER_RECIPES.recipeBuilder() + .input(OreDictNames.chestWood.name()) + .input(OrePrefix.plateDense, Materials.Obsidian, 6) + .input(OrePrefix.plate, Materials.EnderEye) + .output(Blocks.ENDER_CHEST) + .duration(200).EUt(VA[MV]).buildAndRegister(); + + for (int i = 0; i <= 15; i++) { + addBedRecipe(i); + } + + ModHandler.removeRecipeByName(new ResourceLocation("minecraft:fermented_spider_eye")); + ModHandler.removeRecipeByName(new ResourceLocation("minecraft:fire_charge")); + } + + private static void addBedRecipe(int meta) { + String colorName = EnumDyeColor.byMetadata(meta).getDyeColorName(); + if ("silver".equals(colorName)) { + // thank you mojang + colorName = "light_gray"; + } + ModHandler.removeRecipeByName(new ResourceLocation("minecraft:" + colorName + "_bed")); + ModHandler.addShapedRecipe(colorName + "_bed", new ItemStack(Items.BED, 1, meta), "WWW", "PPP", "FrF", + 'W', new ItemStack(Blocks.CARPET, 1, meta), + 'P', new UnificationEntry(OrePrefix.plank, Materials.Wood), + 'F', OreDictNames.fenceWood); } /** @@ -659,6 +720,7 @@ private static void removeCompressionRecipes() { ModHandler.removeRecipeByName("minecraft:lapis_block"); ModHandler.removeRecipeByName("minecraft:lapis_lazuli"); ModHandler.removeRecipeByName("minecraft:quartz_block"); + ModHandler.removeRecipeByName("appliedenergistics2:decorative/quartz_block_pure"); ModHandler.removeRecipeByName("minecraft:clay"); ModHandler.removeRecipeByName("minecraft:nether_brick"); ModHandler.removeRecipeByName("minecraft:glowstone"); @@ -684,7 +746,7 @@ private static void removeCompressionRecipes() { ModHandler.removeRecipeByName("minecraft:polished_granite"); ModHandler.removeRecipeByName("minecraft:coarse_dirt"); ModHandler.removeRecipeByName("minecraft:smooth_sandstone"); - ModHandler.removeRecipeByName("minecraft_chiseled_sandstone"); + ModHandler.removeRecipeByName("minecraft:chiseled_sandstone"); ModHandler.removeRecipeByName("minecraft:chiseled_quartz_block"); ModHandler.removeRecipeByName("minecraft:stonebrick"); ModHandler.removeRecipeByName("minecraft:chiseled_stonebrick"); @@ -696,6 +758,27 @@ private static void removeCompressionRecipes() { ModHandler.removeRecipeByName("minecraft:smooth_red_sandstone"); ModHandler.removeRecipeByName("minecraft:bookshelf"); ModHandler.removeRecipeByName("minecraft:pillar_quartz_block"); + ModHandler.removeRecipeByName("minecraft:sea_lantern"); + + // Slab replacement + ModHandler.removeRecipeByName("minecraft:stone_slab"); + ModHandler.addShapedRecipe("stone_slab_saw", new ItemStack(Blocks.STONE_SLAB), "sS", 'S', new ItemStack(Blocks.STONE)); + ModHandler.removeRecipeByName("minecraft:sandstone_slab"); + ModHandler.addShapedRecipe("sandstone_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 1), "sS", 'S', new ItemStack(Blocks.SANDSTONE, 1, W)); + ModHandler.removeRecipeByName("minecraft:cobblestone_slab"); + ModHandler.addShapedRecipe("cobblestone_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 3), "sS", 'S', new ItemStack(Blocks.COBBLESTONE)); + ModHandler.removeRecipeByName("minecraft:brick_slab"); + ModHandler.addShapedRecipe("brick_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 4), "sS", 'S', new ItemStack(Blocks.BRICK_BLOCK)); + ModHandler.removeRecipeByName("minecraft:stone_brick_slab"); + ModHandler.addShapedRecipe("stone_brick_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 5), "sS", 'S', OreDictNames.stoneBricks); + ModHandler.removeRecipeByName("minecraft:nether_brick_slab"); + ModHandler.addShapedRecipe("nether_brick_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 6), "sS", 'S', new ItemStack(Blocks.NETHER_BRICK)); + ModHandler.removeRecipeByName("minecraft:quartz_slab"); + ModHandler.addShapedRecipe("quartz_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 7), "sS", 'S', new ItemStack(Blocks.QUARTZ_BLOCK, 1, W)); + ModHandler.removeRecipeByName("minecraft:red_sandstone_slab"); + ModHandler.addShapedRecipe("red_sandstone_slab_saw", new ItemStack(Blocks.STONE_SLAB2), "sS", 'S', new ItemStack(Blocks.RED_SANDSTONE, 1, W)); + ModHandler.removeRecipeByName("minecraft:purpur_slab"); + ModHandler.addShapedRecipe("purpur_slab_saw", new ItemStack(Blocks.PURPUR_SLAB), "sS", 'S', new ItemStack(Blocks.PURPUR_BLOCK)); } } diff --git a/src/main/java/gregtech/loaders/recipe/VanillaStandardRecipes.java b/src/main/java/gregtech/loaders/recipe/VanillaStandardRecipes.java index 7d66f90d898..cceeb822a1c 100644 --- a/src/main/java/gregtech/loaders/recipe/VanillaStandardRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/VanillaStandardRecipes.java @@ -554,8 +554,8 @@ private static void dyingCleaningRecipes() { } CUTTER_RECIPES.recipeBuilder().duration(20).EUt(VA[ULV]) - .inputs(new ItemStack(Blocks.WOOL, 2, i)) - .outputs(new ItemStack(Blocks.CARPET, 3, i)) + .inputs(new ItemStack(Blocks.WOOL, 1, i)) + .outputs(new ItemStack(Blocks.CARPET, 2, i)) .buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder().duration(20).EUt(VA[ULV]) @@ -979,12 +979,12 @@ private static void miscRecipes() { ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).inputs(new ItemStack(Blocks.COBBLESTONE, 6)).input(dust, Redstone, 2).input(plate, NetherQuartz).outputs(new ItemStack(Blocks.OBSERVER)).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).inputs(new ItemStack(Blocks.COBBLESTONE, 6)).input(dust, Redstone, 2).input(plate, CertusQuartz).outputs(new ItemStack(Blocks.OBSERVER)).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).inputs(new ItemStack(Blocks.COBBLESTONE, 6)).input(dust, Redstone, 2).input(plate, Quartzite).outputs(new ItemStack(Blocks.OBSERVER)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).inputs(new ItemStack(Blocks.OBSIDIAN, 8)).inputs(new ItemStack(Items.ENDER_EYE)).outputs(new ItemStack(Blocks.ENDER_CHEST)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(30).EUt(VA[ULV]).inputs(new ItemStack(Blocks.STONE_SLAB, 1, 0)).inputs(new ItemStack(Items.STICK, 6)).outputs(new ItemStack(Items.ARMOR_STAND)).buildAndRegister(); } ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).circuitMeta(3).inputs(new ItemStack(Blocks.NETHER_BRICK)).outputs(new ItemStack(Blocks.NETHER_BRICK_FENCE)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).inputs(new ItemStack(Blocks.OBSIDIAN, 8)).inputs(new ItemStack(Items.ENDER_EYE)).outputs(new ItemStack(Blocks.ENDER_CHEST)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).circuitMeta(6).inputs(new ItemStack(Blocks.COBBLESTONE, 1, 0)).outputs(new ItemStack(Blocks.COBBLESTONE_WALL, 1, 0)).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).circuitMeta(6).inputs(new ItemStack(Blocks.MOSSY_COBBLESTONE, 1, 0)).outputs(new ItemStack(Blocks.COBBLESTONE_WALL, 1, 1)).buildAndRegister(); @@ -998,8 +998,6 @@ private static void miscRecipes() { ASSEMBLER_RECIPES.recipeBuilder().duration(10).EUt(2).inputs(new ItemStack(Items.BRICK, 3)).outputs(new ItemStack(Items.FLOWER_POT)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(30).EUt(VA[ULV]).inputs(new ItemStack(Blocks.STONE_SLAB, 1, 0)).inputs(new ItemStack(Items.STICK, 6)).outputs(new ItemStack(Items.ARMOR_STAND)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(30).EUt(16).inputs(new ItemStack(Items.GHAST_TEAR)).inputs(new ItemStack(Items.ENDER_EYE)).outputs(new ItemStack(Items.END_CRYSTAL)).fluidInputs(Glass.getFluid(GTValues.L * 7)).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() @@ -1157,6 +1155,25 @@ private static void miscRecipes() { .input(dust, Blaze, 4) .output(stick, Blaze) .buildAndRegister(); + + ASSEMBLER_RECIPES.recipeBuilder() + .input(Blocks.TRIPWIRE_HOOK) + .input(Blocks.CHEST) + .output(Blocks.TRAPPED_CHEST) + .duration(200).EUt(4).buildAndRegister(); + + // All 16 bed colors + for (int i = 0; i <= 15; i++) { + addBedRecipe(i); + } + } + + private static void addBedRecipe(int meta) { + ASSEMBLER_RECIPES.recipeBuilder() + .inputs(new ItemStack(Blocks.WOOL, 3, meta)) + .input(plank, Wood, 3) + .outputs(new ItemStack(Items.BED, 1, meta)) + .duration(100).EUt(VA[ULV]).buildAndRegister(); } /** diff --git a/src/main/java/gregtech/loaders/recipe/WoodRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/WoodRecipeLoader.java index ab3e1d6e126..529218e9f44 100644 --- a/src/main/java/gregtech/loaders/recipe/WoodRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/WoodRecipeLoader.java @@ -44,7 +44,7 @@ private static List getDefaultEntries() { .planks(new ItemStack(Blocks.PLANKS), "oak_planks") .log(new ItemStack(Blocks.LOG)).removeCharcoalRecipe() .door(new ItemStack(Items.OAK_DOOR), "wooden_door") - .slab(new ItemStack(Blocks.WOODEN_SLAB)) + .slab(new ItemStack(Blocks.WOODEN_SLAB), "oak_wooden_slab") .fence(new ItemStack(Blocks.OAK_FENCE), "fence") .fenceGate(new ItemStack(Blocks.OAK_FENCE_GATE), "fence_gate") .stairs(new ItemStack(Blocks.OAK_STAIRS)) @@ -55,7 +55,7 @@ private static List getDefaultEntries() { .planks(new ItemStack(Blocks.PLANKS, 1, 1), "spruce_planks") .log(new ItemStack(Blocks.LOG, 1, 1)).removeCharcoalRecipe() .door(new ItemStack(Items.SPRUCE_DOOR), "spruce_door") - .slab(new ItemStack(Blocks.WOODEN_SLAB, 1, 1)) + .slab(new ItemStack(Blocks.WOODEN_SLAB, 1, 1), "spruce_wooden_slab") .fence(new ItemStack(Blocks.SPRUCE_FENCE), "spruce_fence") .fenceGate(new ItemStack(Blocks.SPRUCE_FENCE_GATE), "spruce_fence_gate") .stairs(new ItemStack(Blocks.SPRUCE_STAIRS)) @@ -66,7 +66,7 @@ private static List getDefaultEntries() { .planks(new ItemStack(Blocks.PLANKS, 1, 2), "birch_planks") .log(new ItemStack(Blocks.LOG, 1, 2)).removeCharcoalRecipe() .door(new ItemStack(Items.BIRCH_DOOR), "birch_door") - .slab(new ItemStack(Blocks.WOODEN_SLAB, 1, 2)) + .slab(new ItemStack(Blocks.WOODEN_SLAB, 1, 2), "birch_wooden_slab") .fence(new ItemStack(Blocks.BIRCH_FENCE), "birch_fence") .fenceGate(new ItemStack(Blocks.BIRCH_FENCE_GATE), "birch_fence_gate") .stairs(new ItemStack(Blocks.BIRCH_STAIRS)) @@ -77,7 +77,7 @@ private static List getDefaultEntries() { .planks(new ItemStack(Blocks.PLANKS, 1, 3), "jungle_planks") .log(new ItemStack(Blocks.LOG, 1, 3)).removeCharcoalRecipe() .door(new ItemStack(Items.JUNGLE_DOOR), "jungle_door") - .slab(new ItemStack(Blocks.WOODEN_SLAB, 1, 3)) + .slab(new ItemStack(Blocks.WOODEN_SLAB, 1, 3), "jungle_wooden_slab") .fence(new ItemStack(Blocks.JUNGLE_FENCE), "jungle_fence") .fenceGate(new ItemStack(Blocks.JUNGLE_FENCE_GATE), "jungle_fence_gate") .stairs(new ItemStack(Blocks.JUNGLE_STAIRS)) @@ -88,7 +88,7 @@ private static List getDefaultEntries() { .planks(new ItemStack(Blocks.PLANKS, 1, 4), "acacia_planks") .log(new ItemStack(Blocks.LOG2)).removeCharcoalRecipe() .door(new ItemStack(Items.ACACIA_DOOR), "acacia_door") - .slab(new ItemStack(Blocks.WOODEN_SLAB, 1, 4)) + .slab(new ItemStack(Blocks.WOODEN_SLAB, 1, 4), "acacia_wooden_slab") .fence(new ItemStack(Blocks.ACACIA_FENCE), "acacia_fence") .fenceGate(new ItemStack(Blocks.ACACIA_FENCE_GATE), "acacia_fence_gate") .stairs(new ItemStack(Blocks.ACACIA_STAIRS)) @@ -99,7 +99,7 @@ private static List getDefaultEntries() { .planks(new ItemStack(Blocks.PLANKS, 1, 5), "dark_oak_planks") .log(new ItemStack(Blocks.LOG2, 1, 1)).removeCharcoalRecipe() .door(new ItemStack(Items.DARK_OAK_DOOR), "dark_oak_door") - .slab(new ItemStack(Blocks.WOODEN_SLAB, 1, 5)) + .slab(new ItemStack(Blocks.WOODEN_SLAB, 1, 5), "dark_oak_wooden_slab") .fence(new ItemStack(Blocks.DARK_OAK_FENCE), "dark_oak_fence") .fenceGate(new ItemStack(Blocks.DARK_OAK_FENCE_GATE), "dark_oak_fence_gate") .stairs(new ItemStack(Blocks.DARK_OAK_STAIRS)) @@ -110,7 +110,7 @@ private static List getDefaultEntries() { .planks(MetaBlocks.PLANKS.getItemVariant(BlockGregPlanks.BlockType.RUBBER_PLANK), null) .log(new ItemStack(MetaBlocks.RUBBER_LOG)).addCharcoalRecipe() .door(MetaItems.RUBBER_WOOD_DOOR.getStackForm(), null) - .slab(new ItemStack(MetaBlocks.WOOD_SLAB)).addSlabRecipe() + .slab(new ItemStack(MetaBlocks.WOOD_SLAB), null).addSlabRecipe() .fence(new ItemStack(MetaBlocks.RUBBER_WOOD_FENCE), null) .fenceGate(new ItemStack(MetaBlocks.RUBBER_WOOD_FENCE_GATE), null) .stairs(new ItemStack(MetaBlocks.RUBBER_WOOD_STAIRS)).addStairsRecipe() @@ -121,7 +121,7 @@ private static List getDefaultEntries() { new WoodTypeEntry.Builder(GTValues.MODID, "treated") .planks(MetaBlocks.PLANKS.getItemVariant(BlockGregPlanks.BlockType.TREATED_PLANK), null) .door(MetaItems.TREATED_WOOD_DOOR.getStackForm(), null) - .slab(new ItemStack(MetaBlocks.WOOD_SLAB, 1, 1)).addSlabRecipe() + .slab(new ItemStack(MetaBlocks.WOOD_SLAB, 1, 1), null).addSlabRecipe() .fence(new ItemStack(MetaBlocks.TREATED_WOOD_FENCE), null) .fenceGate(new ItemStack(MetaBlocks.TREATED_WOOD_FENCE_GATE), null) .stairs(new ItemStack(MetaBlocks.TREATED_WOOD_STAIRS)).addStairsRecipe() @@ -340,7 +340,7 @@ public static void registerWoodTypeRecipe(@Nonnull WoodTypeEntry entry) { // slab if (!entry.slab.isEmpty()) { - if (entry.addSlabCraftingRecipe) { + if (entry.addSlabCraftingRecipe && !ConfigHolder.recipes.hardWoodRecipes) { ModHandler.addShapedRecipe(name + "_slab", GTUtility.copy(6, entry.slab), "PPP", 'P', entry.planks.copy()); } @@ -349,6 +349,10 @@ public static void registerWoodTypeRecipe(@Nonnull WoodTypeEntry entry) { ModHandler.addShapedRecipe(name + "_slab_saw", GTUtility.copy(2, entry.slab), "sS", 'S', entry.planks.copy()); + if (ConfigHolder.recipes.hardWoodRecipes && entry.slabRecipeName != null) { + ModHandler.removeRecipeByName(new ResourceLocation(entry.modid, entry.slabRecipeName)); + } + // plank -> slab cutting CUTTER_RECIPES.recipeBuilder() .inputs(entry.planks.copy()) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/AssemblerRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/chemistry/AssemblerRecipeLoader.java index 51b04c21534..90c271e2950 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/AssemblerRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/AssemblerRecipeLoader.java @@ -1,5 +1,6 @@ package gregtech.loaders.recipe.chemistry; +import gregtech.common.ConfigHolder; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -25,7 +26,7 @@ public static void init() { .input(gear, Bronze, 2) .input(frameGt, Bronze) .circuitMeta(4) - .outputs(TURBINE_CASING.getItemVariant(BRONZE_GEARBOX, 2)) + .outputs(TURBINE_CASING.getItemVariant(BRONZE_GEARBOX, ConfigHolder.recipes.casingsPerCraft)) .duration(50).EUt(16).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() @@ -33,7 +34,7 @@ public static void init() { .input(gear, Steel, 2) .input(frameGt, Steel) .circuitMeta(4) - .outputs(TURBINE_CASING.getItemVariant(STEEL_GEARBOX, 2)) + .outputs(TURBINE_CASING.getItemVariant(STEEL_GEARBOX, ConfigHolder.recipes.casingsPerCraft)) .duration(50).EUt(16).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() @@ -41,7 +42,7 @@ public static void init() { .input(gear, StainlessSteel, 2) .input(frameGt, StainlessSteel) .circuitMeta(4) - .outputs(TURBINE_CASING.getItemVariant(STAINLESS_STEEL_GEARBOX, 2)) + .outputs(TURBINE_CASING.getItemVariant(STAINLESS_STEEL_GEARBOX, ConfigHolder.recipes.casingsPerCraft)) .duration(50).EUt(16).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() @@ -49,7 +50,7 @@ public static void init() { .input(gear, Titanium, 2) .input(frameGt, Titanium) .circuitMeta(4) - .outputs(TURBINE_CASING.getItemVariant(TITANIUM_GEARBOX, 2)) + .outputs(TURBINE_CASING.getItemVariant(TITANIUM_GEARBOX, ConfigHolder.recipes.casingsPerCraft)) .duration(50).EUt(16).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() @@ -57,7 +58,7 @@ public static void init() { .input(gear, TungstenSteel, 2) .input(frameGt, TungstenSteel) .circuitMeta(4) - .outputs(TURBINE_CASING.getItemVariant(TUNGSTENSTEEL_GEARBOX, 2)) + .outputs(TURBINE_CASING.getItemVariant(TUNGSTENSTEEL_GEARBOX, ConfigHolder.recipes.casingsPerCraft)) .duration(50).EUt(16).buildAndRegister(); // Other @@ -65,14 +66,14 @@ public static void init() { .input(rotor, Titanium, 2) .input(pipeNormalFluid, Titanium, 4) .inputs(METAL_CASING.getItemVariant(TITANIUM_STABLE)) - .outputs(MULTIBLOCK_CASING.getItemVariant(ENGINE_INTAKE_CASING, 2)) + .outputs(MULTIBLOCK_CASING.getItemVariant(ENGINE_INTAKE_CASING, ConfigHolder.recipes.casingsPerCraft)) .duration(50).EUt(16).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() .input(rotor, TungstenSteel, 2) .input(pipeNormalFluid, TungstenSteel, 4) .inputs(METAL_CASING.getItemVariant(TUNGSTENSTEEL_ROBUST)) - .outputs(MULTIBLOCK_CASING.getItemVariant(EXTREME_ENGINE_INTAKE_CASING, 2)) + .outputs(MULTIBLOCK_CASING.getItemVariant(EXTREME_ENGINE_INTAKE_CASING, ConfigHolder.recipes.casingsPerCraft)) .duration(50).EUt(16).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/MixerRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/MixerRecipes.java index e609e269243..84d91cff0eb 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/MixerRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/MixerRecipes.java @@ -238,6 +238,19 @@ public static void init() { .output(dust, BlackSteel, 5) .buildAndRegister(); + // Black Steel shortcut + // Normal recipe would be 125 ticks per recipe at HV overclock, plus 125 ticks for the Black Bronze step, + // for a total of 750 ticks. This recipe is 5 batches at once, so is equivalent time but saves a step. + MIXER_RECIPES.recipeBuilder().duration(750).EUt(VA[HV]) + .input(dust, Copper, 3) + .input(dust, Gold) + .input(dust, Silver) + .input(dust, Nickel, 5) + .input(dust, Steel, 15) + .circuitMeta(2) + .output(dust, BlackSteel, 25) + .buildAndRegister(); + MIXER_RECIPES.recipeBuilder().duration(600).EUt(VA[ULV]) .input(dust, Saltpeter, 2) .input(dust, Sulfur) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/NaquadahRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/NaquadahRecipes.java index 1ba379212d8..9f97848d65c 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/NaquadahRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/NaquadahRecipes.java @@ -74,7 +74,7 @@ public static void init() { CENTRIFUGE_RECIPES.recipeBuilder().EUt(VA[HV]).duration(100) .fluidInputs(AcidicEnrichedNaquadahSolution.getFluid(3000)) .fluidOutputs(EnrichedNaquadahWaste.getFluid(2000)) - .fluidOutputs(Fluorine.getFluid(500)) + .fluidOutputs(Fluorine.getFluid(250)) .output(dust, EnrichedNaquadahSulfate, 6) // Nq+SO4 .buildAndRegister(); @@ -89,8 +89,8 @@ public static void init() { .fluidInputs(EnrichedNaquadahWaste.getFluid(2000)) .output(dustSmall, BariumSulfide, 2) .fluidOutputs(SulfuricAcid.getFluid(500)) - .fluidOutputs(EnrichedNaquadahSolution.getFluid(250)) - .fluidOutputs(NaquadriaSolution.getFluid(100)) + .fluidOutputs(EnrichedNaquadahSolution.getFluid(350)) + .fluidOutputs(NaquadriaSolution.getFluid(150)) .buildAndRegister(); @@ -112,7 +112,7 @@ public static void init() { CENTRIFUGE_RECIPES.recipeBuilder().EUt(VA[HV]).duration(100) .fluidInputs(AcidicNaquadriaSolution.getFluid(3000)) .fluidOutputs(NaquadriaWaste.getFluid(2000)) - .fluidOutputs(Fluorine.getFluid(500)) + .fluidOutputs(Fluorine.getFluid(250)) .output(dust, NaquadriaSulfate, 6) .buildAndRegister(); @@ -127,8 +127,8 @@ public static void init() { .fluidInputs(NaquadriaWaste.getFluid(2000)) .output(dustSmall, GalliumSulfide, 2) .fluidOutputs(SulfuricAcid.getFluid(500)) - .fluidOutputs(NaquadriaSolution.getFluid(250)) - .fluidOutputs(EnrichedNaquadahSolution.getFluid(100)) + .fluidOutputs(NaquadriaSolution.getFluid(350)) + .fluidOutputs(EnrichedNaquadahSolution.getFluid(150)) .buildAndRegister(); diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/ReactorRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/ReactorRecipes.java index 21f156af56f..6f206dc4161 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/ReactorRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/ReactorRecipes.java @@ -99,25 +99,6 @@ public static void init() { .fluidOutputs(DilutedHydrochloricAcid.getFluid(1000)) .duration(240).EUt(96).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder() - .input(dust, Silicon) - .fluidInputs(HydrochloricAcid.getFluid(2000)) - .fluidInputs(Methanol.getFluid(2000)) - .output(dust, Polydimethylsiloxane, 3) - .fluidOutputs(DilutedHydrochloricAcid.getFluid(2000)) - .duration(480).EUt(96).buildAndRegister(); - - CHEMICAL_RECIPES.recipeBuilder() - .circuitMeta(2) - .input(dust, Silicon) - .fluidInputs(Water.getFluid(1000)) - .fluidInputs(Chlorine.getFluid(4000)) - .fluidInputs(Methane.getFluid(2000)) - .output(dust, Polydimethylsiloxane, 3) - .fluidOutputs(HydrochloricAcid.getFluid(2000)) - .fluidOutputs(DilutedHydrochloricAcid.getFluid(2000)) - .duration(480).EUt(96).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder() .fluidInputs(Chlorine.getFluid(1000)) .fluidInputs(Hydrogen.getFluid(1000)) @@ -142,14 +123,6 @@ public static void init() { .duration(400).EUt(VA[LV]) .buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder() - .circuitMeta(3) - .fluidInputs(Chlorine.getFluid(2000)) - .fluidInputs(Methane.getFluid(1000)) - .fluidOutputs(HydrochloricAcid.getFluid(1000)) - .fluidOutputs(Chloromethane.getFluid(1000)) - .duration(80).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder() .fluidInputs(Chlorine.getFluid(4000)) .fluidInputs(Benzene.getFluid(1000)) @@ -339,6 +312,7 @@ public static void init() { .duration(480).EUt(VA[LV]).buildAndRegister(); CHEMICAL_RECIPES.recipeBuilder() + .circuitMeta(1) .input(dust, Aluminium, 4) .fluidInputs(IndiumConcentrate.getFluid(1000)) .output(dustSmall, Indium) @@ -423,7 +397,7 @@ public static void init() { .fluidInputs(Methanol.getFluid(1000)) .fluidOutputs(Water.getFluid(1000)) .fluidOutputs(Chloromethane.getFluid(1000)) - .duration(160).EUt(VA[LV]).buildAndRegister(); + .duration(80).EUt(VA[LV]).buildAndRegister(); CHEMICAL_RECIPES.recipeBuilder() .circuitMeta(2) diff --git a/src/main/java/gregtech/loaders/recipe/handlers/OreRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/OreRecipeHandler.java index e5b6a50f4c2..607927419fa 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/OreRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/OreRecipeHandler.java @@ -86,7 +86,7 @@ public static void processOre(OrePrefix orePrefix, Material material, OrePropert RecipeBuilder builder = RecipeMaps.FORGE_HAMMER_RECIPES.recipeBuilder() .input(orePrefix, material) .duration(10).EUt(16); - if (material.hasProperty(PropertyKey.GEM) && !OrePrefix.gem.isIgnored(material)) { + if (material.hasProperty(PropertyKey.GEM) && !OreDictUnifier.get(OrePrefix.gem, material).isEmpty()) { builder.outputs(GTUtility.copy((int) Math.ceil(amountOfCrushedOre) * oreTypeMultiplier, OreDictUnifier.get(OrePrefix.gem, material, crushedStack.getCount()))); } else { builder.outputs(GTUtility.copy((int) Math.ceil(amountOfCrushedOre) * oreTypeMultiplier, crushedStack)); diff --git a/src/main/java/gregtech/loaders/recipe/handlers/PartsRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/PartsRecipeHandler.java index 13c8daee651..21eb68cab9f 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/PartsRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/PartsRecipeHandler.java @@ -38,7 +38,7 @@ public static void register() { OrePrefix.stickLong.addProcessingHandler(PropertyKey.DUST, PartsRecipeHandler::processLongStick); OrePrefix.plate.addProcessingHandler(PropertyKey.DUST, PartsRecipeHandler::processPlate); OrePrefix.plateDouble.addProcessingHandler(PropertyKey.INGOT, PartsRecipeHandler::processPlateDouble); - OrePrefix.plateDense.addProcessingHandler(PropertyKey.INGOT, PartsRecipeHandler::processPlateDense); + OrePrefix.plateDense.addProcessingHandler(PropertyKey.DUST, PartsRecipeHandler::processPlateDense); OrePrefix.turbineBlade.addProcessingHandler(PropertyKey.INGOT, PartsRecipeHandler::processTurbine); OrePrefix.rotor.addProcessingHandler(PropertyKey.INGOT, PartsRecipeHandler::processRotor); @@ -164,7 +164,7 @@ public static void processFineWire(OrePrefix fineWirePrefix, Material material, .input(OrePrefix.ingot, material) .circuitMeta(3) .output(fineWirePrefix, material, 8) - .duration((int) material.getMass() * 3) + .duration((int) material.getMass() * 2) .EUt(VA[ULV]) .buildAndRegister(); } @@ -318,7 +318,7 @@ public static void processPlateDouble(OrePrefix doublePrefix, Material material, } } - public static void processPlateDense(OrePrefix orePrefix, Material material, IngotProperty property) { + public static void processPlateDense(OrePrefix orePrefix, Material material, DustProperty property) { RecipeMaps.BENDER_RECIPES.recipeBuilder() .input(OrePrefix.plate, material, 9) .circuitMeta(9) @@ -327,13 +327,15 @@ public static void processPlateDense(OrePrefix orePrefix, Material material, Ing .EUt(96) .buildAndRegister(); - RecipeMaps.BENDER_RECIPES.recipeBuilder() - .input(OrePrefix.ingot, material, 9) - .circuitMeta(9) - .output(orePrefix, material) - .duration((int) Math.max(material.getMass() * 9L, 1L)) - .EUt(96) - .buildAndRegister(); + if (material.hasProperty(PropertyKey.INGOT)) { + RecipeMaps.BENDER_RECIPES.recipeBuilder() + .input(OrePrefix.ingot, material, 9) + .circuitMeta(9) + .output(orePrefix, material) + .duration((int) Math.max(material.getMass() * 9L, 1L)) + .EUt(96) + .buildAndRegister(); + } } public static void processRing(OrePrefix ringPrefix, Material material, IngotProperty property) { diff --git a/src/main/java/gregtech/loaders/recipe/handlers/PipeRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/PipeRecipeHandler.java index 4a677f56407..cccaa0043f7 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/PipeRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/PipeRecipeHandler.java @@ -135,7 +135,7 @@ private static void processPipeSmall(OrePrefix pipePrefix, Material material, IM } else { if (ModHandler.isMaterialWood(material)) { ModHandler.addShapedRecipe(String.format("small_%s_pipe", material), - pipeStack, "wXr", + pipeStack, "sXr", 'X', new UnificationEntry(OrePrefix.plank, material)); ASSEMBLER_RECIPES.recipeBuilder().duration(200).EUt(VA[LV]) @@ -177,7 +177,7 @@ private static void processPipeNormal(OrePrefix pipePrefix, Material material, I } else { if (ModHandler.isMaterialWood(material)) { ModHandler.addShapedRecipe(String.format("medium_%s_pipe", material), - pipeStack, "XXX", "w r", + pipeStack, "XXX", "s r", 'X', new UnificationEntry(OrePrefix.plank, material)); ASSEMBLER_RECIPES.recipeBuilder().duration(200).EUt(VA[LV]) @@ -219,7 +219,7 @@ private static void processPipeLarge(OrePrefix pipePrefix, Material material, IM } else { if (ModHandler.isMaterialWood(material)) { ModHandler.addShapedRecipe(String.format("large_%s_pipe", material), - pipeStack, "XXX", "w r", "XXX", + pipeStack, "XXX", "s r", "XXX", 'X', new UnificationEntry(OrePrefix.plank, material)); ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]) @@ -261,7 +261,7 @@ private static void processPipeHuge(OrePrefix pipePrefix, Material material, IMa } else if (OrePrefix.plateDouble.doGenerateItem(material)) { if (ModHandler.isMaterialWood(material)) { ModHandler.addShapedRecipe(String.format("huge_%s_pipe", material), - pipeStack, "XXX", "w r", "XXX", + pipeStack, "XXX", "s r", "XXX", 'X', new UnificationEntry(OrePrefix.plateDouble, material)); ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]) diff --git a/src/main/java/gregtech/loaders/recipe/handlers/ToolRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/ToolRecipeHandler.java index b18f4758541..dd19521cab9 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/ToolRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/ToolRecipeHandler.java @@ -174,7 +174,7 @@ private static void processTool(OrePrefix prefix, Material material, ToolPropert 'S', stick); addToolRecipe(material, ToolItems.FILE, true, - " P ", " P " , " S ", + "P", "P", "S", 'P', plate, 'S', stick); diff --git a/src/main/java/gregtech/loaders/recipe/handlers/WireRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/WireRecipeHandler.java index f06ad46f351..851b221312f 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/WireRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/WireRecipeHandler.java @@ -89,7 +89,7 @@ public static void processWireSingle(OrePrefix wirePrefix, Material material, Wi .input(prefix, material, multiplier) .circuitMeta(multiplier * 2) .output(wireSize, material) - .duration((int) (material.getMass() * multiplier * 2)) + .duration((int) (material.getMass() * multiplier)) .EUt(getVoltageMultiplier(material)) .buildAndRegister(); } diff --git a/src/main/java/gregtech/modules/GregTechModules.java b/src/main/java/gregtech/modules/GregTechModules.java index 47a06706418..7a5ede9668a 100644 --- a/src/main/java/gregtech/modules/GregTechModules.java +++ b/src/main/java/gregtech/modules/GregTechModules.java @@ -16,6 +16,7 @@ public class GregTechModules implements IModuleContainer { public static final String MODULE_OC = "oc_integration"; public static final String MODULE_HWYLA = "hwyla_integration"; public static final String MODULE_BAUBLES = "baubles_integration"; + public static final String MODULE_FR = "fr_integration"; @Override public String getID() { diff --git a/src/main/java/gregtech/modules/ModuleManager.java b/src/main/java/gregtech/modules/ModuleManager.java index e3ed6ad8da6..8cf46d333ef 100644 --- a/src/main/java/gregtech/modules/ModuleManager.java +++ b/src/main/java/gregtech/modules/ModuleManager.java @@ -2,9 +2,12 @@ import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; +import gregtech.api.GTValues; import gregtech.api.modules.*; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.discovery.ASMDataTable; import net.minecraftforge.fml.common.event.*; @@ -13,15 +16,16 @@ import java.io.File; import java.util.*; +import java.util.stream.Collectors; public class ModuleManager implements IModuleManager { private static final ModuleManager INSTANCE = new ModuleManager(); - //private static final String MODULE_CFG_FILE_NAME = "modules.cfg"; - //private static final String MODULE_CFG_CATEGORY_NAME = "modules"; - //private static File configFolder; + private static final String MODULE_CFG_FILE_NAME = "modules.cfg"; + private static final String MODULE_CFG_CATEGORY_NAME = "modules"; + private static File configFolder; - private final Map containers = new HashMap<>(); + private Map containers = new LinkedHashMap<>(); private final Map sortedModules = new LinkedHashMap<>(); private final Set loadedModules = new LinkedHashSet<>(); @@ -29,7 +33,7 @@ public class ModuleManager implements IModuleManager { private ModuleStage currentStage = ModuleStage.C_SETUP; private final Logger logger = LogManager.getLogger("GregTech Module Loader"); - //private Configuration config; + private Configuration config; private ModuleManager() { } @@ -44,11 +48,10 @@ public boolean isModuleEnabled(ResourceLocation id) { } public boolean isModuleEnabled(IGregTechModule module) { - return true; - //GregTechModule annotation = module.getClass().getAnnotation(GregTechModule.class); - //String comment = getComment(module); - //Property prop = getConfiguration().get(MODULE_CFG_CATEGORY_NAME, annotation.containerID() + ":" + annotation.moduleID(), true, comment); - //return prop.getBoolean(); + GregTechModule annotation = module.getClass().getAnnotation(GregTechModule.class); + String comment = getComment(module); + Property prop = getConfiguration().get(MODULE_CFG_CATEGORY_NAME, annotation.containerID() + ":" + annotation.moduleID(), true, comment); + return prop.getBoolean(); } @Override @@ -77,8 +80,16 @@ public void registerContainer(IModuleContainer container) { } public void setup(ASMDataTable asmDataTable, File configDirectory) { + // find and register all containers registered with the @ModuleContainer annotation, then sort them by container name + discoverContainers(asmDataTable); + containers = containers.entrySet().stream() + .sorted(Map.Entry.comparingByKey()) + .collect(Collectors.toMap( + Map.Entry::getKey, Map.Entry::getValue, (a, b) -> a, LinkedHashMap::new + )); + currentStage = ModuleStage.M_SETUP; - //configFolder = new File(configDirectory, GTValues.MODID); + configFolder = new File(configDirectory, GTValues.MODID); Map> modules = getModules(asmDataTable); configureModules(modules); @@ -202,18 +213,18 @@ public void processIMC(ImmutableList messages) { } private void configureModules(Map> modules) { - //Locale locale = Locale.getDefault(); - //Locale.setDefault(Locale.ENGLISH); - Set toLoad = new HashSet<>(); - Set modulesToLoad = new HashSet<>(); - //Configuration config = getConfiguration(); + Locale locale = Locale.getDefault(); + Locale.setDefault(Locale.ENGLISH); + Set toLoad = new LinkedHashSet<>(); + Set modulesToLoad = new LinkedHashSet<>(); + Configuration config = getConfiguration(); for (IModuleContainer container : containers.values()) { String containerID = container.getID(); List containerModules = modules.get(containerID); - //config.load(); - //config.addCustomCategoryComment(MODULE_CFG_CATEGORY_NAME, - // "Module configuration file. Can individually enable/disable modules from GregTech and its addons"); + config.load(); + config.addCustomCategoryComment(MODULE_CFG_CATEGORY_NAME, + "Module configuration file. Can individually enable/disable modules from GregTech and its addons"); IGregTechModule coreModule = getCoreModule(containerModules); if (coreModule == null) { throw new IllegalStateException("Could not find core module for module container " + containerID); @@ -259,7 +270,7 @@ private void configureModules(Map> modules) { } } while (changed); - // Sort modules + // Sort modules by their module dependencies do { changed = false; iterator = modulesToLoad.iterator(); @@ -277,10 +288,10 @@ private void configureModules(Map> modules) { loadedModules.addAll(sortedModules.values()); - //if (config.hasChanged()) { - // config.save(); - //} - //Locale.setDefault(locale); + if (config.hasChanged()) { + config.save(); + } + Locale.setDefault(locale); } private static IGregTechModule getCoreModule(List modules) { @@ -326,15 +337,29 @@ private List getInstances(ASMDataTable table) { logger.info("Module {} is missing at least one of mod dependencies: {}, skipping loading...", moduleID, modDependencies); } } - return instances; + return instances.stream().sorted((m1, m2) -> { + GregTechModule m1a = m1.getClass().getAnnotation(GregTechModule.class); + GregTechModule m2a = m2.getClass().getAnnotation(GregTechModule.class); + return (m1a.containerID() + ":" + m1a.moduleID()).compareTo(m2a.containerID() + ":" + m2a.moduleID()); + }).collect(Collectors.toCollection(ArrayList::new)); + } + + private void discoverContainers(ASMDataTable table) { + Set dataSet = table.getAll(ModuleContainer.class.getCanonicalName()); + for (ASMDataTable.ASMData data : dataSet) { + try { + Class clazz = Class.forName(data.getClassName()); + registerContainer((IModuleContainer) clazz.newInstance()); + } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) { + logger.error("Could not initialize module container " + data.getClassName(), e); + } + } } - /* - @SuppressWarnings("deprecation") private String getComment(IGregTechModule module) { GregTechModule annotation = module.getClass().getAnnotation(GregTechModule.class); - String comment = I18n.translateToLocal(annotation.descriptionKey()); + String comment = annotation.description(); Set dependencies = module.getDependencyUids(); if (!dependencies.isEmpty()) { Iterator iterator = dependencies.iterator(); @@ -348,9 +373,9 @@ private String getComment(IGregTechModule module) { builder.append(" ]"); comment = builder.toString(); } - Set modDependencies = module.getModDependencyIDs(); - if (!modDependencies.isEmpty()) { - Iterator iterator = modDependencies.iterator(); + String[] modDependencies = annotation.modDependencies(); + if (modDependencies != null && modDependencies.length > 0) { + Iterator iterator = Arrays.stream(modDependencies).iterator(); StringBuilder builder = new StringBuilder(comment); builder.append("\n"); builder.append("Mod Dependencies: [ "); @@ -370,5 +395,4 @@ private Configuration getConfiguration() { } return config; } - */ } diff --git a/src/main/java/gregtech/tools/ToolsModule.java b/src/main/java/gregtech/tools/ToolsModule.java index 249c876da18..85fa3e8a003 100644 --- a/src/main/java/gregtech/tools/ToolsModule.java +++ b/src/main/java/gregtech/tools/ToolsModule.java @@ -1,11 +1,11 @@ package gregtech.tools; import gregtech.api.GTValues; -import gregtech.tools.enchants.EnchantmentEnderDamage; -import gregtech.tools.enchants.EnchantmentHardHammer; import gregtech.api.modules.GregTechModule; import gregtech.modules.BaseGregTechModule; import gregtech.modules.GregTechModules; +import gregtech.tools.enchants.EnchantmentEnderDamage; +import gregtech.tools.enchants.EnchantmentHardHammer; import net.minecraft.enchantment.Enchantment; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -20,7 +20,7 @@ moduleID = GregTechModules.MODULE_TOOLS, containerID = GTValues.MODID, name = "GregTech Tools", - descriptionKey = "gregtech.modules.tools.description" + description = "GregTech Tools Module. Cannot be disabled for now." ) public class ToolsModule extends BaseGregTechModule { diff --git a/src/main/resources/assets/forestry/models/item/gt.comb.json b/src/main/resources/assets/forestry/models/item/gt.comb.json new file mode 100644 index 00000000000..6b57b53f07a --- /dev/null +++ b/src/main/resources/assets/forestry/models/item/gt.comb.json @@ -0,0 +1,19 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "forestry:items/bee_combs.0", + "layer1": "forestry:items/bee_combs.1" + }, + "display": { + "thirdperson": { + "rotation": [ 0, 90, -35 ], + "translation": [ 0, 1.25, -3.5 ], + "scale": [ 0.85, 0.85, 0.85 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/forestry/models/item/gt.frame_accelerated.json b/src/main/resources/assets/forestry/models/item/gt.frame_accelerated.json new file mode 100644 index 00000000000..273034bd250 --- /dev/null +++ b/src/main/resources/assets/forestry/models/item/gt.frame_accelerated.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "forestry:items/gt.frame_accelerated" + } +} diff --git a/src/main/resources/assets/forestry/models/item/gt.frame_arborist.json b/src/main/resources/assets/forestry/models/item/gt.frame_arborist.json new file mode 100644 index 00000000000..a6fdf89a8dd --- /dev/null +++ b/src/main/resources/assets/forestry/models/item/gt.frame_arborist.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "forestry:items/gt.frame_arborist" + } +} diff --git a/src/main/resources/assets/forestry/models/item/gt.frame_decaying.json b/src/main/resources/assets/forestry/models/item/gt.frame_decaying.json new file mode 100644 index 00000000000..7215205537f --- /dev/null +++ b/src/main/resources/assets/forestry/models/item/gt.frame_decaying.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "forestry:items/gt.frame_decaying" + } +} diff --git a/src/main/resources/assets/forestry/models/item/gt.frame_mutagenic.json b/src/main/resources/assets/forestry/models/item/gt.frame_mutagenic.json new file mode 100644 index 00000000000..443a47958e2 --- /dev/null +++ b/src/main/resources/assets/forestry/models/item/gt.frame_mutagenic.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "forestry:items/gt.frame_mutagenic" + } +} diff --git a/src/main/resources/assets/forestry/models/item/gt.frame_slowing.json b/src/main/resources/assets/forestry/models/item/gt.frame_slowing.json new file mode 100644 index 00000000000..ece45f39569 --- /dev/null +++ b/src/main/resources/assets/forestry/models/item/gt.frame_slowing.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "forestry:items/gt.frame_slowing" + } +} diff --git a/src/main/resources/assets/forestry/models/item/gt.frame_stabilizing.json b/src/main/resources/assets/forestry/models/item/gt.frame_stabilizing.json new file mode 100644 index 00000000000..9ede9582be1 --- /dev/null +++ b/src/main/resources/assets/forestry/models/item/gt.frame_stabilizing.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "forestry:items/gt.frame_stabilizing" + } +} diff --git a/src/main/resources/assets/forestry/models/item/gt.frame_working.json b/src/main/resources/assets/forestry/models/item/gt.frame_working.json new file mode 100644 index 00000000000..0a46ad208c5 --- /dev/null +++ b/src/main/resources/assets/forestry/models/item/gt.frame_working.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "forestry:items/gt.frame_working" + } +} diff --git a/src/main/resources/assets/forestry/models/item/gt.honey_drop.json b/src/main/resources/assets/forestry/models/item/gt.honey_drop.json new file mode 100644 index 00000000000..3cffc71c9fa --- /dev/null +++ b/src/main/resources/assets/forestry/models/item/gt.honey_drop.json @@ -0,0 +1,7 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "forestry:items/honey_drop.0", + "layer1": "forestry:items/honey_drop.1" + } +} diff --git a/src/main/resources/assets/forestry/textures/items/gt.frame_accelerated.png b/src/main/resources/assets/forestry/textures/items/gt.frame_accelerated.png new file mode 100644 index 00000000000..313b63efb85 Binary files /dev/null and b/src/main/resources/assets/forestry/textures/items/gt.frame_accelerated.png differ diff --git a/src/main/resources/assets/forestry/textures/items/gt.frame_arborist.png b/src/main/resources/assets/forestry/textures/items/gt.frame_arborist.png new file mode 100644 index 00000000000..38b9bd9c88a Binary files /dev/null and b/src/main/resources/assets/forestry/textures/items/gt.frame_arborist.png differ diff --git a/src/main/resources/assets/forestry/textures/items/gt.frame_decaying.png b/src/main/resources/assets/forestry/textures/items/gt.frame_decaying.png new file mode 100644 index 00000000000..df59b3d2d4d Binary files /dev/null and b/src/main/resources/assets/forestry/textures/items/gt.frame_decaying.png differ diff --git a/src/main/resources/assets/forestry/textures/items/gt.frame_mutagenic.png b/src/main/resources/assets/forestry/textures/items/gt.frame_mutagenic.png new file mode 100644 index 00000000000..5de050b62a2 Binary files /dev/null and b/src/main/resources/assets/forestry/textures/items/gt.frame_mutagenic.png differ diff --git a/src/main/resources/assets/forestry/textures/items/gt.frame_slowing.png b/src/main/resources/assets/forestry/textures/items/gt.frame_slowing.png new file mode 100644 index 00000000000..2dd97150ccc Binary files /dev/null and b/src/main/resources/assets/forestry/textures/items/gt.frame_slowing.png differ diff --git a/src/main/resources/assets/forestry/textures/items/gt.frame_stabilizing.png b/src/main/resources/assets/forestry/textures/items/gt.frame_stabilizing.png new file mode 100644 index 00000000000..0644484d2f0 Binary files /dev/null and b/src/main/resources/assets/forestry/textures/items/gt.frame_stabilizing.png differ diff --git a/src/main/resources/assets/forestry/textures/items/gt.frame_working.png b/src/main/resources/assets/forestry/textures/items/gt.frame_working.png new file mode 100644 index 00000000000..9217124d867 Binary files /dev/null and b/src/main/resources/assets/forestry/textures/items/gt.frame_working.png differ diff --git a/src/main/resources/assets/gregtech/advancements/steam/13_steel.json b/src/main/resources/assets/gregtech/advancements/steam/13_steel.json index 8958344b6d1..aba72269dbc 100644 --- a/src/main/resources/assets/gregtech/advancements/steam/13_steel.json +++ b/src/main/resources/assets/gregtech/advancements/steam/13_steel.json @@ -1,29 +1,29 @@ -{ - "display": { - "description": { - "translate": "gregtech.advancement.steam.13_steel.desc" - }, - "title": { - "translate": "gregtech.advancement.steam.13_steel.name" - }, - "icon": { - "item": "gregtech:meta_ingot", - "data": 324 - }, - "frame": "goal" - }, - "criteria": { - "location": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "type": "forge:ore_dict", - "ore": "ingotSteel" - } - ] - } - } - }, - "parent": "gregtech:steam/3_bronze_dust" -} +{ + "display": { + "description": { + "translate": "gregtech.advancement.steam.13_steel.desc" + }, + "title": { + "translate": "gregtech.advancement.steam.13_steel.name" + }, + "icon": { + "item": "gregtech:meta_ingot", + "data": 324 + }, + "frame": "challenge" + }, + "criteria": { + "location": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "type": "forge:ore_dict", + "ore": "ingotSteel" + } + ] + } + } + }, + "parent": "gregtech:steam/91_primitive_blast_furnace" +} diff --git a/src/main/resources/assets/gregtech/advancements/steam/91_primitive_blast_furnace.json b/src/main/resources/assets/gregtech/advancements/steam/91_primitive_blast_furnace.json new file mode 100644 index 00000000000..dd449df67a0 --- /dev/null +++ b/src/main/resources/assets/gregtech/advancements/steam/91_primitive_blast_furnace.json @@ -0,0 +1,29 @@ +{ + "display": { + "description": { + "translate": "gregtech.advancement.steam.91_primitive_blast_furnace.desc" + }, + "title": { + "translate": "gregtech.advancement.steam.91_primitive_blast_furnace.name" + }, + "icon": { + "item": "gregtech:machine", + "data": 1000 + }, + "frame": "goal" + }, + "criteria": { + "location": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "gregtech:machine", + "data": 1000 + } + ] + } + } + }, + "parent": "gregtech:steam/3_bronze_dust" +} diff --git a/src/main/resources/assets/gregtech/lang/en_us.lang b/src/main/resources/assets/gregtech/lang/en_us.lang index 27e9235915c..e8cfa6eed00 100644 --- a/src/main/resources/assets/gregtech/lang/en_us.lang +++ b/src/main/resources/assets/gregtech/lang/en_us.lang @@ -42,7 +42,7 @@ enchantment.disjunction=Disjunction gregtech.machine.steam_grinder.name=Steam Grinder gregtech.multiblock.steam_grinder.description=A Multiblock Macerator at the Steam Age. Requires at least 14 Bronze Casings to form. Cannot use normal Input/Output busses, nor Fluid Hatches other than the Steam Hatch. gregtech.multiblock.steam.low_steam=Not enough Steam to run! -gregtech.multiblock.steam.steam_stored=Steam: %s / %s mb +gregtech.multiblock.steam.steam_stored=Steam: %s gregtech.machine.steam_hatch.name=Steam Hatch gregtech.machine.steam.steam_hatch.tooltip=§eAccepted Fluid: §fSteam gregtech.machine.steam_import_bus.name=Input Bus (Steam) @@ -57,12 +57,13 @@ gregtech.top.working_disabled=Working Disabled gregtech.top.energy_consumption=Using gregtech.top.energy_production=Producing -gregtech.top.of=of gregtech.top.transform_up=Step Up gregtech.top.transform_down=Step Down gregtech.top.transform_input=Input: gregtech.top.transform_output=Output: +gregtech.top.steam_heating_up=Heating up +gregtech.top.steam_no_water=No Water gregtech.top.convert_eu=Converting §eEU§r -> §cFE§r gregtech.top.convert_fe=Converting §cFE§r -> §eEU§r @@ -127,8 +128,7 @@ gregtech.multiblock.assembly_line.description=The Assembly Line is a large multi gregtech.multiblock.fusion_reactor.luv.description=The Fusion Reactor Mark 1 is a large multiblock structure used for fusing elements into heavier ones. It can only use LuV, ZPM, and UV Energy Hatches. For every Hatch it has, its buffer increases by 10M EU, and has a maximum of 160M. gregtech.multiblock.fusion_reactor.zpm.description=The Fusion Reactor Mark 2 is a large multiblock structure used for fusing elements into heavier ones. It can only use ZPM and UV Energy Hatches. For every Hatch it has, its buffer increases by 20M EU, and has a maximum of 320M. gregtech.multiblock.fusion_reactor.uv.description=The Fusion Reactor Mark 3 is a large multiblock structure used for fusing elements into heavier ones. It can only use UV Energy Hatches. For every Hatch it has, its buffer increases by 40M EU, and has a maximum of 640M. -gregtech.multiblock.fusion_reactor.energy=EU: %d / %d -gregtech.multiblock.fusion_reactor.heat=Heat: %d +gregtech.multiblock.fusion_reactor.heat=Heat: %s gregtech.multiblock.large_chemical_reactor.description=The Large Chemical Reactor performs chemical reactions at 100%% energy efficiency. Overclocks multiply both speed and energy by 4. The multiblock requires exactly 1 Cupronickel Coil Block, which must be placed adjacent to the PTFE Pipe casing located in the center. gregtech.multiblock.primitive_water_pump.description=The Primitive Water Pump is a pre-Steam Era multiblock that collects water once per second, depending on the Biome it is in. It can use a Pump, ULV, or LV Output Hatch, increasing the amount of water per tier. Follows the formula: Biome Coefficient * Hatch Multiplier. gregtech.multiblock.primitive_water_pump.extra1=Biome Coefficient:/n Ocean, River: 1000 L/s/n Swamp: 800 L/s/n Jungle: 350 L/s/n Snowy: 300 L/s/n Plains, Forest: 250 L/s/n Taiga: 175 L/s/n Beach: 170 L/s/n Other: 100 L/s @@ -796,6 +796,8 @@ metaitem.neutron_reflector.name=Iridium Neutron Reflector metaitem.neutron_reflector.tooltip=Indestructible metaitem.duct_tape.name=BrainTech Aerospace Advanced Reinforced Duct Tape FAL-84 metaitem.duct_tape.tooltip=If you can't fix it with this, use more of it! +metaitem.basic_tape.name=Tape +metaitem.basic_tape.tooltip=Not strong enough for mechanical issues metaitem.component.grinder.diamond.name=Diamond Grinding Head metaitem.component.grinder.tungsten.name=Tungsten Grinding Head @@ -1180,6 +1182,48 @@ cover.ore_dictionary_filter.status.warn=§7%s warning(s) cover.ore_dictionary_filter.status.no_issues=§aNo issues cover.ore_dictionary_filter.status.explain=Ore filter explanation: +cover.ore_dictionary_filter.preview.next=... followed by +cover.ore_dictionary_filter.preview.match='%s' +cover.ore_dictionary_filter.preview.match.not=not '%s' +cover.ore_dictionary_filter.preview.char=1 character +cover.ore_dictionary_filter.preview.char.not=either more than 1 character or nothing +cover.ore_dictionary_filter.preview.chars=%s characters +cover.ore_dictionary_filter.preview.chars.not=either more or less than %s characters +cover.ore_dictionary_filter.preview.chars_or_more=%s or more characters +cover.ore_dictionary_filter.preview.chars_or_more.not=less than %s characters +cover.ore_dictionary_filter.preview.group=not: +cover.ore_dictionary_filter.preview.or=one of... +cover.ore_dictionary_filter.preview.nor=anything that isn't one of... +cover.ore_dictionary_filter.preview.or.entry= +cover.ore_dictionary_filter.preview.or.entry.start= +cover.ore_dictionary_filter.preview.and=anything that is... +cover.ore_dictionary_filter.preview.nand=anything that isn't... +cover.ore_dictionary_filter.preview.and.entry= +cover.ore_dictionary_filter.preview.and.entry.start= +cover.ore_dictionary_filter.preview.xor=only one of... +cover.ore_dictionary_filter.preview.xnor=either both or none of... +cover.ore_dictionary_filter.preview.xor.entry= +cover.ore_dictionary_filter.preview.everything=anything +cover.ore_dictionary_filter.preview.impossible=(impossible to match) +cover.ore_dictionary_filter.preview.nonempty=something +cover.ore_dictionary_filter.preview.empty=nothing +cover.ore_dictionary_filter.preview.error=ERROR! + +cover.ore_dictionary_filter.compile.eof=** End of line ** + +cover.ore_dictionary_filter.compile.error.unexpected_eof=Unexpected end of expression +cover.ore_dictionary_filter.compile.error.unexpected_token=Unexpected token '%s' +cover.ore_dictionary_filter.compile.error.unexpected_token_after_eof=Unexpected token '%s' after end of expression +cover.ore_dictionary_filter.compile.error.unexpected_compilation_flag=Compilation flags in the middle of expression +cover.ore_dictionary_filter.compile.error.empty_compilation_flag=No compilation flags given +cover.ore_dictionary_filter.compile.error.unknown_compilation_flag=Unknown compilation flag '%s' +cover.ore_dictionary_filter.compile.error.redundant_compilation_flag=Compilation flag '%s' written twice +cover.ore_dictionary_filter.compile.error.eof_after_escape=End of file after escape character ('\') +cover.ore_dictionary_filter.compile.error.invalid_char=Invalid character U+%s('%s') + +cover.ore_dictionary_filter.compile.warn.nested_negation=Nested negations can be unintuitive. Consider using groups ( () ) to eliminate ambiguity. +cover.ore_dictionary_filter.compile.warn.consecutive_negation=Consecutive negations can be unintuitive. Please check if the evaluation result is desirable. + cover.fluid_filter.title=Fluid Filter cover.fluid_filter.config_amount=Scroll wheel up increases amount, down decreases./nShift[§6x10§r],Ctrl[§ex100§r],Shift+Ctrl[§ax1000§r]/nRight click increases amount, left click decreases./nHold shift to double/halve./nMiddle click to clear cover.fluid_filter.mode.filter_fill=Filter Fill @@ -2606,6 +2650,7 @@ gregtech.machine.crate.aluminium.name=Aluminium Crate gregtech.machine.crate.stainless_steel.name=Stainless Steel Crate gregtech.machine.crate.titanium.name=Titanium Crate gregtech.machine.crate.tungstensteel.name=Tungstensteel Crate +gregtech.crate.tooltip.taped_movement=Can be Taped to keep inventory contents when broken # Safe gregtech.machine.locked_safe.name=Locked Safe @@ -3885,6 +3930,9 @@ gregtech.machine.scanner.uxv.name=Epic Scanner IV gregtech.machine.scanner.uxv.tooltip=Electron Microscope gregtech.machine.scanner.opv.name=Legendary Scanner gregtech.machine.scanner.opv.tooltip=Electron Microscope +gregtech.scanner.copy_stick_from=§oStick to Copy +gregtech.scanner.copy_stick_to=§oCopy of Stick +gregtech.scanner.copy_stick_empty=§oEmpty Stick gregtech.machine.infinite_energy.name=Infinite GT Energy Unit Emitter gregtech.machine.creative_chest.name=Creative Quantum Chest @@ -4382,6 +4430,8 @@ gregtech.advancement.steam.87_fluid_pipe_death_heat.name=Boiling Hot! gregtech.advancement.steam.87_fluid_pipe_death_heat.desc=Die to a Fluid Pipe full of Hot Fluid. gregtech.advancement.steam.90_primitive_pump.name=Primitive Water Pump gregtech.advancement.steam.90_primitive_pump.desc=Craft a Primitive Water Pump for early water gathering. +gregtech.advancement.steam.91_primitive_blast_furnace.name=Almost to Steel! +gregtech.advancement.steam.91_primitive_blast_furnace.desc=Craft a Primitive Blast Furnace gregtech.advancement.root_lv.name=Low Voltage gregtech.advancement.root_lv.desc=Craft a Basic Steam Turbine gregtech.advancement.low_voltage.17_lv_pump.name=Pump @@ -4624,7 +4674,7 @@ gregtech.machine.miner.multi.modes=Has Silk Touch and Chunk Aligned Modes. gregtech.machine.miner.multi.production=Produces §f3x§7 more crushed ore than a §fMacerator§7. gregtech.machine.miner.fluid_usage=Uses §f%,d L/t §7of §f%s§7, doubled per overclock. gregtech.machine.miner.multi.description=A multiblock mining machine that covers a large area and produces huge quantity of ore. -gregtech.machine.miner.multi.needsfluid=Needs Drilling Fluid +gregtech.machine.miner.multi.needsfluid=No Drilling Fluid! gregtech.machine.miner.startx=sX: %d gregtech.machine.miner.starty=sY: %d @@ -4643,6 +4693,7 @@ gregtech.machine.fluid_drilling_rig.ev.name=Advanced Fluid Drilling Rig II gregtech.machine.fluid_drilling_rig.description=Drills fluids from veins under bedrock. gregtech.machine.fluid_drilling_rig.production=§eProduction Multiplier: §f%dx, %fx overclocked gregtech.machine.fluid_drilling_rig.depletion=§bDepletion Rate: §f%s%% +gregtech.machine.fluid_drilling_rig.shows_depletion=Shows fluid vein depletion info gregtech.machine.cleanroom.name=Cleanroom gregtech.machine.cleanroom.tooltip.1=Place machines inside to run cleanroom recipes. @@ -4657,9 +4708,10 @@ gregtech.machine.cleanroom.tooltip.8=Send power through §fHulls §7or §fDiodes gregtech.machine.cleanroom.tooltip.9=Send items and fluids with §fPassthrough Hatches §7in the walls. gregtech.machine.cleanroom.tooltip.ae2.channels=Send up to §f8 AE2 Channels §7through §fHulls§7 in the walls. gregtech.machine.cleanroom.tooltip.ae2.no_channels=Send §aAE2 Networks§7 through §fHulls§7 in the walls. -gregtech.multiblock.cleanroom.clean_state=Status: §aCLEAN -gregtech.multiblock.cleanroom.dirty_state=Status: §4CONTAMINATED -gregtech.multiblock.cleanroom.clean_amount=Cleanliness: §a%s%% +gregtech.multiblock.cleanroom.clean_status=Status: %s +gregtech.multiblock.cleanroom.clean_state=Clean (%s%%) +gregtech.multiblock.cleanroom.dirty_state=Contaminated (%s%%) +gregtech.multiblock.cleanroom.warning_contaminated=Contaminated! gregtech.machine.charcoal_pile.name=Charcoal Pile Igniter gregtech.machine.charcoal_pile.tooltip.1=Turns Logs into §aCharcoal§7 when §cignited§7. @@ -4700,6 +4752,7 @@ gregtech.machine.research_station.tooltip.2=Used to scan onto §fData Orbs§7 an gregtech.machine.research_station.tooltip.3=Requires §fComputation§7 to work. gregtech.machine.research_station.tooltip.4=Providing more Computation allows the recipe to run faster. gregtech.multiblock.research_station.description=The Research Station is a multiblock structure used for researching much more complex Assembly Line Research Data. Any Research requiring a Data Orb or Data Module must be scanned in the Research Station. Requires Compute Work Units (CWU/t) to research recipes, which is supplied by High Performance Computing Arrays (HPCAs). +gregtech.machine.research_station.researching=Researching. gregtech.machine.network_switch.name=Network Switch gregtech.machine.network_switch.tooltip.1=Ethernet Hub @@ -5010,6 +5063,11 @@ gregtech.machine.pump_hatch.tooltip=Primitive Fluid Output for Water Pump gregtech.machine.machine_hatch.name=Machine Access Interface gregtech.machine.machine_hatch.locked=Machine Interface Locked +gregtech.machine.machine_hatch.machines=Machine: %s +gregtech.machine.machine_hatch.machines_none=None +gregtech.machine.machine_hatch.machines_none_hover=Insert machines into Machine Access Interface to run. +gregtech.machine.machine_hatch.machines_max=Max Machines: %s +gregtech.machine.machine_hatch.machines_max_eut=Max Usable EU/t: %s (%sA %s) gregtech.machine.machine_hatch.tooltip=Specialized Access Bus that only holds valid items gregtech.machine.machine_hatch.processing_array=When in the §eProcessing Array§7, only holds machines that work in the §eProcessing Array @@ -5018,6 +5076,9 @@ gregtech.machine.passthrough_hatch_item.tooltip=Sends Items from one Side to the gregtech.machine.passthrough_hatch_fluid.name=Fluid Passthrough Hatch gregtech.machine.passthrough_hatch_fluid.tooltip=Sends Fluids from one Side to the other +gregtech.machine.reservoir_hatch.name=Reservoir Hatch +gregtech.machine.reservoir_hatch.tooltip=Not a Sink + gregtech.machine.data_access_hatch.name=Data Access Hatch gregtech.machine.data_access_hatch.tooltip.1=Data Access for Multiblocks gregtech.machine.data_access_hatch.tooltip.2=Adds §a%s§7 slots for Data Items @@ -5176,6 +5237,7 @@ gregtech.recipe.cleanroom=Requires %s gregtech.recipe.cleanroom.display_name=Cleanroom gregtech.recipe.cleanroom_sterile.display_name=Sterile Cleanroom gregtech.recipe.research=Requires Research +gregtech.recipe.scan_for_research=Scan for Assembly Line gregtech.recipe.computation_per_tick=Min. Computation: %,d CWU/t gregtech.recipe.total_computation=Computation: %,d CWU gregtech.recipe.research_result=Research result item, not produced by this recipe directly @@ -5261,6 +5323,10 @@ gregtech.jei.ore.between_1=Between Ore gregtech.jei.ore.between_2=Spawns in the middle %d layers of the vein, with other ores gregtech.jei.ore.sporadic_1=Sporadic Ore gregtech.jei.ore.sporadic_2=Spawns anywhere in the vein +gregtech.jei.ore.spawn_range=Spawn Range: %d - %d +gregtech.jei.ore.vein_weight=Vein Weight: %d +gregtech.jei.ore.dimension=Dimensions: +gregtech.jei.ore.surfacematerial=Surface Material fluid.spawnlocation.name=Fluid Vein Information gregtech.jei.fluid.vein_weight=Vein Weight: %d @@ -5281,6 +5347,58 @@ gregtech.jei.materials.average_mass=Average mass: %,d gregtech.jei.materials.average_protons=Average protons: %,d gregtech.jei.materials.average_neutrons=Average neutrons: %,d +gregtech.veins.ore.bauxite=Bauxite Vein +gregtech.veins.ore.magnetite=Magnetite Vein +gregtech.veins.ore.naquadah=Naquadah Vein +gregtech.veins.ore.pitchblende=Pitchblende Vein +gregtech.veins.ore.scheelite=Scheelite Vein +gregtech.veins.ore.sheldonite=Sheldonite Vein +gregtech.veins.ore.banded_iron=Banded Iron Vein +gregtech.veins.ore.beryllium=Beryllium Vein +gregtech.veins.ore.certus_quartz=Certus Quartz Vein +gregtech.veins.ore.manganese=Manganese Vein +gregtech.veins.ore.molybdenum=Molybdenum Vein +gregtech.veins.ore.monazite=Monazite Vein +gregtech.veins.ore.nether_quartz=Nether Quartz Vein +gregtech.veins.ore.redstone=Redstone Vein +gregtech.veins.ore.saltpeter=Saltpeter Vein +gregtech.veins.ore.sulfur=Sulfur Vein +gregtech.veins.ore.tetrahedrite=Tetrahedrite Vein +gregtech.veins.ore.topaz=Topaz Vein +gregtech.veins.ore.apatite=Apatite Vein +gregtech.veins.ore.basalt_sphere=Basalt Sphere +gregtech.veins.ore.black_granite_sphere=Black Granite Sphere +gregtech.veins.ore.cassiterite=Cassiterite Vein +gregtech.veins.ore.coal=Coal Vein +gregtech.veins.ore.copper_tin=Copper Tin Vein +gregtech.veins.ore.copper=Copper Vein +gregtech.veins.ore.diamond=Diamond Vein +gregtech.veins.ore.galena=Galena Vein +gregtech.veins.ore.garnet_tin=Garnet Tin Vein +gregtech.veins.ore.garnet=Garnet Vein +gregtech.veins.ore.iron=Iron Vein +gregtech.veins.ore.lapis=Lapis Vein +gregtech.veins.ore.lubricant=Lubricant Vein +gregtech.veins.ore.marble_sphere=Marble Sphere +gregtech.veins.ore.mica=Mica Vein +gregtech.veins.ore.mineral_sand=Mineral Sand Vein +gregtech.veins.ore.nickel=Nickel Vein +gregtech.veins.ore.oilsands=Oilsands Vein +gregtech.veins.ore.olivine=Olivine Vein +gregtech.veins.ore.raw_oil_sphere=Raw Oil Sphere +gregtech.veins.ore.red_granite_sphere=Red Granite Sphere +gregtech.veins.ore.salts=Salts Vein +gregtech.veins.ore.sapphire=Sapphire Vein + +gregtech.veins.fluid.lava=Nether Lava Deposit +gregtech.veins.fluid.natural_gas_nether=Nether Natural Gas Deposit +gregtech.veins.fluid.heavy_oil=Overworld Heavy Oil Deposit +gregtech.veins.fluid.light_oil=Overworld Light Oil Deposit +gregtech.veins.fluid.natural_gas_overworld=Overworld Natural Gas Deposit +gregtech.veins.fluid.oil=Overworld Oil Deposit +gregtech.veins.fluid.raw_oil=Overworld Raw Oil Deposit +gregtech.veins.fluid.salt_water=Overworld Salt Water Deposit + gregtech.item_filter.empty_item=Empty (No Item) gregtech.item_filter.footer=§eClick with item to override @@ -5303,34 +5421,36 @@ gregtech.item_pipe.priority=§9Priority: §f%,d gregtech.multiblock.work_paused=Work Paused. gregtech.multiblock.running=Running perfectly. gregtech.multiblock.idling=Idling. -gregtech.multiblock.not_enough_energy=§cWARNING:§f Machine needs more energy. -gregtech.multiblock.not_enough_energy_output=§eADVISE:§f Energy Dynamo Tier Too Low! +gregtech.multiblock.not_enough_energy=Machine needs more energy! +gregtech.multiblock.not_enough_energy_output=Energy Dynamo Tier Too Low! gregtech.multiblock.progress=Progress: %s%% gregtech.multiblock.invalid_structure=Invalid structure. gregtech.multiblock.invalid_structure.tooltip=This block is a controller of the multiblock structure. For building help, see structure template in JEI. gregtech.multiblock.validation_failed=Invalid amount of inputs/outputs. -gregtech.multiblock.max_energy_per_tick=Max EU/t: §a%s (%s§r) +gregtech.multiblock.max_energy_per_tick=Max EU/t: %s (%s) +gregtech.multiblock.max_energy_per_tick_amps=Max EU/t: %s (%sA %s) gregtech.multiblock.generation_eu=Outputting: §a%s EU/t gregtech.multiblock.universal.no_problems=No Maintenance Problems! gregtech.multiblock.universal.has_problems=Has Maintenance Problems! gregtech.multiblock.universal.has_problems_header=Fix the following issues in a Maintenance Hatch: -gregtech.multiblock.universal.problem.wrench=%s§7Pipe is loose. (§aWrench§7) -gregtech.multiblock.universal.problem.screwdriver=%s§7Screws are loose. (§aScrewdriver§7) -gregtech.multiblock.universal.problem.soft_mallet=%s§7Something is stuck. (§aSoft Mallet§7) -gregtech.multiblock.universal.problem.hard_hammer=%s§7Plating is dented. (§aHard Hammer§7) -gregtech.multiblock.universal.problem.wire_cutter=%s§7Wires burned out. (§aWire Cutter§7) -gregtech.multiblock.universal.problem.crowbar=%s§7That doesn't belong there. (§aCrowbar§7) -gregtech.multiblock.universal.muffler_obstructed=§cMuffler Hatch is Obstructed!§r/nMuffler Hatch must have a block of airspace in front of it. +gregtech.multiblock.universal.problem.wrench=Pipe is loose. (Wrench) +gregtech.multiblock.universal.problem.screwdriver=Screws are loose. (Screwdriver) +gregtech.multiblock.universal.problem.soft_mallet=Something is stuck. (Soft Mallet) +gregtech.multiblock.universal.problem.hard_hammer=Plating is dented. (Hard Hammer) +gregtech.multiblock.universal.problem.wire_cutter=Wires burned out. (Wire Cutter) +gregtech.multiblock.universal.problem.crowbar=That doesn't belong there. (Crowbar) +gregtech.multiblock.universal.muffler_obstructed=Muffler Hatch is Obstructed! +gregtech.multiblock.universal.muffler_obstructed_desc=Muffler Hatch must have a block of airspace in front of it. gregtech.multiblock.universal.distinct_enabled=Distinct Buses: §aEnabled§r/nEach Item Input Bus will be treated separately for recipe lookup. Useful for things like Programmed Circuits, Extruder Shapes, etc. gregtech.multiblock.universal.distinct_disabled=Distinct Buses: §cDisabled§r/nEach Item Input Bus will be treated as a combined input for recipe lookup. gregtech.multiblock.universal.distinct_not_supported=This Multiblock does not support Distinct Buses gregtech.multiblock.universal.no_flex_button=This Multiblock has no additional functionality with this Button. -gregtech.multiblock.parallel=Performing up to %d Recipes in Parallel +gregtech.multiblock.parallel=Max Parallels: %s gregtech.multiblock.multiple_recipemaps.header=Machine Mode: gregtech.multiblock.multiple_recipemaps.tooltip=Screwdriver the controller to change which machine mode to use. gregtech.multiblock.multiple_recipemaps_recipes.tooltip=Machine Modes: §e%s§r gregtech.multiblock.multiple_recipemaps.switch_message=The machine must be off to switch modes! -gregtech.multiblock.energy_stored=Energy Stored: %s EU / %s EU +gregtech.multiblock.energy_stored=Energy: %s gregtech.multiblock.preview.zoom=Use mousewheel or right-click + drag to zoom gregtech.multiblock.preview.rotate=Click and drag to rotate @@ -5355,41 +5475,49 @@ gregtech.multiblock.pattern.location_end=§cVery End§r gregtech.multiblock.pattern.replaceable_air=Replaceable by Air gregtech.multiblock.blast_furnace.max_temperature=Heat Capacity: %s -gregtech.multiblock.multi_furnace.heating_coil_level=Heating Coil Level: %s -gregtech.multiblock.multi_furnace.heating_coil_discount=Heating Coil EU Boost: %sx +gregtech.multiblock.multi_furnace.heating_coil_discount=Heating Coil EU Usage: %s +gregtech.multiblock.multi_furnace.heating_coil_discount_hover=Energy usage modifier, determined by coil tier +gregtech.multiblock.multi_furnace.parallel_hover=Multi Smelter Parallels, determined by coil tier gregtech.multiblock.distillation_tower.distilling_fluid=Distilling %s -gregtech.multiblock.large_combustion_engine.no_lubricant=No Lubricant. -gregtech.multiblock.large_combustion_engine.lubricant_amount=Lubricant Amount: %sL -gregtech.multiblock.large_combustion_engine.oxygen_amount=Oxygen Amount: %sL -gregtech.multiblock.large_combustion_engine.liquid_oxygen_amount=Liquid Oxygen Amount: %sL -gregtech.multiblock.large_combustion_engine.oxygen_boosted=§bOxygen boosted. -gregtech.multiblock.large_combustion_engine.liquid_oxygen_boosted=§bLiquid Oxygen boosted. -gregtech.multiblock.large_combustion_engine.boost_disallowed=§bUpgrade the Dynamo Hatch to enable Oxygen Boosting. +gregtech.multiblock.large_combustion_engine.fuel_amount=Fuel: %s +gregtech.multiblock.large_combustion_engine.no_lubricant=No Lubricant! +gregtech.multiblock.large_combustion_engine.lubricant_amount=Lubricant: %s +gregtech.multiblock.large_combustion_engine.oxygen_amount=Oxygen: %s +gregtech.multiblock.large_combustion_engine.liquid_oxygen_amount=Liquid Oxygen: %s +gregtech.multiblock.large_combustion_engine.oxygen_boosted=Oxygen boosted. +gregtech.multiblock.large_combustion_engine.liquid_oxygen_boosted=Liquid Oxygen boosted. +gregtech.multiblock.large_combustion_engine.oxygen_boost_disallowed=Upgrade the Dynamo Hatch to enable Oxygen Boosting. +gregtech.multiblock.large_combustion_engine.liquid_oxygen_boost_disallowed=Upgrade the Dynamo Hatch to enable Liquid Oxygen Boosting. gregtech.multiblock.large_combustion_engine.supply_oxygen_to_boost=Supply Oxygen to boost. gregtech.multiblock.large_combustion_engine.supply_liquid_oxygen_to_boost=Supply Liquid Oxygen to boost. -gregtech.multiblock.large_combustion_engine.obstructed=Engine Intakes Obstructed. +gregtech.multiblock.large_combustion_engine.obstructed=Engine Intakes Obstructed! +gregtech.multiblock.large_combustion_engine.obstructed.desc=Engine Intakes must have a block of airspace in front of them. gregtech.multiblock.turbine.fuel_amount=Fuel: %sL %s gregtech.multiblock.turbine.fuel_needed=Consumes %s per %s ticks -gregtech.multiblock.turbine.rotor_speed=Rotor Speed: %s/%s RPM -gregtech.multiblock.turbine.rotor_durability=Rotor Durability: %s%% +gregtech.multiblock.turbine.rotor_speed=Rotor Speed: %s +gregtech.multiblock.turbine.rotor_rpm_unit_name=RPM +gregtech.multiblock.turbine.rotor_durability=Rotor Durability: %s gregtech.multiblock.turbine.rotor_durability_low=Rotor durability low! -gregtech.multiblock.turbine.no_rotor=No Rotor in Rotor Holder. -gregtech.multiblock.turbine.efficiency=Turbine Efficiency: %s%% +gregtech.multiblock.turbine.no_rotor=No Rotor in Rotor Holder! +gregtech.multiblock.turbine.efficiency=Turbine Efficiency: %s gregtech.multiblock.turbine.energy_per_tick=Output EU/t: %s (%s) -gregtech.multiblock.turbine.obstructed=Turbine Face Obstructed +gregtech.multiblock.turbine.obstructed=Turbine Face Obstructed! +gregtech.multiblock.turbine.obstructed.desc=Turbine must have air space in the 3x3 in front of it. gregtech.multiblock.turbine.efficiency_tooltip=Each Rotor Holder above %s§7 adds §f10%% efficiency§7. gregtech.multiblock.large_boiler.efficiency=Efficiency: %s -gregtech.multiblock.large_boiler.steam_output=Steam Output: %s L/t -gregtech.multiblock.large_boiler.throttle=Throttle: %d +gregtech.multiblock.large_boiler.steam_output=Steam Output: %s +gregtech.multiblock.large_boiler.throttle=Throttle: %s gregtech.multiblock.large_boiler.throttle.tooltip=Boiler can output less Steam and consume less fuel (efficiency is not lost, does not affect heat-up time) gregtech.multiblock.large_boiler.throttle_increment=Increase throttle by §a+5%%§r/n§7Boiler can output less Steam and consume less fuel (efficiency is not lost, does not affect heat-up time) gregtech.multiblock.large_boiler.throttle_decrement=Decrease throttle by §c-5%%§r/n§7Boiler can output less Steam and consume less fuel (efficiency is not lost, does not affect heat-up time) gregtech.multiblock.large_boiler.rate_tooltip=§7Produces §f%d L §7of Steam with §f1 Coal gregtech.multiblock.large_boiler.heat_time_tooltip=§7Takes §f%,d seconds §7to heat up gregtech.multiblock.large_boiler.explosion_tooltip=Will explode if provided Fuel with no Water +gregtech.multiblock.large_boiler.water_bar_hover=Water: %s +gregtech.multiblock.large_boiler.no_water=No Water! gregtech.machine.miner.done=Done! gregtech.machine.miner.working=Working... @@ -5404,21 +5532,29 @@ gregtech.multiblock.miner.chunk_mode=Chunk Mode: §aEnabled§r/nSilk Touch Mode: gregtech.multiblock.miner.silk_touch_mode=Chunk Mode: §cDisabled§r/nSilk Touch Mode: §aEnabled§r/n§7Switching requires an idle machine. gregtech.multiblock.miner.both_modes=Chunk Mode: §aEnabled§r/nSilk Touch Mode: §aEnabled§r/n§7Switching requires an idle machine. -gregtech.multiblock.pyrolyse_oven.speed=Processing Speed: %s%% +gregtech.multiblock.fluid_rig.drilled_fluid=Fluid: %s +gregtech.multiblock.fluid_rig.fluid_amount=Pumping Rate: %s +gregtech.multiblock.fluid_rig.vein_depletion=Vein Size: %s +gregtech.multiblock.fluid_rig.vein_depleted=Vein Depleted. +gregtech.multiblock.miner.drilling=Drilling. -gregtech.multiblock.cracking_unit.energy=Energy Usage: %s%% +gregtech.multiblock.pyrolyse_oven.speed=Processing Speed: %s +gregtech.multiblock.pyrolyse_oven.speed_hover=Processing speed modifier set by the coils in the structure. -gregtech.multiblock.energy_consumption=Energy Usage: %s EU/t -gregtech.multiblock.computation.max=Max Computation: %s CWU/t -gregtech.multiblock.computation.usage=Using: %s CWU/t +gregtech.multiblock.cracking_unit.energy=Energy Usage: %s +gregtech.multiblock.cracking_unit.energy_hover=Energy usage modifier set by the coils in the structure. + +gregtech.multiblock.energy_consumption=Energy Usage: %s EU/t (%s) +gregtech.multiblock.computation.max=Max CWU/t: %s +gregtech.multiblock.computation.usage=Using: %s gregtech.multiblock.computation.non_bridging=Non-bridging connection found gregtech.multiblock.computation.non_bridging.detailed=A Reception Hatch is linked to a machine which cannot bridge -gregtech.multiblock.computation.not_enough_computation=§cWARNING:§f Machine needs more computation. +gregtech.multiblock.computation.not_enough_computation=Machine needs more computation! -gregtech.multiblock.power_substation.stored=Stored: %s EU -gregtech.multiblock.power_substation.capacity=Capacity: %s EU -gregtech.multiblock.power_substation.passive_drain=Passive Drain: %s EU/t -gregtech.multiblock.power_substation.average_io=Avg. I/O: %s EU/t +gregtech.multiblock.power_substation.stored=Stored: %s +gregtech.multiblock.power_substation.capacity=Capacity: %s +gregtech.multiblock.power_substation.passive_drain=Passive Drain: %s +gregtech.multiblock.power_substation.average_io=Avg. I/O: %s gregtech.multiblock.power_substation.average_io_hover=The average change in energy of the Power Substation's internal energy bank gregtech.multiblock.power_substation.time_to_fill=Time to fill: %s gregtech.multiblock.power_substation.time_to_drain=Time to drain: %s @@ -5430,19 +5566,27 @@ gregtech.multiblock.power_substation.time_years=%s Years gregtech.multiblock.power_substation.time_forever=Forever gregtech.multiblock.power_substation.under_one_hour_left=Less than 1 hour until fully drained! -gregtech.multiblock.hpca.computation=Providing: %s / %s CWU/t +gregtech.multiblock.data_bank.providing=Providing data. + +gregtech.multiblock.hpca.computation=Providing: %s gregtech.multiblock.hpca.energy=Using: %s / %s EU/t (%s) -gregtech.multiblock.hpca.coolant=Needs up to: %s L/t PCB Coolant -gregtech.multiblock.hpca.cooling=Cooling: -gregtech.multiblock.hpca.temperature=Temperature: -gregtech.multiblock.hpca.error_damaged=Damaged component in structure +gregtech.multiblock.hpca.temperature=Temperature: %s +gregtech.multiblock.hpca.hover_for_info=Hover for details +gregtech.multiblock.hpca.error_damaged=Damaged component in structure! gregtech.multiblock.hpca.error_temperature=Temperature above 100C, components may be damaged! gregtech.multiblock.hpca.warning_temperature=Temperature above 50C, components may be damaged at 100C! gregtech.multiblock.hpca.warning_temperature_active_cool=Fully utilizing active coolers -gregtech.multiblock.hpca.warning_structure_header=Structure Hints: +gregtech.multiblock.hpca.warning_structure_header=Structure Warnings: gregtech.multiblock.hpca.warning_multiple_bridges=- Multiple bridges in structure (provides no additional benefit) gregtech.multiblock.hpca.warning_no_computation=- No computation providers gregtech.multiblock.hpca.warning_low_cooling=- Not enough cooling +gregtech.multiblock.hpca.info_max_computation=Max CWU/t: %s +gregtech.multiblock.hpca.info_max_cooling_demand=Cooling Demand: %s +gregtech.multiblock.hpca.info_max_cooling_available=Cooling Available: %s +gregtech.multiblock.hpca.info_max_coolant_required=Coolant Needed: %s +gregtech.multiblock.hpca.info_coolant_name=PCB Coolant +gregtech.multiblock.hpca.info_bridging_enabled=Bridging Enabled +gregtech.multiblock.hpca.info_bridging_disabled=Bridging Disabled gregtech.command.usage=Usage: /gregtech gregtech.command.worldgen.usage=Usage: /gregtech worldgen @@ -5780,3 +5924,201 @@ gregtech.subtitle.maintenance.mechanical=Mechanical breakdown # Debug messaging gregtech.debug.f3_h.enabled=GregTech has modified the debug info! For Developers: enable the misc:debug config option in the GregTech config file to see more + +### Forestry Integration +# Frames +item.gt.frame_working.name=Working Frame +item.gt.frame_mutagenic.name=Mutagenic Frame +item.gt.frame_accelerated.name=Accelerated Frame +item.gt.frame_stabilizing.name=Stabilizing Frame +item.gt.frame_arborist.name=Arborist's Frame +item.gt.frame_decaying.name=Decaying Frame +item.gt.frame_slowing.name=Slowing Frame + +# Electrodes +metaitem.electrode.apatite.name=Apatine Electrode +metaitem.electrode.blaze.name=Blazing Electrode +metaitem.electrode.bronze.name=Bronze Electrode +metaitem.electrode.copper.name=Copper Electrode +metaitem.electrode.diamond.name=Diamantine Electrode +metaitem.electrode.emerald.name=Emerald Electrode +metaitem.electrode.ender.name=Ender Electrode +metaitem.electrode.gold.name=Golden Electrode +metaitem.electrode.iron.name=Iron Electrode +metaitem.electrode.lapis.name=Lapis Electrode +metaitem.electrode.obsidian.name=Obsidian Electrode +metaitem.electrode.orchid.name=Orchid Electrode +metaitem.electrode.rubber.name=Rubberised Electrode +metaitem.electrode.tin.name=Tin Electrode + +# Scoop +item.gt.tool.scoop.name=%s Scoop +item.gt.tool.behavior.scoop=§dArborist: §fCatches Butterflies on Left-Click +gt.tool.class.scoop=Scoop + +# Drops +item.gt.honey_drop.oil.name=Oil Drop +item.gt.honey_drop.biomass.name=Biomass Drop +item.gt.honey_drop.ethanol.name=Ethanol Drop +item.gt.honey_drop.mutagen.name=Mutagen Drop + +# Combs +item.gt.comb.coal.name=Coal Comb +item.gt.comb.coke.name=Coke Comb +item.gt.comb.stickyresin.name=Sticky Resin Comb +item.gt.comb.oil.name=Oil Comb +item.gt.comb.apatite.name=Apatite Comb +item.gt.comb.ash.name=Ash Comb +item.gt.comb.biomass.name=Biomass Comb +item.gt.comb.energy.name=Energy Comb +item.gt.comb.lapotron.name=Lapotron Comb +item.gt.comb.redalloy.name=Red Alloy Comb +item.gt.comb.stainlesssteel.name=Stainless Steel Comb +item.gt.comb.stone.name=Stone Comb +item.gt.comb.certus.name=Certus Comb +item.gt.comb.redstone.name=Redstone Comb +item.gt.comb.rareearth.name=Rare Earth Comb +item.gt.comb.lapis.name=Lapis Comb +item.gt.comb.ruby.name=Ruby Comb +item.gt.comb.sapphire.name=Sapphire Comb +item.gt.comb.diamond.name=Diamond Comb +item.gt.comb.olivine.name=Olivine Comb +item.gt.comb.emerald.name=Emerald Comb +item.gt.comb.pyrope.name=Pyrope Comb +item.gt.comb.grossular.name=Grossular Comb +item.gt.comb.sparkling.name=Sparkling Comb +item.gt.comb.slag.name=Slag Comb +item.gt.comb.copper.name=Copper Comb +item.gt.comb.tin.name=Tin Comb +item.gt.comb.lead.name=Lead Comb +item.gt.comb.iron.name=Iron Comb +item.gt.comb.steel.name=Steel Comb +item.gt.comb.nickel.name=Nickel Comb +item.gt.comb.zinc.name=Zinc Comb +item.gt.comb.silver.name=Silver Comb +item.gt.comb.gold.name=Gold Comb +item.gt.comb.sulfur.name=Sulfur Comb +item.gt.comb.gallium.name=Gallium Comb +item.gt.comb.arsenic.name=Arsenic Comb +item.gt.comb.bauxite.name=Bauxite Comb +item.gt.comb.aluminium.name=Aluminium Comb +item.gt.comb.manganese.name=Manganese Comb +item.gt.comb.magnesium.name=Magnesium Comb +item.gt.comb.titanium.name=Titanium Comb +item.gt.comb.chrome.name=Chrome Comb +item.gt.comb.tungsten.name=Tungsten Comb +item.gt.comb.platinum.name=Platinum Comb +item.gt.comb.iridium.name=Iridium Comb +item.gt.comb.molybdenum.name=Molybdenum Comb +item.gt.comb.osmium.name=Osmium Comb +item.gt.comb.lithium.name=Lithium Comb +item.gt.comb.salt.name=Salt Comb +item.gt.comb.electrotine.name=Electrotine Comb +item.gt.comb.almandine.name=Almandine Comb +item.gt.comb.uranium.name=Uranium Comb +item.gt.comb.plutonium.name=Plutonium Comb +item.gt.comb.naquadah.name=Naquadah Comb +item.gt.comb.naquadria.name=Naquadria Comb +item.gt.comb.thorium.name=Thorium Comb +item.gt.comb.lutetium.name=Lutetium Comb +item.gt.comb.americium.name=Americium Comb +item.gt.comb.neutronium.name=Neutronium Comb +item.gt.comb.phosphorus.name=Phosphorus Comb +item.gt.comb.indium.name=Indium Comb +item.gt.comb.trinium.name=Trinium Comb +item.gt.comb.helium.name=Helium Comb +item.gt.comb.argon.name=Argon Comb +item.gt.comb.xenon.name=Xenon Comb +item.gt.comb.neon.name=Neon Comb +item.gt.comb.krypton.name=Krypton Comb +item.gt.comb.nitrogen.name=Nitrogen Comb +item.gt.comb.oxygen.name=Oxygen Comb +item.gt.comb.hydrogen.name=Hydrogen Comb +item.gt.comb.fluorine.name=Fluorine Comb +item.gt.comb.fluix.name=Fluix Comb + +# Bees +for.bees.species.clay=Clay +for.bees.species.slimeball=Slime Ball +for.bees.species.peat=Peat +for.bees.species.stickyresin=Sticky Resin +for.bees.species.coal=Coal +for.bees.species.oil=Oil +for.bees.species.ash=Ash +for.bees.species.apatite=Apatite +for.bees.species.biomass=Biomass +for.bees.species.redstone=Redstone +for.bees.species.lapis=Lapis +for.bees.species.certus=Certus Quartz +for.bees.species.diamond=Diamond +for.bees.species.ruby=Ruby +for.bees.species.sapphire=Sapphire +for.bees.species.olivine=Olivine +for.bees.species.emerald=Emerald +for.bees.species.copper=Copper +for.bees.species.tin=Tin +for.bees.species.lead=Lead +for.bees.species.iron=Iron +for.bees.species.steel=Steel +for.bees.species.nickel=Nickel +for.bees.species.zinc=Zinc +for.bees.species.silver=Silver +for.bees.species.gold=Gold +for.bees.species.arsenic=Arsenic +for.bees.species.aluminium=Aluminium +for.bees.species.titanium=Titanium +for.bees.species.chrome=Chrome +for.bees.species.manganese=Manganese +for.bees.species.tungsten=Tungsten +for.bees.species.platinum=Platinum +for.bees.species.iridium=Iridium +for.bees.species.osmium=Osmium +for.bees.species.salty=Salt +for.bees.species.lithium=Lithium +for.bees.species.electrotine=Electrotine +for.bees.species.energy=Energy +for.bees.species.lapotron=Lapotron +for.bees.species.redalloy=Red Alloy +for.bees.species.stainlesssteel=Stainless Steel +for.bees.species.uranium=Uranium +for.bees.species.plutonium=Plutonium +for.bees.species.naquadah=Naquadah +for.bees.species.naquadria=Naquadria +for.bees.species.thorium=Thorium +for.bees.species.lutetium=Lutetium +for.bees.species.americium=Americium +for.bees.species.neutronium=Neutronium +for.bees.species.divided=Divided +for.bees.species.sandwich=Sandwich +for.bees.species.sparkling=Nether Star +for.bees.species.fertilizer=Fertilizer +for.bees.species.phosphorus=Phosphorus +for.bees.species.sulfur=Sulfur +for.bees.species.indium=Indium +for.bees.species.explosive=Explosive +for.bees.species.trinium=Trinium +for.bees.species.helium=Helium +for.bees.species.argon=Argon +for.bees.species.neon=Neon +for.bees.species.krypton=Krypton +for.bees.species.xenon=Xenon +for.bees.species.oxygen=Oxygen +for.bees.species.hydrogen=Hydrogen +for.bees.species.nitrogen=Nitrogen +for.bees.species.fluorine=Fluorine +for.bees.species.fluix=Fluix +for.bees.species.silicon=Silicon + +# Bee Descriptions (many more to do) +for.bees.description.clay=An organic bee known to be industrious and diligent. Rumor has it that it can find mud in the right biome.|Beekeeping 101 + +# Scanner Information +gregtech.scanner.forestry.drone=§oScanned Drone +gregtech.scanner.forestry.princess=§oScanned Princess +gregtech.scanner.forestry.queen=§oScanned Queen +gregtech.scanner.forestry.sapling=§oScanned Sapling +gregtech.scanner.forestry.butterfly=§oScanned Butterfly +gregtech.scanner.forestry.larvae=§oScanned Larvae +gregtech.scanner.forestry.serum=§oScanned Serum +gregtech.scanner.forestry.caterpillar=§oScanned Caterpillar +gregtech.scanner.forestry.pollen=§oScanned Pollen diff --git a/src/main/resources/assets/gregtech/models/item/metaitems/basic_tape.json b/src/main/resources/assets/gregtech/models/item/metaitems/basic_tape.json new file mode 100644 index 00000000000..e4c791adb3d --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/metaitems/basic_tape.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "gregtech:items/metaitems/basic_tape" + } +} diff --git a/src/main/resources/assets/gregtech/models/item/metaitems/electrode.apatite.json b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.apatite.json new file mode 100644 index 00000000000..61bd0f94079 --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.apatite.json @@ -0,0 +1,7 @@ + +{ + "parent": "item/generated", + "textures": { + "layer0": "gregtech:items/metaitems/electrode.apatite" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/models/item/metaitems/electrode.blaze.json b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.blaze.json new file mode 100644 index 00000000000..f3dfdfa9574 --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.blaze.json @@ -0,0 +1,7 @@ + +{ + "parent": "item/generated", + "textures": { + "layer0": "gregtech:items/metaitems/electrode.blaze" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/models/item/metaitems/electrode.bronze.json b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.bronze.json new file mode 100644 index 00000000000..267af6aff4d --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.bronze.json @@ -0,0 +1,7 @@ + +{ + "parent": "item/generated", + "textures": { + "layer0": "gregtech:items/metaitems/electrode.bronze" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/models/item/metaitems/electrode.copper.json b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.copper.json new file mode 100644 index 00000000000..21f2d8fefa1 --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.copper.json @@ -0,0 +1,7 @@ + +{ + "parent": "item/generated", + "textures": { + "layer0": "gregtech:items/metaitems/electrode.copper" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/models/item/metaitems/electrode.diamond.json b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.diamond.json new file mode 100644 index 00000000000..5511e79ae1b --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.diamond.json @@ -0,0 +1,7 @@ + +{ + "parent": "item/generated", + "textures": { + "layer0": "gregtech:items/metaitems/electrode.diamond" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/models/item/metaitems/electrode.emerald.json b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.emerald.json new file mode 100644 index 00000000000..bb53a3bd443 --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.emerald.json @@ -0,0 +1,7 @@ + +{ + "parent": "item/generated", + "textures": { + "layer0": "gregtech:items/metaitems/electrode.emerald" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/models/item/metaitems/electrode.ender.json b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.ender.json new file mode 100644 index 00000000000..2f1a4856b91 --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.ender.json @@ -0,0 +1,7 @@ + +{ + "parent": "item/generated", + "textures": { + "layer0": "gregtech:items/metaitems/electrode.ender" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/models/item/metaitems/electrode.gold.json b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.gold.json new file mode 100644 index 00000000000..43d04163daf --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.gold.json @@ -0,0 +1,7 @@ + +{ + "parent": "item/generated", + "textures": { + "layer0": "gregtech:items/metaitems/electrode.gold" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/models/item/metaitems/electrode.iron.json b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.iron.json new file mode 100644 index 00000000000..88b235094d2 --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.iron.json @@ -0,0 +1,7 @@ + +{ + "parent": "item/generated", + "textures": { + "layer0": "gregtech:items/metaitems/electrode.iron" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/models/item/metaitems/electrode.lapis.json b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.lapis.json new file mode 100644 index 00000000000..2726011b43a --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.lapis.json @@ -0,0 +1,7 @@ + +{ + "parent": "item/generated", + "textures": { + "layer0": "gregtech:items/metaitems/electrode.lapis" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/models/item/metaitems/electrode.obsidian.json b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.obsidian.json new file mode 100644 index 00000000000..bdb23c56393 --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.obsidian.json @@ -0,0 +1,7 @@ + +{ + "parent": "item/generated", + "textures": { + "layer0": "gregtech:items/metaitems/electrode.obsidian" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/models/item/metaitems/electrode.orchid.json b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.orchid.json new file mode 100644 index 00000000000..0781cc4462b --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.orchid.json @@ -0,0 +1,7 @@ + +{ + "parent": "item/generated", + "textures": { + "layer0": "gregtech:items/metaitems/electrode.orchid" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/models/item/metaitems/electrode.rubber.json b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.rubber.json new file mode 100644 index 00000000000..23061eeb14c --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.rubber.json @@ -0,0 +1,7 @@ + +{ + "parent": "item/generated", + "textures": { + "layer0": "gregtech:items/metaitems/electrode.rubber" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/models/item/metaitems/electrode.tin.json b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.tin.json new file mode 100644 index 00000000000..53db6ec1341 --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/metaitems/electrode.tin.json @@ -0,0 +1,7 @@ + +{ + "parent": "item/generated", + "textures": { + "layer0": "gregtech:items/metaitems/electrode.tin" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/models/item/tools/scoop.json b/src/main/resources/assets/gregtech/models/item/tools/scoop.json new file mode 100644 index 00000000000..d2f577a8787 --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/tools/scoop.json @@ -0,0 +1,7 @@ +{ + "parent": "item/handheld", + "textures": { + "layer0": "gregtech:items/tools/scoop_overlay", + "layer1": "gregtech:items/tools/scoop" + } +} diff --git a/src/main/resources/assets/gregtech/textures/blocks/machines/pulverizer/overlay_top_active_emissive.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/machines/pulverizer/overlay_top_active_emissive.png.mcmeta index 97596ba8176..23c14fb6718 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/machines/pulverizer/overlay_top_active_emissive.png.mcmeta +++ b/src/main/resources/assets/gregtech/textures/blocks/machines/pulverizer/overlay_top_active_emissive.png.mcmeta @@ -1,5 +1,5 @@ { "animation":{ - "frametime":2 + "frametime":4 } -} \ No newline at end of file +} diff --git a/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_configurable.png b/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_configurable.png index f3fbbf0789c..fe42e0c90c7 100644 Binary files a/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_configurable.png and b/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_configurable.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_configurable_emissive.png b/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_configurable_emissive.png new file mode 100644 index 00000000000..c8a19021559 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_configurable_emissive.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_configurable_emissive.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_configurable_emissive.png.mcmeta new file mode 100644 index 00000000000..d1b26864ec7 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_configurable_emissive.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 4 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_full_auto.png b/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_full_auto.png index fe42e0c90c7..1962db2b457 100644 Binary files a/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_full_auto.png and b/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_full_auto.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_full_auto_emissive.png b/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_full_auto_emissive.png index c8a19021559..a0cd3861443 100644 Binary files a/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_full_auto_emissive.png and b/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_full_auto_emissive.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_full_auto_emissive.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_full_auto_emissive.png.mcmeta index d1b26864ec7..8e55e43bafe 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_full_auto_emissive.png.mcmeta +++ b/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_maintenance_full_auto_emissive.png.mcmeta @@ -1,5 +1,5 @@ { - "animation": { - "frametime": 4 - } -} \ No newline at end of file + "animation": { + "frametime": 3 + } +} diff --git a/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_water.png b/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_water.png new file mode 100644 index 00000000000..6c74408d732 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/overlay/machine/overlay_water.png differ diff --git a/src/main/resources/assets/gregtech/textures/capes/acecape.png b/src/main/resources/assets/gregtech/textures/capes/acecape.png new file mode 100644 index 00000000000..24e335230b6 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/capes/acecape.png differ diff --git a/src/main/resources/assets/gregtech/textures/capes/agendercape.png b/src/main/resources/assets/gregtech/textures/capes/agendercape.png new file mode 100644 index 00000000000..934674a4fee Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/capes/agendercape.png differ diff --git a/src/main/resources/assets/gregtech/textures/capes/aromanticcape.png b/src/main/resources/assets/gregtech/textures/capes/aromanticcape.png new file mode 100644 index 00000000000..912e2fafa06 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/capes/aromanticcape.png differ diff --git a/src/main/resources/assets/gregtech/textures/capes/bicape.png b/src/main/resources/assets/gregtech/textures/capes/bicape.png new file mode 100644 index 00000000000..eb73c935475 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/capes/bicape.png differ diff --git a/src/main/resources/assets/gregtech/textures/capes/debugcape.png b/src/main/resources/assets/gregtech/textures/capes/debugcape.png new file mode 100644 index 00000000000..594e0d2d360 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/capes/debugcape.png differ diff --git a/src/main/resources/assets/gregtech/textures/capes/genderfluidcape.png b/src/main/resources/assets/gregtech/textures/capes/genderfluidcape.png new file mode 100644 index 00000000000..53e87bb46f7 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/capes/genderfluidcape.png differ diff --git a/src/main/resources/assets/gregtech/textures/capes/genderqueercape.png b/src/main/resources/assets/gregtech/textures/capes/genderqueercape.png new file mode 100644 index 00000000000..5faefcd172b Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/capes/genderqueercape.png differ diff --git a/src/main/resources/assets/gregtech/textures/capes/intersexcape.png b/src/main/resources/assets/gregtech/textures/capes/intersexcape.png new file mode 100644 index 00000000000..6b77f30fde8 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/capes/intersexcape.png differ diff --git a/src/main/resources/assets/gregtech/textures/capes/lesbiancape.png b/src/main/resources/assets/gregtech/textures/capes/lesbiancape.png new file mode 100644 index 00000000000..d70c3e786aa Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/capes/lesbiancape.png differ diff --git a/src/main/resources/assets/gregtech/textures/capes/nonbinarycape.png b/src/main/resources/assets/gregtech/textures/capes/nonbinarycape.png new file mode 100644 index 00000000000..d8e4d53dd99 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/capes/nonbinarycape.png differ diff --git a/src/main/resources/assets/gregtech/textures/capes/pancape.png b/src/main/resources/assets/gregtech/textures/capes/pancape.png new file mode 100644 index 00000000000..18f904012b9 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/capes/pancape.png differ diff --git a/src/main/resources/assets/gregtech/textures/capes/rainbowcape.png b/src/main/resources/assets/gregtech/textures/capes/rainbowcape.png new file mode 100644 index 00000000000..b7599e47538 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/capes/rainbowcape.png differ diff --git a/src/main/resources/assets/gregtech/textures/capes/transcape.png b/src/main/resources/assets/gregtech/textures/capes/transcape.png new file mode 100644 index 00000000000..40932a9d223 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/capes/transcape.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/base/blank_transparent.png b/src/main/resources/assets/gregtech/textures/gui/base/blank_transparent.png new file mode 100644 index 00000000000..c4694352f98 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/base/blank_transparent.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/progress_bar/fusion_diagram/bottom_left.png b/src/main/resources/assets/gregtech/textures/gui/progress_bar/fusion_diagram/bottom_left.png new file mode 100644 index 00000000000..671805fa4d6 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/progress_bar/fusion_diagram/bottom_left.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/progress_bar/fusion_diagram/bottom_right.png b/src/main/resources/assets/gregtech/textures/gui/progress_bar/fusion_diagram/bottom_right.png new file mode 100644 index 00000000000..3ff9805a96f Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/progress_bar/fusion_diagram/bottom_right.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/progress_bar/fusion_diagram/top_left.png b/src/main/resources/assets/gregtech/textures/gui/progress_bar/fusion_diagram/top_left.png new file mode 100644 index 00000000000..ae7dc311cf0 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/progress_bar/fusion_diagram/top_left.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/progress_bar/fusion_diagram/top_right.png b/src/main/resources/assets/gregtech/textures/gui/progress_bar/fusion_diagram/top_right.png new file mode 100644 index 00000000000..79042e78996 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/progress_bar/fusion_diagram/top_right.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_fluid_rig_depletion.png b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_fluid_rig_depletion.png new file mode 100644 index 00000000000..5b48f61b1c5 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_fluid_rig_depletion.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_fusion_energy.png b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_fusion_energy.png new file mode 100644 index 00000000000..ac2b766e286 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_fusion_energy.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_fusion_heat.png b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_fusion_heat.png new file mode 100644 index 00000000000..382f74b8b94 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_fusion_heat.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_hpca_computation.png b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_hpca_computation.png new file mode 100644 index 00000000000..13e25a98f11 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_hpca_computation.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_lce_fuel.png b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_lce_fuel.png new file mode 100644 index 00000000000..7a09d67a845 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_lce_fuel.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_lce_lubricant.png b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_lce_lubricant.png new file mode 100644 index 00000000000..694476d756d Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_lce_lubricant.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_lce_oxygen.png b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_lce_oxygen.png new file mode 100644 index 00000000000..c979c089a17 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_lce_oxygen.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_multi_energy_yellow.png b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_multi_energy_yellow.png new file mode 100644 index 00000000000..808ac6ac383 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_multi_energy_yellow.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_turbine_rotor_durability.png b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_turbine_rotor_durability.png new file mode 100644 index 00000000000..04f3da1b7db Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_turbine_rotor_durability.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_turbine_rotor_speed.png b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_turbine_rotor_speed.png new file mode 100644 index 00000000000..94a5db281ec Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_turbine_rotor_speed.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/fusion_reactor_diagram.png b/src/main/resources/assets/gregtech/textures/gui/widget/fusion_reactor_diagram.png new file mode 100644 index 00000000000..800dbf7e551 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/widget/fusion_reactor_diagram.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/fusion_reactor_legend.png b/src/main/resources/assets/gregtech/textures/gui/widget/fusion_reactor_legend.png new file mode 100644 index 00000000000..b230e292fa6 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/widget/fusion_reactor_legend.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/fusion_reactor_mk1_title.png b/src/main/resources/assets/gregtech/textures/gui/widget/fusion_reactor_mk1_title.png new file mode 100644 index 00000000000..743e76a08e6 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/widget/fusion_reactor_mk1_title.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/fusion_reactor_mk2_title.png b/src/main/resources/assets/gregtech/textures/gui/widget/fusion_reactor_mk2_title.png new file mode 100644 index 00000000000..b0ba02e1ca9 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/widget/fusion_reactor_mk2_title.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/fusion_reactor_mk3_title.png b/src/main/resources/assets/gregtech/textures/gui/widget/fusion_reactor_mk3_title.png new file mode 100644 index 00000000000..5f66bf39ad2 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/widget/fusion_reactor_mk3_title.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/hpca/active_cooler_component.png b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/active_cooler_component.png new file mode 100644 index 00000000000..a40125de455 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/active_cooler_component.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/hpca/advanced_computation_component.png b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/advanced_computation_component.png new file mode 100644 index 00000000000..45e7fc3c198 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/advanced_computation_component.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/hpca/bridge_component.png b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/bridge_component.png new file mode 100644 index 00000000000..4163112b14a Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/bridge_component.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/hpca/component_outline.png b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/component_outline.png new file mode 100644 index 00000000000..d5b6e983713 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/component_outline.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/hpca/computation_component.png b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/computation_component.png new file mode 100644 index 00000000000..f621a8ea278 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/computation_component.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/hpca/damaged_advanced_computation_component.png b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/damaged_advanced_computation_component.png new file mode 100644 index 00000000000..3c75caad842 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/damaged_advanced_computation_component.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/hpca/damaged_computation_component.png b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/damaged_computation_component.png new file mode 100644 index 00000000000..d5a44962cb8 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/damaged_computation_component.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/hpca/empty_component.png b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/empty_component.png new file mode 100644 index 00000000000..37b704d3ffd Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/empty_component.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/hpca/heat_sink_component.png b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/heat_sink_component.png new file mode 100644 index 00000000000..b9cf7794a1b Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/widget/hpca/heat_sink_component.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/metaitems/basic_tape.png b/src/main/resources/assets/gregtech/textures/items/metaitems/basic_tape.png new file mode 100644 index 00000000000..5017923b38c Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/metaitems/basic_tape.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.apatite.png b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.apatite.png new file mode 100644 index 00000000000..5a10c89fd77 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.apatite.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.blaze.png b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.blaze.png new file mode 100644 index 00000000000..f897023ae09 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.blaze.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.bronze.png b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.bronze.png new file mode 100644 index 00000000000..23ee2ecba28 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.bronze.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.copper.png b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.copper.png new file mode 100644 index 00000000000..fb0ada79e29 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.copper.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.diamond.png b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.diamond.png new file mode 100644 index 00000000000..dcc08f7ea65 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.diamond.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.emerald.png b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.emerald.png new file mode 100644 index 00000000000..426c71b3b3e Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.emerald.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.ender.png b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.ender.png new file mode 100644 index 00000000000..4448e8cdf41 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.ender.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.gold.png b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.gold.png new file mode 100644 index 00000000000..e3e66cf0c12 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.gold.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.iron.png b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.iron.png new file mode 100644 index 00000000000..4304c2090e6 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.iron.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.lapis.png b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.lapis.png new file mode 100644 index 00000000000..589669b89ce Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.lapis.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.obsidian.png b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.obsidian.png new file mode 100644 index 00000000000..73d0617f773 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.obsidian.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.orchid.png b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.orchid.png new file mode 100644 index 00000000000..df37c4cfbcd Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.orchid.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.rubber.png b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.rubber.png new file mode 100644 index 00000000000..027dddb1c2e Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.rubber.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.tin.png b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.tin.png new file mode 100644 index 00000000000..e5eceb6f37d Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/metaitems/electrode.tin.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/tools/scoop.png b/src/main/resources/assets/gregtech/textures/items/tools/scoop.png new file mode 100644 index 00000000000..d520c956b23 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/tools/scoop.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/tools/scoop_overlay.png b/src/main/resources/assets/gregtech/textures/items/tools/scoop_overlay.png new file mode 100644 index 00000000000..a404404712f Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/tools/scoop_overlay.png differ diff --git a/src/main/resources/assets/gregtech/worldgen/fluid/nether/lava_deposit.json b/src/main/resources/assets/gregtech/worldgen/fluid/nether/lava_deposit.json index 39780f533ef..e6b2f878421 100644 --- a/src/main/resources/assets/gregtech/worldgen/fluid/nether/lava_deposit.json +++ b/src/main/resources/assets/gregtech/worldgen/fluid/nether/lava_deposit.json @@ -1,6 +1,6 @@ { + "name": "gregtech.veins.fluid.lava", "weight": 65, - "name": "Nether Lava Deposit", "yield": { "min": 125, "max": 250 diff --git a/src/main/resources/assets/gregtech/worldgen/fluid/nether/natural_gas_deposit.json b/src/main/resources/assets/gregtech/worldgen/fluid/nether/natural_gas_deposit.json index 2d8bacf3718..d9f5492f47f 100644 --- a/src/main/resources/assets/gregtech/worldgen/fluid/nether/natural_gas_deposit.json +++ b/src/main/resources/assets/gregtech/worldgen/fluid/nether/natural_gas_deposit.json @@ -1,6 +1,6 @@ { + "name": "gregtech.veins.fluid.natural_gas_nether", "weight": 35, - "name": "Nether Natural Gas Deposit", "yield": { "min": 150, "max": 300 diff --git a/src/main/resources/assets/gregtech/worldgen/fluid/overworld/heavy_oil_deposit.json b/src/main/resources/assets/gregtech/worldgen/fluid/overworld/heavy_oil_deposit.json index b1d6db85e0a..c1d61988189 100644 --- a/src/main/resources/assets/gregtech/worldgen/fluid/overworld/heavy_oil_deposit.json +++ b/src/main/resources/assets/gregtech/worldgen/fluid/overworld/heavy_oil_deposit.json @@ -1,6 +1,6 @@ { + "name": "gregtech.veins.fluid.heavy_oil", "weight": 15, - "name": "Heavy Oil Deposit", "yield": { "min": 100, "max": 200 diff --git a/src/main/resources/assets/gregtech/worldgen/fluid/overworld/light_oil_deposit.json b/src/main/resources/assets/gregtech/worldgen/fluid/overworld/light_oil_deposit.json index 8fec02e3ea9..d0bd6887f4a 100644 --- a/src/main/resources/assets/gregtech/worldgen/fluid/overworld/light_oil_deposit.json +++ b/src/main/resources/assets/gregtech/worldgen/fluid/overworld/light_oil_deposit.json @@ -1,6 +1,6 @@ { + "name": "gregtech.veins.fluid.light_oil", "weight": 25, - "name": "Overworld Light Oil Deposit", "yield": { "min": 175, "max": 300 diff --git a/src/main/resources/assets/gregtech/worldgen/fluid/overworld/natural_gas_deposit.json b/src/main/resources/assets/gregtech/worldgen/fluid/overworld/natural_gas_deposit.json index 7e1300d6c24..1978081beb8 100644 --- a/src/main/resources/assets/gregtech/worldgen/fluid/overworld/natural_gas_deposit.json +++ b/src/main/resources/assets/gregtech/worldgen/fluid/overworld/natural_gas_deposit.json @@ -1,6 +1,6 @@ { + "name": "gregtech.veins.fluid.natural_gas_overworld", "weight": 15, - "name": "Overworld Natural Gas Deposit", "yield": { "min": 100, "max": 175 diff --git a/src/main/resources/assets/gregtech/worldgen/fluid/overworld/oil_deposit.json b/src/main/resources/assets/gregtech/worldgen/fluid/overworld/oil_deposit.json index 2710ebd5eb3..a03803b015f 100644 --- a/src/main/resources/assets/gregtech/worldgen/fluid/overworld/oil_deposit.json +++ b/src/main/resources/assets/gregtech/worldgen/fluid/overworld/oil_deposit.json @@ -1,6 +1,6 @@ { + "name": "gregtech.veins.fluid.oil", "weight": 20, - "name": "Overworld Oil Deposit", "yield": { "min": 175, "max": 300 diff --git a/src/main/resources/assets/gregtech/worldgen/fluid/overworld/raw_oil_deposit.json b/src/main/resources/assets/gregtech/worldgen/fluid/overworld/raw_oil_deposit.json index 95d158fe57b..988dcdafcc1 100644 --- a/src/main/resources/assets/gregtech/worldgen/fluid/overworld/raw_oil_deposit.json +++ b/src/main/resources/assets/gregtech/worldgen/fluid/overworld/raw_oil_deposit.json @@ -1,6 +1,6 @@ { + "name": "gregtech.veins.fluid.raw_oil", "weight": 20, - "name": "Overworld Raw Oil Deposit", "yield": { "min": 200, "max": 300 diff --git a/src/main/resources/assets/gregtech/worldgen/fluid/overworld/salt_water_deposit.json b/src/main/resources/assets/gregtech/worldgen/fluid/overworld/salt_water_deposit.json index 1f4e13bffc6..a43334e6e91 100644 --- a/src/main/resources/assets/gregtech/worldgen/fluid/overworld/salt_water_deposit.json +++ b/src/main/resources/assets/gregtech/worldgen/fluid/overworld/salt_water_deposit.json @@ -1,6 +1,6 @@ { + "name": "gregtech.veins.fluid.salt_water", "weight": 0, - "name": "Overworld Salt Water Deposit", "yield": { "min": 50, "max": 100 diff --git a/src/main/resources/assets/gregtech/worldgen/vein/end/bauxite_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/end/bauxite_vein.json index 222fd9948ec..e546044a1ee 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/end/bauxite_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/end/bauxite_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.bauxite", "weight": 40, "density": 0.25, "min_height": 10, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/end/magnetite_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/end/magnetite_vein.json index 3e4262b37d6..6c6fa266c5f 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/end/magnetite_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/end/magnetite_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.magnetite", "weight": 30, "density": 0.15, "min_height": 20, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/end/naquadah_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/end/naquadah_vein.json index 4b691fd659a..d223a5e7651 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/end/naquadah_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/end/naquadah_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.naquadah", "weight": 30, "density": 0.15, "min_height": 10, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/end/pitchblende_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/end/pitchblende_vein.json index db89ae8d891..2ff5ce03c9e 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/end/pitchblende_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/end/pitchblende_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.pitchblende", "weight": 20, "density": 0.25, "min_height": 30, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/end/scheelite_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/end/scheelite_vein.json index 23057c0635b..0d0df8305c8 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/end/scheelite_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/end/scheelite_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.scheelite", "weight": 20, "density": 0.2, "min_height": 20, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/end/sheldonite_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/end/sheldonite_vein.json index 8422870374c..c3e997e2a86 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/end/sheldonite_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/end/sheldonite_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.sheldonite", "weight": 10, "density": 0.2, "min_height": 5, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/nether/banded_iron_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/nether/banded_iron_vein.json index 38846a2a8e0..52dfd903371 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/nether/banded_iron_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/nether/banded_iron_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.banded_iron", "weight": 30, "density": 0.2, "min_height": 20, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/nether/beryllium_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/nether/beryllium_vein.json index 3bca7c10715..c7e33ba30bc 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/nether/beryllium_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/nether/beryllium_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.beryllium", "weight": 30, "density": 0.25, "min_height": 5, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/nether/certus_quartz_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/nether/certus_quartz_vein.json index b7f0e05f30a..f7f3180b638 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/nether/certus_quartz_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/nether/certus_quartz_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.certus_quartz", "weight": 40, "density": 0.25, "min_height": 80, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/nether/manganese_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/nether/manganese_vein.json index 385d6b261b2..a5caeb7b268 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/nether/manganese_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/nether/manganese_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.manganese", "weight": 20, "density": 0.25, "min_height": 20, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/nether/molybdenum_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/nether/molybdenum_vein.json index 2dc54953b67..98da79a1323 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/nether/molybdenum_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/nether/molybdenum_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.molybdenum", "weight": 5, "density": 0.25, "min_height": 20, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/nether/monazite_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/nether/monazite_vein.json index 75c9048102f..bbaaf51d95d 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/nether/monazite_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/nether/monazite_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.monazite", "weight": 30, "density": 0.25, "min_height": 20, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/nether/nether_quartz_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/nether/nether_quartz_vein.json index 7f77f1328f7..2e5398cfb5c 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/nether/nether_quartz_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/nether/nether_quartz_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.nether_quartz", "weight": 80, "density": 0.2, "min_height": 40, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/nether/redstone_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/nether/redstone_vein.json index ae498f274e5..ed709bc09f8 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/nether/redstone_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/nether/redstone_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.redstone", "weight": 60, "density": 0.2, "min_height": 5, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/nether/saltpeter_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/nether/saltpeter_vein.json index f77e4cb8606..09c7595d993 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/nether/saltpeter_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/nether/saltpeter_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.saltpeter", "weight": 40, "density": 0.25, "min_height": 5, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/nether/sulfur_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/nether/sulfur_vein.json index 90069af5e61..b826b2afb44 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/nether/sulfur_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/nether/sulfur_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.sulfur", "weight": 100, "density": 0.2, "min_height": 10, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/nether/tetrahedrite_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/nether/tetrahedrite_vein.json index cc42f7b16c4..3681c3aa925 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/nether/tetrahedrite_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/nether/tetrahedrite_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.tetrahedrite", "weight": 70, "density": 0.2, "min_height": 80, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/nether/topaz_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/nether/topaz_vein.json index 90c711c2ff9..fe5b98908cd 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/nether/topaz_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/nether/topaz_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.topaz", "weight": 40, "density": 0.25, "min_height": 80, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/apatite_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/apatite_vein.json index 39089811595..8aee4e1107f 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/apatite_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/apatite_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.apatite", "weight": 40, "density": 0.25, "max_height": 60, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/basalt_sphere.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/basalt_sphere.json index dd62641f41c..949100da568 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/basalt_sphere.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/basalt_sphere.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.basalt_sphere", "weight": 120, "priority": 100, "density": 1.0, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/black_granite_sphere.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/black_granite_sphere.json index 36f98f09e1f..b4cb48ca3f7 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/black_granite_sphere.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/black_granite_sphere.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.black_granite_sphere", "weight": 90, "priority": 100, "density": 1.0, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/cassiterite_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/cassiterite_vein.json index 45ce342e746..33c9a9545e5 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/cassiterite_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/cassiterite_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.cassiterite", "weight": 80, "density": 0.2, "max_height": 60, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/coal_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/coal_vein.json index e7987a259d6..5917e94b322 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/coal_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/coal_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.coal", "weight": 80, "density": 0.25, "max_height": 80, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/copper_tin_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/copper_tin_vein.json index 333c1f51554..7881d2d74e9 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/copper_tin_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/copper_tin_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.copper_tin", "weight": 50, "density": 0.2, "max_height": 160, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/copper_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/copper_vein.json index 9b13c002a5e..0eabab9b2ca 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/copper_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/copper_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.copper", "weight": 80, "density": 0.2, "max_height": 60, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/diamond_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/diamond_vein.json index b195a1bb75f..496d850c26a 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/diamond_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/diamond_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.diamond", "weight": 40, "density": 0.25, "max_height": 20, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/galena_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/galena_vein.json index ea873ed15dc..5d4620a3d35 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/galena_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/galena_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.galena", "weight": 40, "density": 0.25, "max_height": 45, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/garnet_tin_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/garnet_tin_vein.json index 6d961cc0d0c..b76486a2b5d 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/garnet_tin_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/garnet_tin_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.garnet_tin", "weight": 80, "density": 0.2, "max_height": 60, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/garnet_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/garnet_vein.json index 6a4ba970a1c..855f0539438 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/garnet_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/garnet_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.garnet", "weight": 40, "density": 0.25, "max_height": 30, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/iron_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/iron_vein.json index 0cff56a9626..17e6ebab368 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/iron_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/iron_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.iron", "weight": 120, "density": 0.2, "max_height": 40, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/lapis_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/lapis_vein.json index 4374b9a7293..eb1b2e73e91 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/lapis_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/lapis_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.lapis", "weight": 40, "density": 0.25, "max_height": 50, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/lubricant_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/lubricant_vein.json index aa6ddbec127..2bd77fd41ba 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/lubricant_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/lubricant_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.lubricant", "weight": 40, "density": 0.25, "max_height": 50, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/magnetite_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/magnetite_vein.json index 490aad0104a..eaa0fc32c0c 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/magnetite_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/magnetite_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.magnetite", "weight": 80, "density": 0.15, "max_height": 60, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/manganese_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/manganese_vein.json index fa197838d2b..2f24f9868d7 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/manganese_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/manganese_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.manganese", "weight": 20, "density": 0.25, "max_height": 30, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/marble_sphere.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/marble_sphere.json index 86b5116e6b8..59fa73a4404 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/marble_sphere.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/marble_sphere.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.marble_sphere", "weight": 120, "priority": 100, "density": 1.0, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/mica_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/mica_vein.json index a9a3c551c9c..b7d2d219fcc 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/mica_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/mica_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.mica", "weight": 20, "density": 0.25, "max_height": 40, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/mineral_sand_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/mineral_sand_vein.json index 271b4d50f64..e57be57bc5e 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/mineral_sand_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/mineral_sand_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.mineral_sand", "weight": 80, "density": 0.2, "max_height": 60, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/nickel_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/nickel_vein.json index 15f921edf9e..3b5f4ffe5c0 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/nickel_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/nickel_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.nickel", "weight": 40, "density": 0.25, "max_height": 40, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/oilsands_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/oilsands_vein.json index 3a7d0a52629..7746504d851 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/oilsands_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/oilsands_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.oilsands", "weight": 40, "density": 0.3, "max_height": 80, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/olivine_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/olivine_vein.json index 6ea20f2491f..21ed6730d45 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/olivine_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/olivine_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.olivine", "weight": 20, "density": 0.25, "max_height": 40, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/raw_oil_sphere.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/raw_oil_sphere.json index a15eceab353..6f76153989f 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/raw_oil_sphere.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/raw_oil_sphere.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.raw_oil_sphere", "weight": 50, "density": 1.0, "max_height": 40, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/red_granite_sphere.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/red_granite_sphere.json index be8a1e00209..1d4c6d61c96 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/red_granite_sphere.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/red_granite_sphere.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.red_granite_sphere", "weight": 90, "priority": 100, "density": 1.0, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/redstone_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/redstone_vein.json index dea251bb594..f3b311bf6e6 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/redstone_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/redstone_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.redstone", "weight": 60, "density": 0.2, "max_height": 40, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/salts_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/salts_vein.json index 2173ffb1863..94787d1016e 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/salts_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/salts_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.salts", "weight": 50, "density": 0.2, "max_height": 70, diff --git a/src/main/resources/assets/gregtech/worldgen/vein/overworld/sapphire_vein.json b/src/main/resources/assets/gregtech/worldgen/vein/overworld/sapphire_vein.json index 8c75e576f6c..29ff592feaa 100644 --- a/src/main/resources/assets/gregtech/worldgen/vein/overworld/sapphire_vein.json +++ b/src/main/resources/assets/gregtech/worldgen/vein/overworld/sapphire_vein.json @@ -1,4 +1,5 @@ { + "name": "gregtech.veins.ore.sapphire", "weight": 60, "density": 0.25, "max_height": 40, diff --git a/src/test/java/gregtech/Bootstrap.java b/src/test/java/gregtech/Bootstrap.java index 98167fdc148..6f11372c857 100644 --- a/src/test/java/gregtech/Bootstrap.java +++ b/src/test/java/gregtech/Bootstrap.java @@ -5,6 +5,7 @@ import gregtech.api.fluids.MetaFluids; import gregtech.api.unification.material.Materials; import gregtech.api.unification.ore.OrePrefix; +import gregtech.api.util.GTLog; import gregtech.common.items.MetaItems; import gregtech.core.unification.material.internal.MaterialRegistryManager; import gregtech.modules.ModuleManager; @@ -14,6 +15,7 @@ import net.minecraft.network.NetworkManager; import net.minecraft.server.MinecraftServer; import net.minecraft.util.IThreadListener; +import net.minecraft.util.text.translation.LanguageMap; import net.minecraftforge.common.util.CompoundDataFixer; import net.minecraftforge.fml.common.*; import net.minecraftforge.fml.common.eventhandler.EventBus; @@ -21,6 +23,8 @@ import net.minecraftforge.fml.relauncher.Side; import java.io.File; +import java.io.IOException; +import java.io.InputStream; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -67,12 +71,26 @@ public static void perform() { managerInternal.closeRegistries(); managerInternal.freezeRegistries(); + // loadGregtechLangFile(); + OrePrefix.runMaterialHandlers(); MetaFluids.init(); MetaItems.init(); bootstrapped = true; } + private static void loadGregtechLangFile() { + try (InputStream is = LanguageMap.class.getResourceAsStream("/assets/gregtech/lang/en_us.lang")) { + if (is != null) { + LanguageMap.inject(is); + } else { + GTLog.logger.error("Couldn't find en_us.lang file"); + } + } catch (IOException ex) { + GTLog.logger.error("Unable to read en_us.lang file", ex); + } + } + private static final class TestSidedHandler implements IFMLSidedHandler { @Override diff --git a/src/test/java/gregtech/api/util/OreGlobTest.java b/src/test/java/gregtech/api/util/OreGlobTest.java index 61b3f093294..e76d72b1403 100644 --- a/src/test/java/gregtech/api/util/OreGlobTest.java +++ b/src/test/java/gregtech/api/util/OreGlobTest.java @@ -1,5 +1,6 @@ package gregtech.api.util; +import gregtech.Bootstrap; import gregtech.api.util.oreglob.OreGlob; import gregtech.api.util.oreglob.OreGlobCompileResult; import gregtech.common.covers.filter.oreglob.impl.ImpossibleOreGlob; @@ -9,6 +10,7 @@ import gregtech.common.covers.filter.oreglob.node.OreGlobNodes; import org.hamcrest.Description; import org.hamcrest.TypeSafeMatcher; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import static gregtech.common.covers.filter.oreglob.node.OreGlobNodes.*; @@ -19,6 +21,11 @@ public class OreGlobTest { private static final boolean LOG = false; + @BeforeAll + public static void bootstrap() { + Bootstrap.perform(); + } + @Test public void compileTest() { // "Will match all gold dusts of all sizes or all plates, but not double plates" @@ -92,7 +99,9 @@ public void compileTest() { match("c") )); - assertCompile("!()", something()); + assertCompile("?*", nonempty()); + assertCompile("!()", nonempty()); + assertCompile("(?)(*)", nonempty()); assertCompile("!(logical) !(inversions) !(are) !(confusing) !(as) !(hell)", everything()); assertCompile("!(x) !(x)", not(match("x"))); assertCompile("!(x) !(y)", @@ -125,7 +134,7 @@ public void compileTest() { assertCompile("(() | !())", everything()); assertCompile("(a | b | c | d | e | f | g | *)", everything()); - assertCompile("(a | b | c | d | e | f | g | !())", something()); + assertCompile("(a | b | c | d | e | f | g | !())", nonempty()); assertCompile("((a | ()) | ())", or( @@ -292,7 +301,7 @@ private static OreGlob compile(String expression) { } private static void assertMatch(OreGlob expr, String input, boolean expectedResult) { - assertThat(input, new TypeSafeMatcher(String.class) { + assertThat(input, new TypeSafeMatcher<>(String.class) { @Override public void describeTo(Description description) { @@ -318,7 +327,7 @@ protected boolean matchesSafely(String item) { private static void assertCompile(String expression, OreGlobNode result) { OreGlob glob = compile(expression); - assertThat(glob, new TypeSafeMatcher(OreGlob.class) { + assertThat(glob, new TypeSafeMatcher<>(OreGlob.class) { @Override public void describeTo(Description description) { @@ -345,7 +354,7 @@ protected boolean matchesSafely(OreGlob item) { private static void assertReport(String expression, boolean error) { OreGlobCompileResult result = new OreGlobParser(expression).compile(); - assertThat(result, new TypeSafeMatcher(OreGlobCompileResult.class) { + assertThat(result, new TypeSafeMatcher<>(OreGlobCompileResult.class) { @Override public void describeTo(Description description) { diff --git a/src/test/java/gregtech/common/metatileentities/multiblock/hpca/helper/HPCAComponentHatchTestImpl.java b/src/test/java/gregtech/common/metatileentities/multiblock/hpca/helper/HPCAComponentHatchTestImpl.java index 48bbad02219..47d6dbf742a 100644 --- a/src/test/java/gregtech/common/metatileentities/multiblock/hpca/helper/HPCAComponentHatchTestImpl.java +++ b/src/test/java/gregtech/common/metatileentities/multiblock/hpca/helper/HPCAComponentHatchTestImpl.java @@ -1,6 +1,7 @@ package gregtech.common.metatileentities.multiblock.hpca.helper; import gregtech.api.capability.IHPCAComponentHatch; +import gregtech.api.gui.resources.TextureArea; public class HPCAComponentHatchTestImpl implements IHPCAComponentHatch { @@ -33,4 +34,10 @@ public boolean canBeDamaged() { public boolean isBridge() { return false; } + + // not tested + @Override + public TextureArea getComponentIcon() { + return null; + } } diff --git a/src/test/java/gregtech/common/metatileentities/multiblock/hpca/helper/HPCAHelper.java b/src/test/java/gregtech/common/metatileentities/multiblock/hpca/helper/HPCAHelper.java index a46db8f1ff7..9dbfc5e14fa 100644 --- a/src/test/java/gregtech/common/metatileentities/multiblock/hpca/helper/HPCAHelper.java +++ b/src/test/java/gregtech/common/metatileentities/multiblock/hpca/helper/HPCAHelper.java @@ -64,7 +64,7 @@ public GridHandlerBuilder coolerBuilder(UnaryOperator b) { } private HPCAGridHandler build() { - HPCAGridHandler handler = new HPCAGridHandler(); + HPCAGridHandler handler = new HPCAGridHandler(null); List components = new ArrayList<>(numComputation + numCooler); for (int i = 0; i < numCooler; i++) { components.add(coolerBuilder.apply(new CoolerBuilder()).build());