diff --git a/build.gradle b/build.gradle index 7914cbb4c..a2c371788 100644 --- a/build.gradle +++ b/build.gradle @@ -79,7 +79,7 @@ configurations { compile.extendsFrom shade } -version = "2.10.2" +version = "2.11.1" def ENV = System.getenv() if (ENV.BUILD_NUMBER) { @@ -87,7 +87,7 @@ if (ENV.BUILD_NUMBER) { } minecraft { - version = "1.12.2-14.23.1.2555" + version = "1.12.2-14.23.1.2581" mappings = "snapshot_20171003" replace "@MODVERSION@", project.version useDepAts = true @@ -102,7 +102,6 @@ license { group = 'TechReborn' - dependencies { //Some dep we use wants the older jei, so this ingores it. We grab the latest anyway, so it shoudnt cause any issues. def withoutOldJEI = { exclude module: 'jei_1.12' } @@ -112,18 +111,17 @@ dependencies { } deobfCompile "mezz.jei:jei_1.12.2:+" compile "mcp.mobius.waila:Hwyla:+" - compile "net.darkhax.tesla:Tesla-1.12:1.0.59:deobf" + compile "net.darkhax.tesla:Tesla-1.12:1.0.61:deobf" - //1.11 updates - //deobfCompile "slimeknights:TConstruct:1.10.2-2.5.3.jenkins384" - //deobfCompile "slimeknights.mantle:Mantle:1.10.2-1.0.0.jenkins170" - deobfCompile "mcjty.theoneprobe:TheOneProbe-1.12:1.12-1.4.18-10" - compile "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.0.7.273", withoutOldJEI - deobfCompile 'net.industrial-craft:industrialcraft-2:2.8.26-ex112', withoutOldJEI - deobfCompile 'cofh:ThermalDynamics:1.12.2-2.3.7.14:universal' - deobfCompile 'cofh:ThermalExpansion:1.12.2-5.3.7.26:universal' + deobfCompile "mcjty.theoneprobe:TheOneProbe-1.12:1.12-1.4.19-11" + compile "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.0.9.289", withoutOldJEI + deobfCompile 'net.industrial-craft:industrialcraft-2:2.8.31-ex112', withoutOldJEI + deobfCompile 'cofh:ThermalDynamics:1.12.2-2.3.8.15:universal' + deobfCompile 'cofh:ThermalExpansion:1.12.2-5.3.8.33:universal' - compile name: 'buildcraft', version: '7.99.12', ext: 'jar' + deobfCompile 'MCMultiPart2:MCMultiPart:2.4.1' + + compile name: 'buildcraft', version: '7.99.13', ext: 'jar' } diff --git a/src/main/java/techreborn/blocks/BlockRubberLeaves.java b/src/main/java/techreborn/blocks/BlockRubberLeaves.java index 1062a47a8..3ee755450 100644 --- a/src/main/java/techreborn/blocks/BlockRubberLeaves.java +++ b/src/main/java/techreborn/blocks/BlockRubberLeaves.java @@ -29,7 +29,6 @@ import net.minecraft.block.BlockPlanks; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -41,6 +40,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import prospector.shootingstar.ShootingStar; import prospector.shootingstar.model.ModelCompound; +import techreborn.Core; import techreborn.client.TechRebornCreativeTabMisc; import techreborn.init.ModBlocks; import techreborn.lib.ModInfo; @@ -139,6 +139,6 @@ public class BlockRubberLeaves extends BlockLeaves { } public boolean fancyLeaves(){ - return Minecraft.getMinecraft().gameSettings.fancyGraphics; + return Core.proxy.fancyGraphics(); } } diff --git a/src/main/java/techreborn/client/gui/GuiAESU.java b/src/main/java/techreborn/client/gui/GuiAESU.java index 7843ae7d0..f6cbd18dc 100644 --- a/src/main/java/techreborn/client/gui/GuiAESU.java +++ b/src/main/java/techreborn/client/gui/GuiAESU.java @@ -24,8 +24,6 @@ package techreborn.client.gui; -import java.io.IOException; - import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; @@ -35,6 +33,8 @@ import techreborn.client.gui.widget.GuiButtonUpDown; import techreborn.packets.PacketAesu; import techreborn.tiles.storage.TileAdjustableSU; +import java.io.IOException; + public class GuiAESU extends GuiBase { TileAdjustableSU tile; @@ -43,7 +43,7 @@ public class GuiAESU extends GuiBase { super(player, aesu, aesu.createContainer(player)); this.tile = aesu; } - + @Override protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); @@ -60,13 +60,15 @@ public class GuiAESU extends GuiBase { protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - - GlStateManager.pushMatrix(); - GlStateManager.scale(0.6, 0.6, 1); - this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getEnergy()) + "/" + + if(!GuiBase.showSlotConfig){ + GlStateManager.pushMatrix(); + GlStateManager.scale(0.6, 0.6, 1); + this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); - GlStateManager.popMatrix(); + GlStateManager.popMatrix(); + } this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); diff --git a/src/main/java/techreborn/client/gui/GuiBase.java b/src/main/java/techreborn/client/gui/GuiBase.java index 6f059b200..116c18126 100644 --- a/src/main/java/techreborn/client/gui/GuiBase.java +++ b/src/main/java/techreborn/client/gui/GuiBase.java @@ -26,15 +26,19 @@ package techreborn.client.gui; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.client.resources.I18n; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import reborncore.api.tile.IUpgradeable; +import reborncore.common.tile.TileLegacyMachineBase; import techreborn.client.container.builder.BuiltContainer; +import techreborn.client.gui.slot.GuiSlotConfiguration; import techreborn.client.gui.widget.GuiButtonPowerBar; +import java.io.IOException; + /** * Created by Prospector */ @@ -45,11 +49,15 @@ public class GuiBase extends GuiContainer { public TRBuilder builder = new TRBuilder(); public TileEntity tile; public BuiltContainer container; + public static boolean showSlotConfig = false; + + private boolean upgrades; public GuiBase(EntityPlayer player, TileEntity tile, BuiltContainer container) { super(container); this.tile = tile; this.container = container; + showSlotConfig = false; } protected void drawSlot(int x, int y, Layer layer) { @@ -106,6 +114,7 @@ public class GuiBase extends GuiContainer { @Override public void initGui() { super.initGui(); + GuiSlotConfiguration.init(this); } @Override @@ -119,8 +128,11 @@ public class GuiBase extends GuiContainer { IUpgradeable upgradeable = (IUpgradeable) tile; if (upgradeable.canBeUpgraded()) { builder.drawUpgrades(this, upgradeable, guiLeft, guiTop); + upgrades = true; } } + builder.drawSlotTab(this, guiLeft, guiTop, mouseX, mouseY, upgrades); + } public boolean drawPlayerSlots() { @@ -135,6 +147,9 @@ public class GuiBase extends GuiContainer { @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { drawTitle(); + if(showSlotConfig){ + GuiSlotConfiguration.draw(this, mouseX, mouseY); + } } @Override @@ -179,6 +194,58 @@ public class GuiBase extends GuiContainer { buttonList.add(new GuiButtonPowerBar(id, x + factorX, y + factorY, this, layer)); } + @Override + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + if(showSlotConfig){ + if(GuiSlotConfiguration.mouseClicked(mouseX, mouseY, mouseButton, this)){ + return; + } + } + super.mouseClicked(mouseX, mouseY, mouseButton); + } + + @Override + protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { + if(showSlotConfig){ + GuiSlotConfiguration.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick, this); + } + super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick); + } + + @Override + protected void mouseReleased(int mouseX, int mouseY, int state) { + int offset = 0; + if(!upgrades){ + offset = 80; + } + if(isPointInRegion(-26, 84 - offset, 30, 30, mouseX, mouseY)){ + showSlotConfig = !showSlotConfig; + if(!showSlotConfig){ + GuiSlotConfiguration.reset(); + } + } + if(showSlotConfig){ + if(GuiSlotConfiguration.mouseReleased(mouseX, mouseY, state, this)){ + return; + } + } + super.mouseReleased(mouseX, mouseY, state); + } + + @Override + public void onGuiClosed() { + showSlotConfig = false; + super.onGuiClosed(); + } + + public boolean isPointInRect(int rectX, int rectY, int rectWidth, int rectHeight, int pointX, int pointY) { + return super.isPointInRegion(rectX, rectY, rectWidth, rectHeight, pointX, pointY); + } + + public TileLegacyMachineBase getMachine(){ + return (TileLegacyMachineBase) tile; + } + //TODO public enum SlotRender { STANDARD, OUTPUT, NONE, SPRITE; diff --git a/src/main/java/techreborn/client/gui/GuiBatbox.java b/src/main/java/techreborn/client/gui/GuiBatbox.java index b9bad4662..242e6d078 100644 --- a/src/main/java/techreborn/client/gui/GuiBatbox.java +++ b/src/main/java/techreborn/client/gui/GuiBatbox.java @@ -52,10 +52,12 @@ public class GuiBatbox extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - GlStateManager.pushMatrix(); - GlStateManager.scale(0.6, 0.6, 5); - this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); - GlStateManager.popMatrix(); + if(!GuiBase.showSlotConfig){ + GlStateManager.pushMatrix(); + GlStateManager.scale(0.6, 0.6, 5); + this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); + GlStateManager.popMatrix(); + } this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); } diff --git a/src/main/java/techreborn/client/gui/GuiBlastFurnace.java b/src/main/java/techreborn/client/gui/GuiBlastFurnace.java index c1d11bdaf..d6c2b8abd 100644 --- a/src/main/java/techreborn/client/gui/GuiBlastFurnace.java +++ b/src/main/java/techreborn/client/gui/GuiBlastFurnace.java @@ -108,7 +108,7 @@ public class GuiBlastFurnace extends GuiBase { @Override public void actionPerformed(final GuiButton button) throws IOException { super.actionPerformed(button); - if (button.id == 212) { + if (button.id == 212 && !GuiBase.showSlotConfig) { if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { { // This code here makes a basic multiblock and then sets to the selected one. diff --git a/src/main/java/techreborn/client/gui/GuiDistillationTower.java b/src/main/java/techreborn/client/gui/GuiDistillationTower.java index 37d19e3bf..9592a7004 100644 --- a/src/main/java/techreborn/client/gui/GuiDistillationTower.java +++ b/src/main/java/techreborn/client/gui/GuiDistillationTower.java @@ -24,8 +24,6 @@ package techreborn.client.gui; -import java.io.IOException; - import net.minecraft.block.state.IBlockState; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; @@ -41,6 +39,8 @@ import techreborn.init.ModBlocks; import techreborn.proxies.ClientProxy; import techreborn.tiles.multiblock.TileDistillationTower; +import java.io.IOException; + public class GuiDistillationTower extends GuiBase { public TileDistillationTower tile; @@ -105,7 +105,7 @@ public class GuiDistillationTower extends GuiBase { @Override public void actionPerformed(final GuiButton button) throws IOException { super.actionPerformed(button); - if (button.id == 212) { + if (button.id == 212 && !GuiBase.showSlotConfig) { if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { { // This code here makes a basic multiblock and then sets to the selected one. diff --git a/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java b/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java index 419c5e5bf..92d7b2196 100644 --- a/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java +++ b/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java @@ -107,7 +107,7 @@ public class GuiImplosionCompressor extends GuiBase { @Override public void actionPerformed(final GuiButton button) throws IOException { super.actionPerformed(button); - if (button.id == 212) { + if (button.id == 212 && !GuiBase.showSlotConfig) { if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { { // This code here makes a basic multiblock and then sets to the selected one. diff --git a/src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java b/src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java index f2798fb84..1cec322e1 100644 --- a/src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java +++ b/src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java @@ -111,7 +111,7 @@ public class GuiIndustrialGrinder extends GuiBase { @Override public void actionPerformed(final GuiButton button) throws IOException { super.actionPerformed(button); - if (button.id == 212) { + if (button.id == 212 && !GuiBase.showSlotConfig) { if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { { // This code here makes a basic multiblock and then sets to the selected one. diff --git a/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java b/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java index 04c4665cb..44d10606d 100644 --- a/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java +++ b/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java @@ -24,8 +24,6 @@ package techreborn.client.gui; -import java.io.IOException; - import net.minecraft.block.state.IBlockState; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.EntityPlayer; @@ -41,6 +39,8 @@ import techreborn.init.ModBlocks; import techreborn.proxies.ClientProxy; import techreborn.tiles.multiblock.TileIndustrialSawmill; +import java.io.IOException; + public class GuiIndustrialSawmill extends GuiBase { TileIndustrialSawmill tile; @@ -110,7 +110,7 @@ public class GuiIndustrialSawmill extends GuiBase { @Override public void actionPerformed(final GuiButton button) throws IOException { super.actionPerformed(button); - if (button.id == 212) { + if (button.id == 212 && !GuiBase.showSlotConfig) { if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { { // This code here makes a basic multiblock and then sets to the selected one. diff --git a/src/main/java/techreborn/client/gui/GuiMFE.java b/src/main/java/techreborn/client/gui/GuiMFE.java index 7eb654747..f8cde42b9 100644 --- a/src/main/java/techreborn/client/gui/GuiMFE.java +++ b/src/main/java/techreborn/client/gui/GuiMFE.java @@ -53,10 +53,12 @@ public class GuiMFE extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - GlStateManager.pushMatrix(); - GlStateManager.scale(0.6, 0.6, 1); - this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfe.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfe.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); - GlStateManager.popMatrix(); + if(!GuiBase.showSlotConfig){ + GlStateManager.pushMatrix(); + GlStateManager.scale(0.6, 0.6, 1); + this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfe.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfe.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); + GlStateManager.popMatrix(); + } this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.mfe.getEnergy(), (int) this.mfe.getMaxPower(), mouseX, mouseY, 0, layer); } diff --git a/src/main/java/techreborn/client/gui/GuiVacuumFreezer.java b/src/main/java/techreborn/client/gui/GuiVacuumFreezer.java index be5d8d9d7..b968b29bf 100644 --- a/src/main/java/techreborn/client/gui/GuiVacuumFreezer.java +++ b/src/main/java/techreborn/client/gui/GuiVacuumFreezer.java @@ -24,8 +24,6 @@ package techreborn.client.gui; -import java.io.IOException; - import net.minecraft.block.state.IBlockState; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.EntityPlayer; @@ -39,6 +37,8 @@ import techreborn.init.ModBlocks; import techreborn.proxies.ClientProxy; import techreborn.tiles.multiblock.TileVacuumFreezer; +import java.io.IOException; + public class GuiVacuumFreezer extends GuiBase { TileVacuumFreezer tile; @@ -102,7 +102,7 @@ public class GuiVacuumFreezer extends GuiBase { @Override public void actionPerformed(final GuiButton button) throws IOException { super.actionPerformed(button); - if (button.id == 212) { + if (button.id == 212 && !GuiBase.showSlotConfig) { if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { { // This code here makes a basic multiblock and then sets to the selected one. diff --git a/src/main/java/techreborn/client/gui/TRBuilder.java b/src/main/java/techreborn/client/gui/TRBuilder.java index e4ab719de..55b6d1447 100644 --- a/src/main/java/techreborn/client/gui/TRBuilder.java +++ b/src/main/java/techreborn/client/gui/TRBuilder.java @@ -27,23 +27,30 @@ package techreborn.client.gui; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.RenderItem; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; -import net.minecraft.client.resources.I18n; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.common.Loader; +import org.lwjgl.opengl.GL11; import reborncore.api.tile.IUpgradeable; import reborncore.client.guibuilder.GuiBuilder; import reborncore.common.powerSystem.PowerSystem; +import techreborn.init.ModItems; import techreborn.lib.ModInfo; import techreborn.proxies.ClientProxy; import java.util.ArrayList; import java.util.List; +import static net.minecraft.item.ItemStack.EMPTY; + /** * Created by Prospector */ @@ -55,6 +62,9 @@ public class TRBuilder extends GuiBuilder { } public void drawMultiEnergyBar(GuiBase gui, int x, int y, int energyStored, int maxEnergyStored, int mouseX, int mouseY, int buttonID, GuiBase.Layer layer) { + if(GuiBase.showSlotConfig){ + return; + } if (layer == GuiBase.Layer.BACKGROUND) { x += gui.getGuiLeft(); y += gui.getGuiTop(); @@ -86,6 +96,9 @@ public class TRBuilder extends GuiBuilder { } public void drawProgressBar(GuiBase gui, int progress, int maxProgress, int x, int y, int mouseX, int mouseY, ProgressDirection direction, GuiBase.Layer layer) { + if(GuiBase.showSlotConfig){ + return; + } if (layer == GuiBase.Layer.BACKGROUND) { x += gui.getGuiLeft(); y += gui.getGuiTop(); @@ -131,6 +144,9 @@ public class TRBuilder extends GuiBuilder { } public void drawTank(GuiBase gui, int x, int y, int mouseX, int mouseY, FluidStack fluid, int maxCapacity, boolean isTankEmpty, GuiBase.Layer layer) { + if(GuiBase.showSlotConfig){ + return; + } if (layer == GuiBase.Layer.BACKGROUND) { x += gui.getGuiLeft(); y += gui.getGuiTop(); @@ -189,6 +205,9 @@ public class TRBuilder extends GuiBuilder { } public void drawJEIButton(GuiBase gui, int x, int y, GuiBase.Layer layer) { + if(GuiBase.showSlotConfig){ + return; + } if (Loader.isModLoaded("jei")) { if (layer == GuiBase.Layer.BACKGROUND) { x += gui.getGuiLeft(); @@ -200,6 +219,9 @@ public class TRBuilder extends GuiBuilder { } public void drawHologramButton(GuiBase gui, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer) { + if(GuiBase.showSlotConfig){ + return; + } if (layer == GuiBase.Layer.BACKGROUND) { x += gui.getGuiLeft(); y += gui.getGuiTop(); @@ -224,6 +246,9 @@ public class TRBuilder extends GuiBuilder { } public void drawUpDownButtons(GuiBase gui, int x, int y, GuiBase.Layer layer){ + if(GuiBase.showSlotConfig){ + return; + } if (layer == GuiBase.Layer.BACKGROUND) { x += gui.getGuiLeft(); y += gui.getGuiTop(); @@ -236,6 +261,9 @@ public class TRBuilder extends GuiBuilder { } public void drawEnergyOutput(GuiBase gui, int right, int top, int maxOutput, GuiBase.Layer layer){ + if(GuiBase.showSlotConfig){ + return; + } String text = PowerSystem.getLocaliszedPowerFormattedNoSuffix(maxOutput) + " " + PowerSystem.getDisplayPower().abbreviation + "/t"; int width = gui.mc.fontRenderer.getStringWidth(text); @@ -250,6 +278,9 @@ public class TRBuilder extends GuiBuilder { } public void drawBigBlueBar(GuiBase gui, int x, int y, int value, int max, int mouseX, int mouseY, String suffix, GuiBase.Layer layer) { + if(GuiBase.showSlotConfig){ + return; + } if (layer == GuiBase.Layer.BACKGROUND) { x += gui.getGuiLeft(); y += gui.getGuiTop(); @@ -282,6 +313,9 @@ public class TRBuilder extends GuiBuilder { } public void drawBigHeatBar(GuiBase gui, int x, int y, int value, int max, GuiBase.Layer layer) { + if(GuiBase.showSlotConfig){ + return; + } if (layer == GuiBase.Layer.BACKGROUND) { x += gui.getGuiLeft(); y += gui.getGuiTop(); @@ -299,6 +333,9 @@ public class TRBuilder extends GuiBuilder { } public void drawMultiblockMissingBar(GuiBase gui, GuiBase.Layer layer) { + if(GuiBase.showSlotConfig){ + return; + } int x = 0; int y = 4; if (layer == GuiBase.Layer.BACKGROUND) { @@ -364,6 +401,36 @@ public class TRBuilder extends GuiBuilder { gui.drawTexturedModalRect(posX - 27, posY + 4, 126, 151, 30, 87); } + public void drawSlotTab(GuiScreen gui, int posX, int posY, int mouseX, int mouseY, boolean upgrades){ + int offset = 0; + if(!upgrades){ + offset = 80; + } + Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET); + gui.drawTexturedModalRect(posX - 26, posY + 84 - offset, 157, 148, 30, 30); + renderItemStack(new ItemStack(ModItems.WRENCH), posX - 19, posY + 92 - offset); + if (isInRect(posX - 19, posY + 92 - offset, 12, 12, mouseX, mouseY)) { + List list = new ArrayList<>(); + list.add("Configure slots"); + net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(list, mouseX, mouseY, gui.width, gui.height, -1, gui.mc.fontRenderer); + GlStateManager.disableLighting(); + GlStateManager.color(1, 1, 1, 1); + } + } + + public void renderItemStack(ItemStack stack, int x, int y) { + if (stack != EMPTY) { + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + RenderHelper.enableGUIStandardItemLighting(); + + RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem(); + itemRenderer.renderItemAndEffectIntoGUI(stack, x, y); + + GL11.glDisable(GL11.GL_LIGHTING); + } + } + public void drawScrapSlot(GuiScreen gui, int posX, int posY) { Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET); gui.drawTexturedModalRect(posX, posY, 150, 0, 18, 18); diff --git a/src/main/java/techreborn/client/gui/slot/GuiSlotConfiguration.java b/src/main/java/techreborn/client/gui/slot/GuiSlotConfiguration.java new file mode 100644 index 000000000..a6d05d1cf --- /dev/null +++ b/src/main/java/techreborn/client/gui/slot/GuiSlotConfiguration.java @@ -0,0 +1,206 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2017 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.client.gui.slot; + +import com.google.common.collect.Lists; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.inventory.Slot; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.lwjgl.input.Keyboard; +import reborncore.client.gui.GuiUtil; +import techreborn.client.container.builder.BuiltContainer; +import techreborn.client.gui.GuiBase; +import techreborn.client.gui.slot.elements.ConfigSlotElement; +import techreborn.client.gui.slot.elements.ElementBase; +import techreborn.client.gui.slot.elements.SlotType; + +import java.awt.*; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +public class GuiSlotConfiguration { + + static HashMap slotElementMap = new HashMap<>(); + + public static int slectedSlot = 0; + + public static void reset() { + slectedSlot = -1; + } + + public static void init(GuiBase guiBase) { + reset(); + slotElementMap.clear(); + + BuiltContainer container = guiBase.container; + for (Slot slot : container.inventorySlots) { + if (guiBase.tile != slot.inventory) { + continue; + } + ConfigSlotElement slotElement = new ConfigSlotElement(guiBase.getMachine(), slot.getSlotIndex(), SlotType.NORMAL, slot.xPos - guiBase.guiLeft + 50, slot.yPos - guiBase.guiTop - 25, guiBase); + slotElementMap.put(slot.getSlotIndex(), slotElement); + } + + } + + public static void draw(GuiBase guiBase, int mouseX, int mouseY) { + BuiltContainer container = guiBase.container; + for (Slot slot : container.inventorySlots) { + if (guiBase.tile != slot.inventory) { + continue; + } + GlStateManager.color(255, 0, 0); + Color color = new Color(255, 0, 0, 128); + GuiUtil.drawGradientRect(slot.xPos - 1, slot.yPos - 1, 18, 18, color.getRGB(), color.getRGB()); + GlStateManager.color(255, 255, 255); + } + + if (slectedSlot != -1) { + slotElementMap.get(slectedSlot).draw(guiBase); + } + } + + public static List getVisibleElements() { + if(slectedSlot == -1){ + return Collections.emptyList(); + } + return slotElementMap.values().stream() + .filter(configSlotElement -> configSlotElement.getId() == slectedSlot) + .collect(Collectors.toList()); + } + + //Allows closing of the widget with the escape key + @SubscribeEvent + public static void keyboardEvent(GuiScreenEvent.KeyboardInputEvent event){ + if(!getVisibleElements().isEmpty() && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE){ + slectedSlot = -1; + event.setCanceled(true); + } + } + + public static boolean mouseClicked(int mouseX, int mouseY, int mouseButton, GuiBase guiBase) throws IOException { + if (mouseButton == 0) { + for (ConfigSlotElement configSlotElement : getVisibleElements()) { + for (ElementBase element : configSlotElement.elements) { + if (element.isInRect(guiBase, element.x, element.y, element.getWidth(guiBase.getMachine()), element.getHeight(guiBase.getMachine()), mouseX, mouseY)) { + element.isPressing = true; + boolean action = element.onStartPress(guiBase.getMachine(), guiBase, mouseX, mouseY); + for (ElementBase e : getVisibleElements()) { + if (e != element) { + e.isPressing = false; + } + } + if (action) + break; + } else { + element.isPressing = false; + } + } + } + } + BuiltContainer container = guiBase.container; + + if(getVisibleElements().isEmpty()) { + for (Slot slot : container.inventorySlots) { + if (guiBase.tile != slot.inventory) { + continue; + } + if (guiBase.isPointInRect(slot.xPos, slot.yPos, 18, 18, mouseX, mouseY)) { + slectedSlot = slot.getSlotIndex(); + return true; + } + } + } + return !getVisibleElements().isEmpty(); + } + + public static void mouseClickMove(int mouseX, int mouseY, int mouseButton, long timeSinceLastClick, GuiBase guiBase) { + if (mouseButton == 0) { + for (ConfigSlotElement configSlotElement : getVisibleElements()) { + for (ElementBase element : configSlotElement.elements) { + if (element.isInRect(guiBase, element.x, element.y, element.getWidth(guiBase.getMachine()), element.getHeight(guiBase.getMachine()), mouseX, mouseY)) { + element.isDragging = true; + boolean action = element.onDrag(guiBase.getMachine(), guiBase, mouseX, mouseY); + for (ElementBase e : getVisibleElements()) { + if (e != element) { + e.isDragging = false; + } + } + if (action) + break; + } else { + element.isDragging = false; + } + } + } + } + } + + public static boolean mouseReleased(int mouseX, int mouseY, int mouseButton, GuiBase guiBase) { + boolean clicked = false; + if (mouseButton == 0) { + for (ConfigSlotElement configSlotElement : getVisibleElements()) { + if (configSlotElement.isInRect(guiBase, configSlotElement.x, configSlotElement.y, configSlotElement.getWidth(guiBase.getMachine()), configSlotElement.getHeight(guiBase.getMachine()), mouseX, mouseY)) { + clicked = true; + } + for (ElementBase element : Lists.reverse(configSlotElement.elements)) { + if (element.isInRect(guiBase, element.x, element.y, element.getWidth(guiBase.getMachine()), element.getHeight(guiBase.getMachine()), mouseX, mouseY)) { + element.isReleasing = true; + boolean action = element.onRelease(guiBase.getMachine(), guiBase, mouseX, mouseY); + for (ElementBase e : getVisibleElements()) { + if (e != element) { + e.isReleasing = false; + } + } + if (action) + clicked = true; + break; + } else { + element.isReleasing = false; + } + } + } + } + return clicked; + } + + public static List getExtraSpace(GuiBase guiBase){ + if(!GuiBase.showSlotConfig || slectedSlot == -1){ + return Collections.emptyList(); + } + List list = new ArrayList<>(); + ConfigSlotElement slotElement = slotElementMap.get(slectedSlot); + + //I have no idea why this works, but it does. pls fix if you know how. + list.add(new Rectangle(slotElement.adjustX(guiBase, slotElement.getX()) + guiBase.getGuiLeft() - 25, slotElement.adjustY(guiBase, 0) -10, slotElement.getWidth() - 5, slotElement.getHeight() + 15)); + return list; + } + +} diff --git a/src/main/java/techreborn/client/gui/slot/elements/ButtonElement.java b/src/main/java/techreborn/client/gui/slot/elements/ButtonElement.java new file mode 100644 index 000000000..095139825 --- /dev/null +++ b/src/main/java/techreborn/client/gui/slot/elements/ButtonElement.java @@ -0,0 +1,41 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2017 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.client.gui.slot.elements; + +public class ButtonElement extends ElementBase { + private Sprite.Button buttonSprite; + + public ButtonElement(int x, int y, Sprite.Button buttonSprite) { + super(x, y, buttonSprite.getNormal()); + this.buttonSprite = buttonSprite; + this.addUpdateAction((gui, element) -> { + if (isHovering) { + element.container.setSprite(0, buttonSprite.getHovered()); + } else { + element.container.setSprite(0, buttonSprite.getNormal()); + } + }); + } +} diff --git a/src/main/java/techreborn/client/gui/slot/elements/CheckBoxElement.java b/src/main/java/techreborn/client/gui/slot/elements/CheckBoxElement.java new file mode 100644 index 000000000..6817a8034 --- /dev/null +++ b/src/main/java/techreborn/client/gui/slot/elements/CheckBoxElement.java @@ -0,0 +1,81 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2017 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.client.gui.slot.elements; + +import reborncore.common.tile.TileLegacyMachineBase; +import techreborn.client.gui.GuiBase; + +public class CheckBoxElement extends ElementBase { + public String label, type; + public int labelColor, slotID; + TileLegacyMachineBase machineBase; + + private Sprite.CheckBox checkBoxSprite; + + public CheckBoxElement(String label, int labelColor, int x, int y, String type, int slotID, Sprite.CheckBox checkBoxSprite, TileLegacyMachineBase machineBase) { + super(x, y, checkBoxSprite.getNormal()); + this.checkBoxSprite = checkBoxSprite; + this.type = type; + this.slotID = slotID; + this.machineBase = machineBase; + this.label = label; + this.labelColor = labelColor; + if (isTicked()) { + container.setSprite(0, checkBoxSprite.getTicked()); + } else { + container.setSprite(0, checkBoxSprite.getNormal()); + } + this.addPressAction((element, gui, provider, mouseX, mouseY) -> { + if (isTicked()) { + element.container.setSprite(0, checkBoxSprite.getTicked()); + } else { + element.container.setSprite(0, checkBoxSprite.getNormal()); + } + return true; + }); + } + + @Override + public void draw(GuiBase gui) { + // super.draw(gui); + ISprite sprite = checkBoxSprite.getNormal(); + if(isTicked()){ + sprite = checkBoxSprite.getTicked(); + } + drawSprite(gui, sprite, x, y ); + drawString(gui, label, x + checkBoxSprite.getNormal().width + 5, ((y + getHeight(gui.getMachine()) / 2) - (gui.mc.fontRenderer.FONT_HEIGHT / 2)), labelColor); + } + + public boolean isTicked() { + if(type.equalsIgnoreCase("output")){ + return machineBase.slotConfiguration.getSlotDetails(slotID).autoOutput(); + } + if(type.equalsIgnoreCase("filter")){ + return machineBase.slotConfiguration.getSlotDetails(slotID).filter(); + } + return machineBase.slotConfiguration.getSlotDetails(slotID).autoInput(); + } + +} diff --git a/src/main/java/techreborn/client/gui/slot/elements/ConfigSlotElement.java b/src/main/java/techreborn/client/gui/slot/elements/ConfigSlotElement.java new file mode 100644 index 000000000..1b198e3b8 --- /dev/null +++ b/src/main/java/techreborn/client/gui/slot/elements/ConfigSlotElement.java @@ -0,0 +1,122 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2017 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.client.gui.slot.elements; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.RenderItem; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import reborncore.api.recipe.IRecipeCrafterProvider; +import reborncore.common.recipes.RecipeCrafter; +import reborncore.common.tile.SlotConfiguration; +import techreborn.client.gui.GuiBase; +import techreborn.client.gui.slot.GuiSlotConfiguration; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class ConfigSlotElement extends ElementBase { + SlotType type; + IInventory inventory; + int id; + public List elements = new ArrayList<>(); + boolean filter = false; + + + public ConfigSlotElement(IInventory slotInventory, int slotId, SlotType type, int x, int y, GuiBase gui) { + super(x, y, type.getButtonSprite()); + this.type = type; + this.inventory = slotInventory; + this.id = slotId; + + SlotConfigPopupElement popupElement; + + elements.add(popupElement = new SlotConfigPopupElement(this.id, x - 22, y - 22, this)); + elements.add(new ButtonElement(x + 37, y - 25, Sprite.EXIT_BUTTON).addReleaseAction((element, gui1, provider, mouseX, mouseY) -> { + GuiSlotConfiguration.slectedSlot = -1; + return true; + })); + + SlotConfiguration.SlotConfigHolder slotConfigHolder = gui.getMachine().slotConfiguration.getSlotDetails(id); + + elements.add(new CheckBoxElement("Auto Input", 0xFFFFFFFF, x - 26, y + 42, "input", slotId, Sprite.LIGHT_CHECK_BOX, gui.getMachine()).addPressAction((element, gui12, provider, mouseX, mouseY) -> { + popupElement.updateCheckBox((CheckBoxElement) element, "input", gui12); + return true; + })); + elements.add(new CheckBoxElement("Auto Output", 0xFFFFFFFF, x - 26, y + 57,"output", slotId, Sprite.LIGHT_CHECK_BOX, gui.getMachine()).addPressAction((element, gui13, provider, mouseX, mouseY) -> { + popupElement.updateCheckBox((CheckBoxElement) element, "output", gui13); + return true; + })); + + if(gui.getMachine() instanceof IRecipeCrafterProvider){ + RecipeCrafter recipeCrafter = ((IRecipeCrafterProvider) gui.getMachine()).getRecipeCrafter(); + if(Arrays.stream(recipeCrafter.inputSlots).anyMatch(value -> value == slotId)){ + elements.add(new CheckBoxElement("Filter Input", 0xFFFFFFFF, x - 26, y + 72,"filter", slotId, Sprite.LIGHT_CHECK_BOX, gui.getMachine()).addPressAction((element, gui13, provider, mouseX, mouseY) -> { + popupElement.updateCheckBox((CheckBoxElement) element, "filter", gui13); + return true; + })); + filter = true; + popupElement.filter = true; + } + } + setWidth(85); + setHeight(105 + (filter ? 15 : 0)); + } + + @Override + public void draw(GuiBase gui) { + super.draw(gui); + ItemStack stack = inventory.getStackInSlot(id); + int xPos = x + 1 + gui.guiLeft; + int yPos = y + 1 + gui.guiTop; + + GlStateManager.enableDepth(); + GlStateManager.pushMatrix(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + RenderHelper.enableGUIStandardItemLighting(); + RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); + renderItem.renderItemAndEffectIntoGUI(gui.mc.player, stack, xPos, yPos); + renderItem.renderItemOverlayIntoGUI(gui.mc.fontRenderer, stack, xPos, yPos, null); + GlStateManager.disableDepth(); + GlStateManager.disableLighting(); + GlStateManager.popMatrix(); + if (isHovering) { + drawSprite(gui, type.getButtonHoverOverlay(), x, y); + } + elements.forEach(elementBase -> elementBase.draw(gui)); + } + + public SlotType getType() { + return type; + } + + public int getId() { + return id; + } +} \ No newline at end of file diff --git a/src/main/java/techreborn/client/gui/slot/elements/ElementBase.java b/src/main/java/techreborn/client/gui/slot/elements/ElementBase.java new file mode 100644 index 000000000..b4d064697 --- /dev/null +++ b/src/main/java/techreborn/client/gui/slot/elements/ElementBase.java @@ -0,0 +1,395 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2017 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.client.gui.slot.elements; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.*; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.TextFormatting; +import reborncore.client.guibuilder.GuiBuilder; +import reborncore.common.tile.TileLegacyMachineBase; +import techreborn.client.gui.GuiBase; +import techreborn.lib.ModInfo; + +import java.util.ArrayList; +import java.util.List; + +public class ElementBase { + + public int x; + public int y; + public boolean isHovering = false; + public boolean isDragging = false; + public boolean isPressing = false; + public boolean isReleasing = false; + public boolean startPressLast = false; + public boolean isHoveringLast = false; + public boolean isDraggingLast = false; + public boolean isPressingLast = false; + public boolean isReleasingLast = false; + public List hoverActions = new ArrayList<>(); + public List dragActions = new ArrayList<>(); + public List startPressActions = new ArrayList<>(); + public List pressActions = new ArrayList<>(); + public List releaseActions = new ArrayList<>(); + public SpriteContainer container; + public List updateActions = new ArrayList<>(); + public List buttonUpdate = new ArrayList<>(); + private int width; + private int height; + + public static final ResourceLocation MECH_ELEMENTS = new ResourceLocation(ModInfo.MOD_ID, "textures/gui/elements.png"); + + public ElementBase(int x, int y, SpriteContainer container) { + this.container = container; + this.x = x; + this.y = y; + } + + public ElementBase(int x, int y, ISprite... sprites) { + this.container = new SpriteContainer(); + for (ISprite sprite : sprites) { + container.addSprite(sprite); + } + this.x = x; + this.y = y; + } + + public ElementBase(int x, int y, int width, int height) { + this.container = new SpriteContainer(); + this.x = x; + this.y = y; + this.width = width; + this.height = height; + } + + public ElementBase(int x, int y, int width, int height, SpriteContainer container) { + this.container = container; + this.x = x; + this.y = y; + this.width = width; + this.height = height; + } + + public ElementBase(int x, int y, int width, int height, ISprite... sprites) { + this.container = new SpriteContainer(); + for (ISprite sprite : sprites) { + container.addSprite(sprite); + } + this.x = x; + this.y = y; + this.width = width; + this.height = height; + } + + public SpriteContainer getSpriteContainer() { + return container; + } + + public void adjustDimensions(TileLegacyMachineBase provider) { + if (container.offsetSprites != null) { + for (OffsetSprite offsetSprite : container.offsetSprites) { + if (offsetSprite.getSprite().getSprite(provider).width + offsetSprite.getOffsetX(provider) > this.width) { + this.width = offsetSprite.getSprite().getSprite(provider).width + offsetSprite.getOffsetX(provider); + } + if (offsetSprite.getSprite().getSprite(provider).height + offsetSprite.getOffsetY(provider) > this.height) { + this.height = offsetSprite.getSprite().getSprite(provider).height + offsetSprite.getOffsetY(provider); + } + } + } + } + + public void draw(GuiBase gui) { + for (OffsetSprite sprite : getSpriteContainer().offsetSprites) { + drawSprite(gui, sprite.getSprite(), x + sprite.getOffsetX(gui.getMachine()), y + sprite.getOffsetY(gui.getMachine())); + } + } + + public void renderUpdate(GuiBase gui) { + isHoveringLast = isHovering; + isPressingLast = isPressing; + isDraggingLast = isDragging; + isReleasingLast = isReleasing; + } + + public void update(GuiBase gui) { + for (UpdateAction action : updateActions) { + action.update(gui, this); + } + } + + public ElementBase addUpdateAction(UpdateAction action) { + updateActions.add(action); + return this; + } + + public ElementBase setWidth(int width) { + this.width = width; + return this; + } + + public ElementBase setHeight(int height) { + this.height = height; + return this; + } + + public int getX() { + return x; + } + + public ElementBase setX(int x) { + this.x = x; + return this; + } + + public int getY() { + return y; + } + + public ElementBase setY(int y) { + this.y = y; + return this; + } + + public int getWidth(TileLegacyMachineBase provider) { + adjustDimensions(provider); + return width; + } + + public int getHeight(TileLegacyMachineBase provider) { + adjustDimensions(provider); + return height; + } + + public int getWidth() { + return width; + } + + public int getHeight() { + return height; + } + + public ElementBase addHoverAction(ElementBase.Action action) { + this.hoverActions.add(action); + return this; + } + + public ElementBase addDragAction(ElementBase.Action action) { + this.dragActions.add(action); + return this; + } + + public ElementBase addStartPressAction(ElementBase.Action action) { + this.startPressActions.add(action); + return this; + } + + public ElementBase addPressAction(ElementBase.Action action) { + this.pressActions.add(action); + return this; + } + + public ElementBase addReleaseAction(ElementBase.Action action) { + this.releaseActions.add(action); + return this; + } + + public boolean onHover(TileLegacyMachineBase provider, GuiBase gui, int mouseX, int mouseY) { + for (ElementBase.Action action : hoverActions) { + action.execute(this, gui, provider, mouseX, mouseY); + } + return !hoverActions.isEmpty(); + } + + public boolean onDrag(TileLegacyMachineBase provider, GuiBase gui, int mouseX, int mouseY) { + for (ElementBase.Action action : dragActions) { + action.execute(this, gui, provider, mouseX, mouseY); + } + return !dragActions.isEmpty(); + } + + public boolean onStartPress(TileLegacyMachineBase provider, GuiBase gui, int mouseX, int mouseY) { + for (ElementBase.Action action : startPressActions) { + action.execute(this, gui, provider, mouseX, mouseY); + } + return !startPressActions.isEmpty(); + } + + public boolean onRelease(TileLegacyMachineBase provider, GuiBase gui, int mouseX, int mouseY) { + for (ElementBase.Action action : releaseActions) { + if(action.execute(this, gui, provider, mouseX, mouseY)){ + return true; + } + } + if (isPressing) { + for (ElementBase.Action action : pressActions) { + action.execute(this, gui, provider, mouseX, mouseY); + } + } + return !releaseActions.isEmpty() || !pressActions.isEmpty(); + } + + public interface Action { + boolean execute(ElementBase element, GuiBase gui, TileLegacyMachineBase provider, int mouseX, int mouseY); + } + + public interface UpdateAction { + void update(GuiBase gui, ElementBase element); + } + + public void drawRect(GuiBase gui, int x, int y, int width, int height, int colour) { + drawGradientRect(gui, x, y, width, height, colour, colour); + } + + /* + Taken from Gui + */ + public void drawGradientRect(GuiBase gui, int x, int y, int width, int height, int startColor, int endColor) { + x = adjustX(gui, x); + y = adjustY(gui, y); + + int left = x; + int top = y; + int right = x + width; + int bottom = y + height; + float f = (float) (startColor >> 24 & 255) / 255.0F; + float f1 = (float) (startColor >> 16 & 255) / 255.0F; + float f2 = (float) (startColor >> 8 & 255) / 255.0F; + float f3 = (float) (startColor & 255) / 255.0F; + float f4 = (float) (endColor >> 24 & 255) / 255.0F; + float f5 = (float) (endColor >> 16 & 255) / 255.0F; + float f6 = (float) (endColor >> 8 & 255) / 255.0F; + float f7 = (float) (endColor & 255) / 255.0F; + GlStateManager.disableTexture2D(); + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.shadeModel(7425); + Tessellator tessellator = Tessellator.getInstance(); + BufferBuilder vertexbuffer = tessellator.getBuffer(); + vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR); + vertexbuffer.pos((double) right, (double) top, (double) 0).color(f1, f2, f3, f).endVertex(); + vertexbuffer.pos((double) left, (double) top, (double) 0).color(f1, f2, f3, f).endVertex(); + vertexbuffer.pos((double) left, (double) bottom, (double) 0).color(f5, f6, f7, f4).endVertex(); + vertexbuffer.pos((double) right, (double) bottom, (double) 0).color(f5, f6, f7, f4).endVertex(); + tessellator.draw(); + GlStateManager.shadeModel(7424); + GlStateManager.disableBlend(); + GlStateManager.enableAlpha(); + GlStateManager.enableTexture2D(); + } + + public int adjustX(GuiBase gui, int x) { + return gui.guiLeft + x; + } + + public int adjustY(GuiBase gui, int y) { + return gui.guiTop + y; + } + + public boolean isInRect(GuiBase gui, int x, int y, int xSize, int ySize, int mouseX, int mouseY) { + return gui.isPointInRect(x + gui.guiLeft, y + gui.guiTop, xSize, ySize, mouseX, mouseY); + } + + public void drawString(GuiBase gui, String string, int x, int y, int color) { + x = adjustX(gui, x); + y = adjustY(gui, y); + gui.mc.fontRenderer.drawString(string, x, y, color); + } + + public void drawString(GuiBase gui, String string, int x, int y) { + drawString(gui, string, x, y, 16777215); + } + + public void setTextureSheet(ResourceLocation textureLocation) { + Minecraft.getMinecraft().getTextureManager().bindTexture(textureLocation); + } + + public void drawCenteredString(GuiBase gui, String string, int y, int colour) { + drawString(gui, string, (gui.getXSize() / 2 - gui.mc.fontRenderer.getStringWidth(string) / 2), y, colour); + } + + public void drawCenteredString(GuiBase gui, String string, int x, int y, int colour) { + drawString(gui, string, (x - gui.mc.fontRenderer.getStringWidth(string) / 2), y, colour); + } + + public int getStringWidth(String string) { + return Minecraft.getMinecraft().fontRenderer.getStringWidth(string); + } + + public void drawSprite(GuiBase gui, ISprite iSprite, int x, int y) { + Sprite sprite = iSprite.getSprite(gui.getMachine()); + if (sprite != null) { + if (sprite.hasTextureInfo()) { + GlStateManager.color(1F, 1F, 1F); + setTextureSheet(sprite.textureLocation); + gui.drawTexturedModalRect(x + gui.guiLeft, y + gui.guiTop, sprite.x, sprite.y, sprite.width, sprite.height); + } + if (sprite.hasStack()) { + GlStateManager.pushMatrix(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + RenderHelper.enableGUIStandardItemLighting(); + + RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem(); + itemRenderer.renderItemAndEffectIntoGUI(sprite.itemStack, x + gui.guiLeft, y + gui.guiTop); + + GlStateManager.disableLighting(); + GlStateManager.popMatrix(); + } + } + } + + public int getScaledBurnTime(int scale, int burnTime, int totalBurnTime) { + return (int) (((float) burnTime / (float) totalBurnTime) * scale); + } + + public TextFormatting getPercentageColour(int percentage) { + if (percentage <= 10) { + return TextFormatting.RED; + } else if (percentage >= 75) { + return TextFormatting.GREEN; + } else { + return TextFormatting.YELLOW; + } + } + + public int getPercentage(int MaxValue, int CurrentValue) { + if (CurrentValue == 0) + return 0; + return (int) ((CurrentValue * 100.0f) / MaxValue); + } + + public void drawDefaultBackground(GuiScreen gui, int x, int y, int width, int height) { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiBuilder.defaultTextureSheet); + gui.drawTexturedModalRect(x, y, 0, 0, width / 2, height / 2); + gui.drawTexturedModalRect(x + width / 2, y, 150 - width / 2, 0, width / 2, height / 2); + gui.drawTexturedModalRect(x, y + height / 2, 0, 150 - height / 2, width / 2, height / 2); + gui.drawTexturedModalRect(x + width / 2, y + height / 2, 150 - width / 2, 150 - height / 2, width / 2, height / 2); + } +} diff --git a/src/main/java/techreborn/client/gui/slot/elements/ISprite.java b/src/main/java/techreborn/client/gui/slot/elements/ISprite.java new file mode 100644 index 000000000..c69f61d3d --- /dev/null +++ b/src/main/java/techreborn/client/gui/slot/elements/ISprite.java @@ -0,0 +1,31 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2017 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.client.gui.slot.elements; + +import reborncore.common.tile.TileLegacyMachineBase; + +public interface ISprite { + Sprite getSprite(TileLegacyMachineBase provider); +} diff --git a/src/main/java/techreborn/client/gui/slot/elements/LICENSE b/src/main/java/techreborn/client/gui/slot/elements/LICENSE new file mode 100644 index 000000000..9318f0db6 --- /dev/null +++ b/src/main/java/techreborn/client/gui/slot/elements/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Prospector + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/main/java/techreborn/client/gui/slot/elements/OffsetSprite.java b/src/main/java/techreborn/client/gui/slot/elements/OffsetSprite.java new file mode 100644 index 000000000..b8e5200bb --- /dev/null +++ b/src/main/java/techreborn/client/gui/slot/elements/OffsetSprite.java @@ -0,0 +1,69 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2017 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.client.gui.slot.elements; + +import reborncore.common.tile.TileLegacyMachineBase; + +public class OffsetSprite { + public ISprite sprite; + public int offsetX = 0; + public int offsetY = 0; + + public OffsetSprite(ISprite sprite, int offsetX, int offsetY) { + this.sprite = sprite; + this.offsetX = offsetX; + this.offsetY = offsetY; + } + + public OffsetSprite(ISprite sprite) { + this.sprite = sprite; + } + + public OffsetSprite(Sprite sprite, TileLegacyMachineBase provider) { + this.sprite = sprite; + } + + public ISprite getSprite() { + return sprite; + } + + public int getOffsetX(TileLegacyMachineBase provider) { + return offsetX + sprite.getSprite(provider).offsetX; + } + + public OffsetSprite setOffsetX(int offsetX) { + this.offsetX = offsetX; + return this; + } + + public int getOffsetY(TileLegacyMachineBase provider) { + return offsetY + sprite.getSprite(provider).offsetY; + } + + public OffsetSprite setOffsetY(int offsetY) { + this.offsetY = offsetY; + return this; + } +} diff --git a/src/main/java/techreborn/client/gui/slot/elements/README.md b/src/main/java/techreborn/client/gui/slot/elements/README.md new file mode 100644 index 000000000..b79269833 --- /dev/null +++ b/src/main/java/techreborn/client/gui/slot/elements/README.md @@ -0,0 +1,3 @@ +All code in this class was taken with permssion from https://github.com/ProfessorProspector/Mechanical-Construct + +A large ammount of modifications have taken place to allow it to work with techreborn. \ No newline at end of file diff --git a/src/main/java/techreborn/client/gui/slot/elements/SlotConfigPopupElement.java b/src/main/java/techreborn/client/gui/slot/elements/SlotConfigPopupElement.java new file mode 100644 index 000000000..2ec4ce894 --- /dev/null +++ b/src/main/java/techreborn/client/gui/slot/elements/SlotConfigPopupElement.java @@ -0,0 +1,221 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2017 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.client.gui.slot.elements; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.fml.client.FMLClientHandler; +import reborncore.RebornCore; +import reborncore.client.gui.GuiUtil; +import reborncore.common.network.NetworkManager; +import reborncore.common.network.packet.PacketIOSave; +import reborncore.common.network.packet.PacketSlotSave; +import reborncore.common.tile.SlotConfiguration; +import reborncore.common.tile.TileLegacyMachineBase; +import reborncore.common.util.MachineFacing; +import techreborn.client.gui.GuiBase; + +import java.awt.*; + +public class SlotConfigPopupElement extends ElementBase { + int id; + public boolean filter = false; + + ConfigSlotElement slotElement; + + + public SlotConfigPopupElement(int slotId, int x, int y, ConfigSlotElement slotElement) { + super(x, y, Sprite.SLOT_CONFIG_POPUP); + this.id = slotId; + this.slotElement = slotElement; + } + + @Override + public void draw(GuiBase gui) { + drawDefaultBackground(gui, adjustX(gui, getX() -8), adjustY(gui, getY() - 7), 84, 105 + (filter ? 15 : 0)); + super.draw(gui); + + TileLegacyMachineBase machine = ((TileLegacyMachineBase) gui.tile); + IBlockAccess blockAccess = machine.getWorld(); + BlockPos pos = machine.getPos(); + IBlockState state = blockAccess.getBlockState(pos); + IBlockState actualState = state.getBlock().getDefaultState().getActualState(blockAccess, pos); + BlockRendererDispatcher dispatcher = FMLClientHandler.instance().getClient().getBlockRendererDispatcher(); + IBakedModel model = dispatcher.getBlockModelShapes().getModelForState(state.getBlock().getDefaultState()); + FMLClientHandler.instance().getClient().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + drawState(gui, blockAccess, model, actualState, pos, dispatcher, 4, 23); //left + drawState(gui, blockAccess, model, actualState, pos, dispatcher, 23, -12, -90F, 1F, 0F, 0F); //top + drawState(gui, blockAccess, model, actualState, pos, dispatcher, 23, 23, -90F, 0F, 1F, 0F); //centre + drawState(gui, blockAccess, model, actualState, pos, dispatcher, 23, 42, 90F, 1F, 0F, 0F); //bottom + drawState(gui, blockAccess, model, actualState, pos, dispatcher, 26, 23, 180F, 0F, 1F, 0F); //right + drawState(gui, blockAccess, model, actualState, pos, dispatcher, 26, 42, 90F, 0F, 1F, 0F); //back + + + drawSlotSateColor(gui.getMachine(), MachineFacing.UP.getFacing(machine), id, 22, -1, gui); + drawSlotSateColor(gui.getMachine(), MachineFacing.FRONT.getFacing(machine), id, 22, 18, gui); + drawSlotSateColor(gui.getMachine(), MachineFacing.DOWN.getFacing(machine), id, 22, 37, gui); + drawSlotSateColor(gui.getMachine(), MachineFacing.RIGHT.getFacing(machine), id, 41, 18, gui); + drawSlotSateColor(gui.getMachine(), MachineFacing.BACK.getFacing(machine), id, 41, 37, gui); + drawSlotSateColor(gui.getMachine(), MachineFacing.LEFT.getFacing(machine), id, 3, 18, gui); + } + + @Override + public boolean onRelease(TileLegacyMachineBase provider, GuiBase gui, int mouseX, int mouseY) { + if(isInBox(23 , 4, 16, 16, mouseX, mouseY, gui)){ + cyleSlotConfig(MachineFacing.UP.getFacing(provider), gui); + } else if(isInBox(23 , 23, 16, 16, mouseX, mouseY, gui)){ + cyleSlotConfig(MachineFacing.FRONT.getFacing(provider), gui); + } else if(isInBox(42 , 23, 16, 16, mouseX, mouseY, gui)){ + cyleSlotConfig(MachineFacing.RIGHT.getFacing(provider), gui); + } else if(isInBox(4 , 23, 16, 16, mouseX, mouseY, gui)){ + cyleSlotConfig(MachineFacing.LEFT.getFacing(provider), gui); + } else if(isInBox(23 , 42, 16, 16, mouseX, mouseY, gui)){ + cyleSlotConfig(MachineFacing.DOWN.getFacing(provider), gui); + } else if(isInBox(42 , 42, 16, 16, mouseX, mouseY, gui)){ + cyleSlotConfig(MachineFacing.BACK.getFacing(provider), gui); + } else { + return false; + } + return true; + } + + public void cyleSlotConfig(EnumFacing side, GuiBase guiBase){ + SlotConfiguration.SlotConfig currentSlot = guiBase.getMachine().slotConfiguration.getSlotDetails(id).getSideDetail(side); + + SlotConfiguration.SlotIO slotIO = new SlotConfiguration.SlotIO(currentSlot.getSlotIO().getIoConfig().getNext()); + SlotConfiguration.SlotConfig newConfig = new SlotConfiguration.SlotConfig(side, slotIO, id); + PacketSlotSave packetSlotSave = new PacketSlotSave(guiBase.tile.getPos(), newConfig); + NetworkManager.sendToServer(packetSlotSave); + } + + public void updateCheckBox(CheckBoxElement checkBoxElement, String type, GuiBase guiBase){ + SlotConfiguration.SlotConfigHolder configHolder = guiBase.getMachine().slotConfiguration.getSlotDetails(id); + boolean input = configHolder.autoInput(); + boolean output = configHolder.autoOutput(); + boolean filter = configHolder.filter(); + if(type.equalsIgnoreCase("input")){ + input = !configHolder.autoInput(); + } + if(type.equalsIgnoreCase("output")){ + output = !configHolder.autoOutput(); + } + if(type.equalsIgnoreCase("filter")){ + filter = !configHolder.filter(); + } + + PacketIOSave packetSlotSave = new PacketIOSave(guiBase.tile.getPos(), id, input, output, filter); + NetworkManager.sendToServer(packetSlotSave); + } + + private void drawSlotSateColor(TileLegacyMachineBase machineBase, EnumFacing side, int slotID, int inx, int iny, GuiBase gui){ + iny += 4; + int sx = inx + getX() + gui.guiLeft; + int sy = iny + getY() + gui.guiTop; + SlotConfiguration.SlotConfigHolder slotConfigHolder = machineBase.slotConfiguration.getSlotDetails(slotID); + if(slotConfigHolder == null){ + RebornCore.logHelper.debug("Humm, this isnt suppoed to happen"); + return; + } + SlotConfiguration.SlotConfig slotConfig = slotConfigHolder.getSideDetail(side); + Color color; + switch (slotConfig.getSlotIO().getIoConfig()){ + case NONE: + color = new Color(0, 0, 0, 0); + break; + case INPUT: + color = new Color(0, 0, 255, 128); + break; + case OUTPUT: + color = new Color(255, 69, 0, 128); + break; + default: + color = new Color(0, 0, 0, 0); + break; + } + GlStateManager.color(255, 255, 255); + GuiUtil.drawGradientRect(sx, sy, 18, 18, color.getRGB(), color.getRGB()); + GlStateManager.color(255, 255, 255); + + } + + private boolean isInBox(int rectX, int rectY, int rectWidth, int rectHeight, int pointX, int pointY, GuiBase guiBase){ + rectX += getX(); + rectY += getY(); + if(true){ + return isInRect(guiBase, rectX, rectY, rectWidth, rectHeight, pointX, pointY); + } + return (pointX - guiBase.getGuiLeft()) >= rectX - 1 && (pointX - guiBase.getGuiLeft()) < rectX + rectWidth + 1 && (pointY - guiBase.getGuiTop()) >= rectY - 1 && (pointY - guiBase.getGuiTop()) < rectY + rectHeight + 1; + } + + public void drawState(GuiBase gui, + IBlockAccess blockAccess, + IBakedModel model, + IBlockState actualState, + BlockPos pos, + BlockRendererDispatcher dispatcher, + int x, + int y, + float rotAngle, + float rotX, + float rotY, + float rotZ) { + + GlStateManager.pushMatrix(); + GlStateManager.enableDepth(); + GlStateManager.translate(8 + gui.guiLeft + this.x + x, 8 + gui.guiTop + this.y + y, 512); + GlStateManager.scale(16F, 16F, 16F); + GlStateManager.translate(0.5F, 0.5F, 0.5F); + GlStateManager.scale(-1, -1, -1); + if (rotAngle != 0) { + GlStateManager.rotate(rotAngle, rotX, rotY, rotZ); + } + dispatcher.getBlockModelRenderer().renderModelBrightness(model, actualState, 1F, false); + GlStateManager.disableDepth(); + GlStateManager.popMatrix(); + +/* GlStateManager.pushMatrix(); + GlStateManager.enableDepth(); + // GlStateManager.translate(8 + gui.xFactor + this.x + x, 8 + gui.yFactor + this.y + y, 1000); + GlStateManager.translate(gui.xFactor + this.x + x, gui.yFactor + this.y + y, 512); + if (rotAngle != 0) { + GlStateManager.rotate(rotAngle, rotX, rotY, rotZ); + } + GlStateManager.scale(16F, 16F, 16F); + GlStateManager.translate(-0.5F, -0.5F, -0.5F); + GlStateManager.scale(-1, -1, -1); + GlStateManager.disableDepth(); + GlStateManager.popMatrix();*/ + } + + public void drawState(GuiBase gui, IBlockAccess blockAccess, IBakedModel model, IBlockState actualState, BlockPos pos, BlockRendererDispatcher dispatcher, int x, int y) { + drawState(gui, blockAccess, model, actualState, pos, dispatcher, x, y, 0, 0, 0, 0); + } +} \ No newline at end of file diff --git a/src/main/java/techreborn/client/gui/slot/elements/SlotElement.java b/src/main/java/techreborn/client/gui/slot/elements/SlotElement.java new file mode 100644 index 000000000..85a80b8ae --- /dev/null +++ b/src/main/java/techreborn/client/gui/slot/elements/SlotElement.java @@ -0,0 +1,62 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2017 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.client.gui.slot.elements; + +import net.minecraftforge.items.ItemStackHandler; + +public class SlotElement extends ElementBase { + protected ItemStackHandler slotInventory; + protected SlotType type; + int slotId, slotX, slotY; + + public SlotElement(ItemStackHandler slotInventory, int slotId, int slotX, int slotY, SlotType type, int x, int y) { + super(x, y, type.getSprite()); + this.type = type; + this.slotInventory = slotInventory; + this.slotId = slotId; + this.slotX = slotX; + this.slotY = slotY; + } + + public SlotType getType() { + return type; + } + + public ItemStackHandler getSlotInventory() { + return slotInventory; + } + + public int getSlotId() { + return slotId; + } + + public int getSlotX() { + return slotX; + } + + public int getSlotY() { + return slotY; + } +} \ No newline at end of file diff --git a/src/main/java/techreborn/client/gui/slot/elements/SlotType.java b/src/main/java/techreborn/client/gui/slot/elements/SlotType.java new file mode 100644 index 000000000..c048053f2 --- /dev/null +++ b/src/main/java/techreborn/client/gui/slot/elements/SlotType.java @@ -0,0 +1,69 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2017 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.client.gui.slot.elements; + +public enum SlotType { + NORMAL(1, 1, Sprite.SLOT_NORMAL, Sprite.BUTTON_SLOT_NORMAL, Sprite.BUTTON_HOVER_OVERLAY_SLOT_NORMAL); + + int slotOffsetX; + int slotOffsetY; + Sprite sprite; + Sprite buttonSprite; + Sprite buttonHoverOverlay; + + SlotType(int slotOffsetX, int slotOffsetY, Sprite sprite, Sprite buttonSprite, Sprite buttonHoverOverlay) { + this.slotOffsetX = slotOffsetX; + this.slotOffsetY = slotOffsetY; + this.sprite = sprite; + this.buttonSprite = buttonSprite; + this.buttonHoverOverlay = buttonHoverOverlay; + } + + SlotType(int slotOffset, Sprite sprite) { + this.slotOffsetX = slotOffset; + this.slotOffsetY = slotOffset; + this.sprite = sprite; + } + + public int getSlotOffsetX() { + return slotOffsetX; + } + + public int getSlotOffsetY() { + return slotOffsetY; + } + + public Sprite getSprite() { + return sprite; + } + + public Sprite getButtonSprite() { + return buttonSprite; + } + + public Sprite getButtonHoverOverlay() { + return buttonHoverOverlay; + } +} \ No newline at end of file diff --git a/src/main/java/techreborn/client/gui/slot/elements/Sprite.java b/src/main/java/techreborn/client/gui/slot/elements/Sprite.java new file mode 100644 index 000000000..2b9e9d21e --- /dev/null +++ b/src/main/java/techreborn/client/gui/slot/elements/Sprite.java @@ -0,0 +1,169 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2017 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.client.gui.slot.elements; + +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import reborncore.common.tile.TileLegacyMachineBase; + +public class Sprite implements ISprite { + public static final Sprite EMPTY = new Sprite(ElementBase.MECH_ELEMENTS, 0, 0, 0, 0); + public static final Sprite SLOT_NORMAL = new Sprite(ElementBase.MECH_ELEMENTS, 0, 0, 18, 18); + public static final Sprite CHARGE_SLOT_ICON = new Sprite(ElementBase.MECH_ELEMENTS, 18, 0, 18, 18); + public static final Sprite DISCHARGE_SLOT_ICON = new Sprite(ElementBase.MECH_ELEMENTS, 36, 0, 18, 18); + public static final Sprite ENERGY_BAR = new Sprite(ElementBase.MECH_ELEMENTS, 0, 18, 12, 40); + public static final Sprite ENERGY_BAR_BACKGROUND = new Sprite(ElementBase.MECH_ELEMENTS, 12, 18, 14, 42); + public static final Sprite TOP_ENERGY_BAR = new Sprite(ElementBase.MECH_ELEMENTS, 0, 215, 167, 2); + public static final Sprite TOP_ENERGY_BAR_BACKGROUND = new Sprite(ElementBase.MECH_ELEMENTS, 0, 217, 169, 3); + public static final Sprite LEFT_TAB = new Sprite(ElementBase.MECH_ELEMENTS, 0, 86, 23, 26); + public static final Sprite LEFT_TAB_SELECTED = new Sprite(ElementBase.MECH_ELEMENTS, 0, 60, 29, 26); + public static final Sprite CONFIGURE_ICON = new Sprite(ElementBase.MECH_ELEMENTS, 26, 18, 16, 16); + public static final Sprite REDSTONE_DISABLED_ICON = new Sprite(new ItemStack(Items.GUNPOWDER)); + public static final Sprite REDSTONE_LOW_ICON = new Sprite(new ItemStack(Items.REDSTONE)); + public static final Sprite REDSTONE_HIGH_ICON = new Sprite(new ItemStack(Blocks.REDSTONE_TORCH)); + public static final Sprite UPGRADE_ICON = new Sprite(ElementBase.MECH_ELEMENTS, 26, 34, 16, 16); + public static final Sprite ENERGY_ICON = new Sprite(ElementBase.MECH_ELEMENTS, 46, 19, 9, 13); + public static final Sprite ENERGY_ICON_EMPTY = new Sprite(ElementBase.MECH_ELEMENTS, 62, 19, 9, 13); + public static final Sprite JEI_ICON = new Sprite(ElementBase.MECH_ELEMENTS, 42, 34, 16, 16); + public static final Sprite BUTTON_SLOT_NORMAL = new Sprite(ElementBase.MECH_ELEMENTS, 54, 0, 18, 18); + public static final Sprite FAKE_SLOT = new Sprite(ElementBase.MECH_ELEMENTS, 72, 0, 18, 18); + public static final Sprite BUTTON_HOVER_OVERLAY_SLOT_NORMAL = new Sprite(ElementBase.MECH_ELEMENTS, 90, 0, 18, 18); + public static final Sprite SLOT_CONFIG_POPUP = new Sprite(ElementBase.MECH_ELEMENTS, 29, 60, 62, 62); + public static final Sprite.Button EXIT_BUTTON = new Sprite.Button(new Sprite(ElementBase.MECH_ELEMENTS, 26, 122, 13, 13), new Sprite(ElementBase.MECH_ELEMENTS, 39, 122, 13, 13)); + public static final Sprite.CheckBox DARK_CHECK_BOX = new Sprite.CheckBox(new Sprite(ElementBase.MECH_ELEMENTS, 74, 18, 13, 13), new Sprite(ElementBase.MECH_ELEMENTS, 87, 18, 16, 13)); + public static final Sprite.CheckBox LIGHT_CHECK_BOX = new Sprite.CheckBox(new Sprite(ElementBase.MECH_ELEMENTS, 74, 31, 13, 13), new Sprite(ElementBase.MECH_ELEMENTS, 87, 31, 16, 13)); + + public final ResourceLocation textureLocation; + public final int x; + public final int y; + public final int width; + public final int height; + public int offsetX = 0; + public int offsetY = 0; + public ItemStack itemStack; + + public Sprite(ResourceLocation textureLocation, int x, int y, int width, int height) { + this.textureLocation = textureLocation; + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.itemStack = null; + } + + public Sprite(ItemStack stack) { + this.textureLocation = null; + this.x = -1; + this.y = -1; + this.width = -1; + this.height = -1; + this.itemStack = stack; + } + + public boolean hasStack() { + return itemStack != null; + } + + public boolean hasTextureInfo() { + return x >= 0 && y >= 0 && width >= 0 && height >= 0; + } + + public Sprite setOffsetX(int offsetX) { + this.offsetX = offsetX; + return this; + } + + public Sprite setOffsetY(int offsetY) { + this.offsetY = offsetY; + return this; + } + + @Override + public Sprite getSprite(TileLegacyMachineBase provider) { + return this; + } + + public static class Button { + private Sprite normal; + private Sprite hovered; + + public Button(Sprite normal, Sprite hovered) { + this.normal = normal; + this.hovered = hovered; + } + + public Sprite getNormal() { + return normal; + } + + public Sprite getHovered() { + return hovered; + } + } + + public static class ToggleButton { + private Sprite normal; + private Sprite hovered; + private Sprite pressed; + + public ToggleButton(Sprite normal, Sprite hovered, Sprite pressed) { + this.normal = normal; + this.hovered = hovered; + this.pressed = pressed; + } + + public Sprite getNormal() { + return normal; + } + + public Sprite getHovered() { + return hovered; + } + + public Sprite getPressed() { + return pressed; + } + } + + public static class CheckBox { + private Sprite normal; + private Sprite ticked; + + public CheckBox(Sprite normal, Sprite ticked) { + this.normal = normal; + this.ticked = ticked; + } + + public Sprite getNormal() { + return normal; + } + + public Sprite getTicked() { + return ticked; + } + } +} diff --git a/src/main/java/techreborn/client/gui/slot/elements/SpriteContainer.java b/src/main/java/techreborn/client/gui/slot/elements/SpriteContainer.java new file mode 100644 index 000000000..9a32bf22b --- /dev/null +++ b/src/main/java/techreborn/client/gui/slot/elements/SpriteContainer.java @@ -0,0 +1,78 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2017 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.client.gui.slot.elements; + +import java.util.ArrayList; +import java.util.List; + +public class SpriteContainer { + public List offsetSprites = new ArrayList<>(); + + public SpriteContainer setSprite(int index, OffsetSprite sprite) { + offsetSprites.set(index, sprite); + return this; + } + + public SpriteContainer setSprite(int index, ISprite sprite, int offsetX, int offsetY) { + if (sprite instanceof Sprite) { + offsetSprites.set(index, new OffsetSprite(sprite).setOffsetX(((Sprite) sprite).offsetX + offsetX).setOffsetY(((Sprite) sprite).offsetY + offsetY)); + } else { + offsetSprites.set(index, new OffsetSprite(sprite, offsetX, offsetY)); + } + return this; + } + + public SpriteContainer setSprite(int index, ISprite sprite) { + if (sprite instanceof Sprite) { + offsetSprites.set(index, new OffsetSprite(sprite).setOffsetX(((Sprite) sprite).offsetX).setOffsetY(((Sprite) sprite).offsetY)); + } else { + offsetSprites.add(index, new OffsetSprite(sprite)); + } + return this; + } + + public SpriteContainer addSprite(OffsetSprite sprite) { + offsetSprites.add(sprite); + return this; + } + + public SpriteContainer addSprite(ISprite sprite, int offsetX, int offsetY) { + if (sprite instanceof Sprite) { + offsetSprites.add(new OffsetSprite(sprite).setOffsetX(((Sprite) sprite).offsetX + offsetX).setOffsetY(((Sprite) sprite).offsetY + offsetY)); + } else { + offsetSprites.add(new OffsetSprite(sprite, offsetX, offsetY)); + } + return this; + } + + public SpriteContainer addSprite(ISprite sprite) { + if (sprite instanceof Sprite) { + offsetSprites.add(new OffsetSprite(sprite).setOffsetX(((Sprite) sprite).offsetX).setOffsetY(((Sprite) sprite).offsetY)); + } else { + offsetSprites.add(new OffsetSprite(sprite)); + } + return this; + } +} diff --git a/src/main/java/techreborn/compat/buildcraft/BuildcraftBuildersCompat.java b/src/main/java/techreborn/compat/buildcraft/BuildcraftBuildersCompat.java index 06437acc9..5d882b9f1 100644 --- a/src/main/java/techreborn/compat/buildcraft/BuildcraftBuildersCompat.java +++ b/src/main/java/techreborn/compat/buildcraft/BuildcraftBuildersCompat.java @@ -32,6 +32,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import reborncore.common.util.RebornCraftingHelper; import reborncore.common.util.RecipeRemover; +import techreborn.Core; import techreborn.compat.CompatConfigs; import techreborn.compat.ICompatModule; import techreborn.init.ModItems; @@ -63,6 +64,8 @@ public class BuildcraftBuildersCompat implements ICompatModule { 'A', "circuitAdvanced", 'E', new ItemStack(ModItems.DIAMOND_DRILL)); } + //The recipebook still knows about the old recipe so crashes, this should update it to have it replaced by the new recipe + Core.proxy.rebuildRecipeBook(); } @Override diff --git a/src/main/java/techreborn/compat/crafttweaker/CTGeneric.java b/src/main/java/techreborn/compat/crafttweaker/CTGeneric.java index a1f1c56bd..5be3df16a 100644 --- a/src/main/java/techreborn/compat/crafttweaker/CTGeneric.java +++ b/src/main/java/techreborn/compat/crafttweaker/CTGeneric.java @@ -32,6 +32,7 @@ import net.minecraft.item.ItemStack; import reborncore.api.recipe.IBaseRecipeType; import reborncore.api.recipe.RecipeHandler; import reborncore.common.util.ItemUtils; +import stanhebben.zenscript.annotations.ZenMethod; import techreborn.api.recipe.BaseRecipe; import java.util.ArrayList; @@ -124,4 +125,31 @@ public class CTGeneric { } } + + public static class RemoveAll implements IAction { + List removedRecipes = new ArrayList(); + private final String name; + + public RemoveAll(String machineName) { + this.name = machineName; + } + + @Override + public void apply() { + for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(name)) { + removedRecipes.add((BaseRecipe) recipeType); + RecipeHandler.recipeList.remove(recipeType); + } + } + + @Override + public String describe() { + return "Removing all recipes from " + name; + } + } + + @ZenMethod + public static void removeAll(){ + CraftTweakerAPI.apply(new RemoveAll(getMachineName())); + } } diff --git a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java index 3735455c8..f5b3fe860 100644 --- a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java +++ b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java @@ -24,17 +24,28 @@ package techreborn.compat.jei; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.IJeiHelpers; -import mezz.jei.api.IModPlugin; -import mezz.jei.api.IModRegistry; +import mezz.jei.api.*; +import mezz.jei.api.gui.IAdvancedGuiHandler; import mezz.jei.api.recipe.IRecipeCategoryRegistration; import mezz.jei.api.recipe.VanillaRecipeCategoryUid; import mezz.jei.api.recipe.transfer.IRecipeTransferRegistry; +import mezz.jei.collect.ListMultiMap; import mezz.jei.config.Config; +import mezz.jei.gui.TooltipRenderer; +import mezz.jei.gui.recipes.RecipeClickableArea; +import mezz.jei.util.ErrorUtil; +import mezz.jei.util.Translator; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.text.translation.I18n; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.lwjgl.input.Mouse; import reborncore.api.recipe.RecipeHandler; import techreborn.Core; import techreborn.api.generator.EFluidGenerator; @@ -43,22 +54,10 @@ import techreborn.api.generator.GeneratorRecipeHelper; import techreborn.api.reactor.FusionReactorRecipe; import techreborn.api.reactor.FusionReactorRecipeHelper; import techreborn.api.recipe.ScrapboxRecipe; -import techreborn.api.recipe.machines.AlloySmelterRecipe; -import techreborn.api.recipe.machines.AssemblingMachineRecipe; -import techreborn.api.recipe.machines.BlastFurnaceRecipe; -import techreborn.api.recipe.machines.CentrifugeRecipe; -import techreborn.api.recipe.machines.ChemicalReactorRecipe; -import techreborn.api.recipe.machines.CompressorRecipe; -import techreborn.api.recipe.machines.DistillationTowerRecipe; -import techreborn.api.recipe.machines.ExtractorRecipe; -import techreborn.api.recipe.machines.GrinderRecipe; -import techreborn.api.recipe.machines.ImplosionCompressorRecipe; -import techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe; -import techreborn.api.recipe.machines.IndustrialGrinderRecipe; -import techreborn.api.recipe.machines.IndustrialSawmillRecipe; -import techreborn.api.recipe.machines.VacuumFreezerRecipe; +import techreborn.api.recipe.machines.*; import techreborn.blocks.cable.EnumCableType; import techreborn.client.gui.*; +import techreborn.client.gui.slot.GuiSlotConfiguration; import techreborn.compat.CompatManager; import techreborn.compat.jei.alloySmelter.AlloySmelterRecipeCategory; import techreborn.compat.jei.alloySmelter.AlloySmelterRecipeWrapper; @@ -105,13 +104,23 @@ import techreborn.init.ModItems; import techreborn.items.ItemParts; import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.awt.*; import java.util.ArrayList; import java.util.List; @SuppressWarnings("deprecation") @mezz.jei.api.JEIPlugin public class TechRebornJeiPlugin implements IModPlugin { - + + public static final ListMultiMap, RecipeClickableArea> recipeClickableAreas = new ListMultiMap<>(); + + static IRecipesGui recipesGui; + + static { + MinecraftForge.EVENT_BUS.register(TechRebornJeiPlugin.class); + } + private static void addDebugRecipes(final IModRegistry registry) { final ItemStack diamondBlock = new ItemStack(Blocks.DIAMOND_BLOCK); final ItemStack dirtBlock = new ItemStack(Blocks.DIRT); @@ -130,39 +139,38 @@ public class TechRebornJeiPlugin implements IModPlugin { } registry.addRecipes(debugRecipes); } - - @Override - public void registerCategories(IRecipeCategoryRegistration registry) { - final IJeiHelpers jeiHelpers = registry.getJeiHelpers(); - final IGuiHelper guiHelper = jeiHelpers.getGuiHelper(); + + @Override + public void registerCategories(IRecipeCategoryRegistration registry) { + final IJeiHelpers jeiHelpers = registry.getJeiHelpers(); + final IGuiHelper guiHelper = jeiHelpers.getGuiHelper(); registry.addRecipeCategories( - new AlloySmelterRecipeCategory(guiHelper), - new AssemblingMachineRecipeCategory(guiHelper), - new BlastFurnaceRecipeCategory(guiHelper), - new CentrifugeRecipeCategory(guiHelper), - new ChemicalReactorRecipeCategory(guiHelper), - new DistillationTowerRecipeCategory(guiHelper), - new FusionReactorRecipeCategory(guiHelper), - new GrinderRecipeCategory(guiHelper), - new ImplosionCompressorRecipeCategory(guiHelper), - new IndustrialGrinderRecipeCategory(guiHelper), - new IndustrialElectrolyzerRecipeCategory(guiHelper), - new IndustrialSawmillRecipeCategory(guiHelper), - new RollingMachineRecipeCategory(guiHelper), - new ScrapboxRecipeCategory(guiHelper), - new VacuumFreezerRecipeCategory(guiHelper)); - + new AlloySmelterRecipeCategory(guiHelper), + new AssemblingMachineRecipeCategory(guiHelper), + new BlastFurnaceRecipeCategory(guiHelper), + new CentrifugeRecipeCategory(guiHelper), + new ChemicalReactorRecipeCategory(guiHelper), + new DistillationTowerRecipeCategory(guiHelper), + new FusionReactorRecipeCategory(guiHelper), + new GrinderRecipeCategory(guiHelper), + new ImplosionCompressorRecipeCategory(guiHelper), + new IndustrialGrinderRecipeCategory(guiHelper), + new IndustrialElectrolyzerRecipeCategory(guiHelper), + new IndustrialSawmillRecipeCategory(guiHelper), + new RollingMachineRecipeCategory(guiHelper), + new ScrapboxRecipeCategory(guiHelper), + new VacuumFreezerRecipeCategory(guiHelper)); + for (final EFluidGenerator type : EFluidGenerator.values()) registry.addRecipeCategories(new FluidGeneratorRecipeCategory(type, guiHelper)); - + if (!IC2Duplicates.deduplicate()) { registry.addRecipeCategories( - new CompressorRecipeCategory(guiHelper), - new ExtractorRecipeCategory(guiHelper)); + new CompressorRecipeCategory(guiHelper), + new ExtractorRecipeCategory(guiHelper)); } - } - + } @Override public void register( @@ -170,7 +178,7 @@ public class TechRebornJeiPlugin implements IModPlugin { final IModRegistry registry) { final IJeiHelpers jeiHelpers = registry.getJeiHelpers(); - + jeiHelpers.getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(ModFluids.BLOCK_BERYLLIUM)); jeiHelpers.getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(ModFluids.BLOCK_CALCIUM)); jeiHelpers.getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(ModFluids.BLOCK_CALCIUM_CARBONATE)); @@ -246,16 +254,16 @@ public class TechRebornJeiPlugin implements IModPlugin { registry.handleRecipes(ScrapboxRecipe.class, recipe -> new ScrapboxRecipeWrapper(jeiHelpers, recipe), RecipeCategoryUids.SCRAPBOX); registry.handleRecipes(DistillationTowerRecipe.class, recipe -> new DistillationTowerRecipeWrapper(jeiHelpers, recipe), RecipeCategoryUids.DISTILLATION_TOWER); registry.addRecipeHandlers(new RollingMachineRecipeHandler()); - + if (!IC2Duplicates.deduplicate()) { registry.handleRecipes(CompressorRecipe.class, recipe -> new CompressorRecipeWrapper(jeiHelpers, recipe), RecipeCategoryUids.COMPRESSOR); registry.handleRecipes(ExtractorRecipe.class, recipe -> new ExtractorRecipeWrapper(jeiHelpers, recipe), RecipeCategoryUids.EXTRACTOR); } - - for (final EFluidGenerator type : EFluidGenerator.values()){ + + for (final EFluidGenerator type : EFluidGenerator.values()) { registry.handleRecipes(FluidGeneratorRecipe.class, recipe -> new FluidGeneratorRecipeWrapper(jeiHelpers, recipe), type.getRecipeID()); } - + registry.addRecipes(RecipeHandler.recipeList); registry.addRecipes(FusionReactorRecipeHelper.reactorRecipes, RecipeCategoryUids.FUSION_REACTOR); GeneratorRecipeHelper.fluidRecipes.forEach((type, list) -> registry.addRecipes(list.getRecipes(), type.getRecipeID())); @@ -283,34 +291,34 @@ public class TechRebornJeiPlugin implements IModPlugin { } //NEW ONES - registry.addRecipeClickArea(GuiCentrifuge.class, 150, 4, 20, 12, RecipeCategoryUids.CENTRIFUGE); - registry.addRecipeClickArea(GuiElectricFurnace.class, 150, 4, 20, 12, VanillaRecipeCategoryUid.SMELTING); - registry.addRecipeClickArea(GuiGenerator.class, 150, 4, 20, 12, VanillaRecipeCategoryUid.FUEL); - registry.addRecipeClickArea(GuiExtractor.class, 150, 4, 20, 12, RecipeCategoryUids.EXTRACTOR); - registry.addRecipeClickArea(GuiCompressor.class, 150, 4, 20, 12, RecipeCategoryUids.COMPRESSOR); - registry.addRecipeClickArea(GuiGrinder.class, 150, 4, 20, 12, RecipeCategoryUids.GRINDER); - registry.addRecipeClickArea(GuiVacuumFreezer.class, 150, 4, 20, 12, RecipeCategoryUids.VACUUM_FREEZER); - registry.addRecipeClickArea(GuiBlastFurnace.class, 150, 4, 20, 12, RecipeCategoryUids.BLAST_FURNACE); - registry.addRecipeClickArea(GuiChemicalReactor.class, 150, 4, 20, 12, RecipeCategoryUids.CHEMICAL_REACTOR); - registry.addRecipeClickArea(GuiImplosionCompressor.class, 150, 4, 20, 12, RecipeCategoryUids.IMPLOSION_COMPRESSOR); - registry.addRecipeClickArea(GuiIndustrialGrinder.class, 150, 4, 20, 12, RecipeCategoryUids.INDUSTRIAL_GRINDER); - registry.addRecipeClickArea(GuiIndustrialSawmill.class, 150, 4, 20, 15, RecipeCategoryUids.INDUSTRIAL_SAWMILL); - registry.addRecipeClickArea(GuiIndustrialElectrolyzer.class, 150, 4, 20, 12, RecipeCategoryUids.INDUSTRIAL_ELECTROLYZER); - registry.addRecipeClickArea(GuiSemifluidGenerator.class, 150, 4, 18, 18, EFluidGenerator.SEMIFLUID.getRecipeID()); - registry.addRecipeClickArea(GuiDieselGenerator.class, 150, 4, 18, 18, EFluidGenerator.DIESEL.getRecipeID()); - registry.addRecipeClickArea(GuiGasTurbine.class, 150, 4, 18, 18, EFluidGenerator.GAS.getRecipeID()); - registry.addRecipeClickArea(GuiThermalGenerator.class, 150, 4, 18, 18, EFluidGenerator.THERMAL.getRecipeID()); - registry.addRecipeClickArea(GuiAlloySmelter.class, 150, 4, 18, 18, RecipeCategoryUids.ALLOY_SMELTER); - registry.addRecipeClickArea(GuiPlasmaGenerator.class, 150, 4, 18, 18, EFluidGenerator.PLASMA.getRecipeID()); - registry.addRecipeClickArea(GuiDistillationTower.class, 150, 4, 18, 18, RecipeCategoryUids.DISTILLATION_TOWER); - + addRecipeClickArea(GuiCentrifuge.class, 150, 4, 20, 12, RecipeCategoryUids.CENTRIFUGE); + addRecipeClickArea(GuiElectricFurnace.class, 150, 4, 20, 12, VanillaRecipeCategoryUid.SMELTING); + addRecipeClickArea(GuiGenerator.class, 150, 4, 20, 12, VanillaRecipeCategoryUid.FUEL); + addRecipeClickArea(GuiExtractor.class, 150, 4, 20, 12, RecipeCategoryUids.EXTRACTOR); + addRecipeClickArea(GuiCompressor.class, 150, 4, 20, 12, RecipeCategoryUids.COMPRESSOR); + addRecipeClickArea(GuiGrinder.class, 150, 4, 20, 12, RecipeCategoryUids.GRINDER); + addRecipeClickArea(GuiVacuumFreezer.class, 150, 4, 20, 12, RecipeCategoryUids.VACUUM_FREEZER); + addRecipeClickArea(GuiBlastFurnace.class, 150, 4, 20, 12, RecipeCategoryUids.BLAST_FURNACE); + addRecipeClickArea(GuiChemicalReactor.class, 150, 4, 20, 12, RecipeCategoryUids.CHEMICAL_REACTOR); + addRecipeClickArea(GuiImplosionCompressor.class, 150, 4, 20, 12, RecipeCategoryUids.IMPLOSION_COMPRESSOR); + addRecipeClickArea(GuiIndustrialGrinder.class, 150, 4, 20, 12, RecipeCategoryUids.INDUSTRIAL_GRINDER); + addRecipeClickArea(GuiIndustrialSawmill.class, 150, 4, 20, 15, RecipeCategoryUids.INDUSTRIAL_SAWMILL); + addRecipeClickArea(GuiIndustrialElectrolyzer.class, 150, 4, 20, 12, RecipeCategoryUids.INDUSTRIAL_ELECTROLYZER); + addRecipeClickArea(GuiSemifluidGenerator.class, 150, 4, 18, 18, EFluidGenerator.SEMIFLUID.getRecipeID()); + addRecipeClickArea(GuiDieselGenerator.class, 150, 4, 18, 18, EFluidGenerator.DIESEL.getRecipeID()); + addRecipeClickArea(GuiGasTurbine.class, 150, 4, 18, 18, EFluidGenerator.GAS.getRecipeID()); + addRecipeClickArea(GuiThermalGenerator.class, 150, 4, 18, 18, EFluidGenerator.THERMAL.getRecipeID()); + addRecipeClickArea(GuiAlloySmelter.class, 150, 4, 18, 18, RecipeCategoryUids.ALLOY_SMELTER); + addRecipeClickArea(GuiPlasmaGenerator.class, 150, 4, 18, 18, EFluidGenerator.PLASMA.getRecipeID()); + addRecipeClickArea(GuiDistillationTower.class, 150, 4, 18, 18, RecipeCategoryUids.DISTILLATION_TOWER); + //OLD ONES - registry.addRecipeClickArea(GuiAlloyFurnace.class, 80, 35, 26, 20, RecipeCategoryUids.ALLOY_SMELTER, + addRecipeClickArea(GuiAlloyFurnace.class, 80, 35, 26, 20, RecipeCategoryUids.ALLOY_SMELTER, VanillaRecipeCategoryUid.FUEL); - registry.addRecipeClickArea(GuiAssemblingMachine.class, 85, 34, 24, 20, RecipeCategoryUids.ASSEMBLING_MACHINE); - registry.addRecipeClickArea(GuiFusionReactor.class, 111, 34, 27, 19, RecipeCategoryUids.FUSION_REACTOR); - registry.addRecipeClickArea(GuiRollingMachine.class, 89, 32, 26, 25, RecipeCategoryUids.ROLLING_MACHINE); - registry.addRecipeClickArea(GuiIronFurnace.class, 78, 36, 24, 16, VanillaRecipeCategoryUid.SMELTING, + addRecipeClickArea(GuiAssemblingMachine.class, 85, 34, 24, 20, RecipeCategoryUids.ASSEMBLING_MACHINE); + addRecipeClickArea(GuiFusionReactor.class, 111, 34, 27, 19, RecipeCategoryUids.FUSION_REACTOR); + addRecipeClickArea(GuiRollingMachine.class, 89, 32, 26, 25, RecipeCategoryUids.ROLLING_MACHINE); + addRecipeClickArea(GuiIronFurnace.class, 78, 36, 24, 16, VanillaRecipeCategoryUid.SMELTING, VanillaRecipeCategoryUid.FUEL); registry.addRecipeCatalyst(new ItemStack(ModBlocks.IRON_FURNACE), VanillaRecipeCategoryUid.SMELTING, VanillaRecipeCategoryUid.FUEL); @@ -379,13 +387,100 @@ public class TechRebornJeiPlugin implements IModPlugin { recipeTransferRegistry.addRecipeTransferHandler( new BuiltContainerTransferInfo("industrialsawmill", RecipeCategoryUids.INDUSTRIAL_SAWMILL, 36, 2, 0, 36)); recipeTransferRegistry.addRecipeTransferHandler( - new BuiltContainerTransferInfo("distillationtower", RecipeCategoryUids.DISTILLATION_TOWER, 36, 2, 0, 36)); - + new BuiltContainerTransferInfo("distillationtower", RecipeCategoryUids.DISTILLATION_TOWER, 36, 2, 0, 36)); if (CompatManager.isQuantumStorageLoaded) { registry.getJeiHelpers().getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(ModBlocks.QUANTUM_CHEST)); registry.getJeiHelpers().getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(ModBlocks.QUANTUM_TANK)); } + registry.addAdvancedGuiHandlers(new AdvancedGuiHandler()); + + } + + @Override + public void onRuntimeAvailable(IJeiRuntime jeiRuntime) { + recipesGui = jeiRuntime.getRecipesGui(); + } + + public static class AdvancedGuiHandler implements IAdvancedGuiHandler { + + @Override + public Class getGuiContainerClass() { + return GuiBase.class; + } + + @Nullable + @Override + public List getGuiExtraAreas(GuiBase guiContainer) { + return GuiSlotConfiguration.getExtraSpace(guiContainer); + } + + @Nullable + @Override + public Object getIngredientUnderMouse(GuiBase guiContainer, int mouseX, int mouseY) { + return null; + } + } + + //Taken from JEI so we can have a custom impliemntation of it + //This is done as I didnt see an easy way to disable the show recipes button when a certain condition is met + + + public void addRecipeClickArea(Class guiContainerClass, int xPos, int yPos, int width, int height, String... recipeCategoryUids) { + ErrorUtil.checkNotNull(guiContainerClass, "guiContainerClass"); + ErrorUtil.checkNotEmpty(recipeCategoryUids, "recipeCategoryUids"); + + RecipeClickableArea recipeClickableArea = new RecipeClickableArea(yPos, yPos + height, xPos, xPos + width, recipeCategoryUids); + recipeClickableAreas.put(guiContainerClass, recipeClickableArea); + } + + public static RecipeClickableArea getRecipeClickableArea(GuiContainer gui, int mouseX, int mouseY) { + for (RecipeClickableArea recipeClickableArea : recipeClickableAreas.toImmutable().get(gui.getClass())) { + if (recipeClickableArea.checkHover(mouseX, mouseY)) { + return recipeClickableArea; + } + } + return null; + } + + @SideOnly(Side.CLIENT) + @SubscribeEvent + public static void drawScreenEvent(GuiScreenEvent.DrawScreenEvent.Post event) { + if (GuiBase.showSlotConfig) { + return; + } + GuiScreen gui = event.getGui(); + if (gui instanceof GuiContainer) { + GuiContainer guiContainer = (GuiContainer) gui; + if (getRecipeClickableArea(guiContainer, event.getMouseX() - guiContainer.getGuiLeft(), event.getMouseY() - guiContainer.getGuiTop()) != null) { + TooltipRenderer.drawHoveringText(guiContainer.mc, Translator.translateToLocal("jei.tooltip.show.recipes"), event.getMouseX(), event.getMouseY()); + } + } + } + + @SideOnly(Side.CLIENT) + @SubscribeEvent + public static void handleMouseClick(GuiScreenEvent.MouseInputEvent.Pre event) { + if (GuiBase.showSlotConfig) { + return; + } + final int eventButton = Mouse.getEventButton(); + if (eventButton > -1) { + if (Mouse.getEventButtonState()) { + if (event.getGui() instanceof GuiContainer) { + int x = Mouse.getEventX() * event.getGui().width / event.getGui().mc.displayWidth; + int y = event.getGui().height - Mouse.getEventY() * event.getGui().height / event.getGui().mc.displayHeight - 1; + GuiContainer guiContainer = (GuiContainer) event.getGui(); + RecipeClickableArea clickableArea = getRecipeClickableArea(guiContainer, x - guiContainer.getGuiLeft(), y - guiContainer.getGuiTop()); + if (clickableArea != null) { + List recipeCategoryUids = clickableArea.getRecipeCategoryUids(); + recipesGui.showCategories(recipeCategoryUids); + event.setCanceled(true); + } + } + } + } + } } diff --git a/src/main/java/techreborn/compat/jei/generators/fluid/FluidGeneratorRecipeWrapper.java b/src/main/java/techreborn/compat/jei/generators/fluid/FluidGeneratorRecipeWrapper.java index fe8b43ac1..3b8f3fa3d 100644 --- a/src/main/java/techreborn/compat/jei/generators/fluid/FluidGeneratorRecipeWrapper.java +++ b/src/main/java/techreborn/compat/jei/generators/fluid/FluidGeneratorRecipeWrapper.java @@ -26,7 +26,8 @@ package techreborn.compat.jei.generators.fluid; import mezz.jei.api.IGuiHelper; import mezz.jei.api.IJeiHelpers; -import mezz.jei.api.gui.IDrawable; +import mezz.jei.api.gui.IDrawableAnimated; +import mezz.jei.api.gui.IDrawableStatic; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; @@ -38,27 +39,19 @@ import javax.annotation.Nonnull; public class FluidGeneratorRecipeWrapper implements IRecipeWrapper { - private static final int FLUID_GENERATOR_STORAGE = 100_000; - private final FluidGeneratorRecipe baseRecipe; - private final IDrawable energyProduced; - - public FluidGeneratorRecipeWrapper( - @Nonnull - IJeiHelpers jeiHelpers, - @Nonnull - FluidGeneratorRecipe recipe) { + private final IDrawableAnimated progress; + public FluidGeneratorRecipeWrapper(@Nonnull IJeiHelpers jeiHelpers, @Nonnull FluidGeneratorRecipe recipe) { this.baseRecipe = recipe; - IGuiHelper guiHelper = jeiHelpers.getGuiHelper(); - energyProduced = guiHelper.createDrawable(FluidGeneratorRecipeCategory.texture, 176, 3, - (int) (25 * ((recipe.getEnergyPerMb() * 1000.0) / FLUID_GENERATOR_STORAGE)), 14); + IDrawableStatic progressStatic = guiHelper.createDrawable(FluidGeneratorRecipeCategory.texture, 176, 3, 25, 14); + this.progress = guiHelper.createAnimatedDrawable(progressStatic, 200, IDrawableAnimated.StartDirection.LEFT, false); } @Override public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { - energyProduced.draw(minecraft, 73, 26); + progress.draw(minecraft, 73, 26); minecraft.fontRenderer .drawString(PowerSystem.getLocaliszedPowerFormattedNoSuffix(baseRecipe.getEnergyPerMb() * 1000) + " " + PowerSystem.getDisplayPower().abbreviation, 70, 13, 0x444444); diff --git a/src/main/java/techreborn/events/BlockBreakHandler.java b/src/main/java/techreborn/events/BlockBreakHandler.java index 818482e96..4adf2daa9 100644 --- a/src/main/java/techreborn/events/BlockBreakHandler.java +++ b/src/main/java/techreborn/events/BlockBreakHandler.java @@ -24,9 +24,6 @@ package techreborn.events; -import java.util.List; -import java.util.Random; - import net.minecraft.block.state.IBlockState; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -45,6 +42,9 @@ import techreborn.items.ItemGems; import techreborn.lib.ModInfo; import techreborn.utils.OreDictUtils; +import java.util.List; +import java.util.Random; + @RebornRegistry(modID = ModInfo.MOD_ID) public class BlockBreakHandler { @@ -76,7 +76,7 @@ public class BlockBreakHandler { drops.add(peridot.getDrops(event.getFortuneLevel(), random)); } else if (OreDictUtils.isOre(state, "oreSodalite")) { - OreDrop aluminium = new OreDrop(ItemDusts.getDustByName("aluminium"), aluminiumDropChance, 1); + OreDrop aluminium = new OreDrop(ItemDusts.getDustByName("aluminum"), aluminiumDropChance, 1); drops.add(aluminium.getDrops(event.getFortuneLevel(), random)); } else if (OreDictUtils.isOre(state, "oreCinnabar")) { @@ -92,10 +92,10 @@ public class BlockBreakHandler { @SubscribeEvent public void getBreakSpeedEvent(PlayerEvent.BreakSpeed event){ - if(event.getEntityPlayer().getHeldItem(EnumHand.MAIN_HAND).getItem() == ModItems.ADVANCED_CHAINSAW){ + if(event.getEntityPlayer().getHeldItem(EnumHand.MAIN_HAND).getItem() == ModItems.ADVANCED_CHAINSAW && event.getOriginalSpeed() > 1.0f){ BlockPos pos = event.getPos(); World worldIn = event.getEntityPlayer().world; - float speed = 2F; + float speed = 20F; int blocks = 0; for (int i = 1; i < 10; i++) { BlockPos nextPos = pos.up(i); @@ -104,7 +104,7 @@ public class BlockBreakHandler { blocks ++; } } - event.setNewSpeed(speed * blocks); + event.setNewSpeed(speed / blocks); } } } diff --git a/src/main/java/techreborn/init/ModBlocks.java b/src/main/java/techreborn/init/ModBlocks.java index 83c228860..00c81bac1 100644 --- a/src/main/java/techreborn/init/ModBlocks.java +++ b/src/main/java/techreborn/init/ModBlocks.java @@ -32,7 +32,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.oredict.OreDictionary; import reborncore.RebornRegistry; -import reborncore.common.tile.TileMachineBase; +import reborncore.common.tile.TileLegacyMachineBase; import reborncore.common.util.OreUtil; import reborncore.common.util.StringUtils; import techreborn.Core; @@ -350,7 +350,7 @@ public class ModBlocks { registerBlock(WIND_MILL, "wind_mill"); GameRegistry.registerTileEntity(TileWindMill.class, "TileWindMillTR"); - GameRegistry.registerTileEntity(TileMachineBase.class, "TileMachineBaseTR"); + GameRegistry.registerTileEntity(TileLegacyMachineBase.class, "TileMachineBaseTR"); RUBBER_LOG = new BlockRubberLog(); registerBlock(RUBBER_LOG, "rubber_log"); diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index a9cfef2ab..fc9ca27a0 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -219,6 +219,16 @@ public class ModRecipes { new ItemStack(Items.ENDER_PEARL), ItemDusts.getDustByName("ender_pearl", 2), 200, 22)); + + RecipeHandler.addRecipe(new GrinderRecipe( + new ItemStack(Blocks.LAPIS_ORE), + new ItemStack(Items.DYE, 10, 4), + 170, 19)); + + RecipeHandler.addRecipe(new GrinderRecipe( + new ItemStack(Blocks.OBSIDIAN), + ItemDusts.getDustByName("obsidian", 4), + 170, 19)); for (String oreDictionaryName : OreDictionary.getOreNames()) { if (isDictPrefixed(oreDictionaryName, "ore", "gem", "ingot")) { diff --git a/src/main/java/techreborn/init/recipes/CraftingTableRecipes.java b/src/main/java/techreborn/init/recipes/CraftingTableRecipes.java index 0dd861884..003dd519a 100644 --- a/src/main/java/techreborn/init/recipes/CraftingTableRecipes.java +++ b/src/main/java/techreborn/init/recipes/CraftingTableRecipes.java @@ -40,11 +40,7 @@ import techreborn.config.ConfigTechReborn; import techreborn.init.IC2Duplicates; import techreborn.init.ModBlocks; import techreborn.init.ModItems; -import techreborn.items.DynamicCell; -import techreborn.items.ItemDustsSmall; -import techreborn.items.ItemNuggets; -import techreborn.items.ItemParts; -import techreborn.items.ItemUpgrades; +import techreborn.items.*; /** * Created by Prospector @@ -90,8 +86,6 @@ public class CraftingTableRecipes extends RecipeMethods { } //Upgrades - registerShaped(ItemUpgrades.getUpgradeByName("injection"), "CHC", "PSP", "PPP", 'S', "chestWood", 'C', "circuitBasic", 'P', "plateIron", 'H', getStack(Blocks.HOPPER)); - registerShaped(ItemUpgrades.getUpgradeByName("ejection"), "CSC", "PHP", "PPP", 'S', "chestWood", 'C', "circuitBasic", 'P', "plateIron", 'H', getStack(Blocks.HOPPER)); registerShaped(ItemUpgrades.getUpgradeByName("energy_storage"), "PPP", "WBW", "PCP", 'P', "plankWood", 'W', getStack(IC2Duplicates.CABLE_ICOPPER), 'C', "circuitBasic", 'B', "reBattery"); registerShaped(ItemUpgrades.getUpgradeByName("overclock"), "TTT", "WCW", 'T', getMaterial("coolant_simple", Type.PART), 'W', getStack(IC2Duplicates.CABLE_ICOPPER), 'C', "circuitBasic"); registerShaped(ItemUpgrades.getUpgradeByName("overclock", 2), " T ", "WCW", 'T', getMaterial("helium_coolant_triple", Type.PART), 'W', getStack(IC2Duplicates.CABLE_ICOPPER), 'C', "circuitBasic"); diff --git a/src/main/java/techreborn/items/DynamicCell.java b/src/main/java/techreborn/items/DynamicCell.java index 24f09aacc..f2dde863e 100644 --- a/src/main/java/techreborn/items/DynamicCell.java +++ b/src/main/java/techreborn/items/DynamicCell.java @@ -40,13 +40,10 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.translation.I18n; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidUtil; -import net.minecraftforge.fluids.IFluidBlock; +import net.minecraftforge.fluids.*; import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; import org.apache.commons.lang3.Validate; @@ -161,12 +158,13 @@ public class DynamicCell extends Item { } } + @SuppressWarnings("deprecation") @Override public String getItemStackDisplayName(ItemStack stack) { FluidStack fluidStack = getFluidHandler(stack).getFluid(); if (fluidStack == null) return super.getItemStackDisplayName(stack); - return fluidStack.getLocalizedName() + " Cell"; + return I18n.translateToLocal("item.techreborn.cell.fluid.name").replaceAll("\\$fluid\\$", fluidStack.getLocalizedName()); } @Override diff --git a/src/main/java/techreborn/items/ItemUpgrades.java b/src/main/java/techreborn/items/ItemUpgrades.java index a3aa3ab21..3a1e56e84 100644 --- a/src/main/java/techreborn/items/ItemUpgrades.java +++ b/src/main/java/techreborn/items/ItemUpgrades.java @@ -29,7 +29,6 @@ import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -37,16 +36,10 @@ import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import net.minecraftforge.items.CapabilityItemHandler; -import net.minecraftforge.items.IItemHandler; -import reborncore.api.recipe.IRecipeCrafterProvider; import reborncore.api.tile.IUpgrade; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.recipes.IUpgradeHandler; -import reborncore.common.recipes.RecipeCrafter; -import reborncore.common.tile.IMachineSlotProvider; import reborncore.common.tile.TileLegacyMachineBase; -import reborncore.common.util.InventoryHelper; import reborncore.common.util.ItemNBTHelper; import techreborn.Core; import techreborn.client.TechRebornCreativeTabMisc; @@ -62,7 +55,7 @@ import java.util.List; public class ItemUpgrades extends ItemTR implements IUpgrade { - public static final String[] types = new String[] { "overclock", "transformer", "energy_storage", "range", "ejection", "injection" }; + public static final String[] types = new String[] { "overclock", "transformer", "energy_storage", "range" }; public ItemUpgrades() { setUnlocalizedName("techreborn.upgrade"); @@ -131,68 +124,6 @@ public class ItemUpgrades extends ItemTR implements IUpgrade { handler.addSpeedMulti(0.25); handler.addPowerMulti(0.5); - } else if (stack.getItemDamage() == 4) { - EnumFacing dir = getFacing(stack); - TileEntity tileEntity = machineBase.getWorld().getTileEntity(machineBase.getPos().offset(dir)); - if (tileEntity instanceof IInventory) { - if (machineBase instanceof IRecipeCrafterProvider) { - RecipeCrafter crafter = ((IRecipeCrafterProvider) machineBase).getRecipeCrafter(); - for (Integer outSlot : crafter.outputSlots) { - ItemStack outputStack = crafter.inventory.getStackInSlot(outSlot); - if (!outputStack.isEmpty()) { - int amount = InventoryHelper.testInventoryInsertion((IInventory) tileEntity, outputStack, dir); - if (amount > 0) { - InventoryHelper.insertItemIntoInventory((IInventory) tileEntity, outputStack); - crafter.inventory.decrStackSize(outSlot, amount); - } - } - } - } else if (machineBase instanceof IMachineSlotProvider) { - IMachineSlotProvider slotProvider = (IMachineSlotProvider) machineBase; - for (Integer outSlot : slotProvider.getOuputSlots()) { - ItemStack outputStack = slotProvider.getMachineInv().getStackInSlot(outSlot); - if (!outputStack.isEmpty()) { - int amount = InventoryHelper.testInventoryInsertion((IInventory) tileEntity, outputStack, dir); - if (amount > 0) { - InventoryHelper.insertItemIntoInventory((IInventory) tileEntity, outputStack); - slotProvider.getMachineInv().decrStackSize(outSlot, amount); - } - } - } - } else { - IInventory inventory = machineBase; - for (int outSlot = 0; outSlot < inventory.getSizeInventory(); outSlot++) { - ItemStack outputStack = inventory.getStackInSlot(outSlot); - if (!outputStack.isEmpty()) { - int amount = InventoryHelper.testInventoryInsertion((IInventory) tileEntity, outputStack, dir); - if (amount > 0) { - InventoryHelper.insertItemIntoInventory((IInventory) tileEntity, outputStack); - inventory.decrStackSize(outSlot, amount); - } - } - } - } - } - } else if (stack.getItemDamage() == 5) { - if (machineBase.getWorld().getTotalWorldTime() % 10 != 0) { - return; - } - EnumFacing dir = getFacing(stack); - TileEntity tileEntity = machineBase.getWorld().getTileEntity(machineBase.getPos().offset(dir)); - if (tileEntity != null && tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, dir.getOpposite())) { - IItemHandler itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, dir.getOpposite()); - for (int i = 0; i < itemHandler.getSlots(); i++) { - ItemStack extractedStack = itemHandler.extractItem(i, 1, true); - int amount = InventoryHelper.testInventoryInsertion(machineBase, extractedStack, null); - if (amount > 0) { - extractedStack = itemHandler.extractItem(i, 1, false); - extractedStack.setCount(1); - InventoryHelper.insertItemIntoInventory(machineBase, extractedStack); - } - - } - } - } if (machineBase instanceof TilePowerAcceptor) { if (stack.getItemDamage() == 2) { diff --git a/src/main/java/techreborn/items/tools/ItemAdvancedChainsaw.java b/src/main/java/techreborn/items/tools/ItemAdvancedChainsaw.java index afa7b4aab..d8ce82866 100644 --- a/src/main/java/techreborn/items/tools/ItemAdvancedChainsaw.java +++ b/src/main/java/techreborn/items/tools/ItemAdvancedChainsaw.java @@ -50,10 +50,10 @@ public class ItemAdvancedChainsaw extends ItemChainsaw { public ItemAdvancedChainsaw() { super(ToolMaterial.DIAMOND, "techreborn.advancedChainsaw", ConfigTechReborn.AdvancedChainsawCharge, - 4.0F); + 1.0F); this.cost = 250; } - + @SideOnly(Side.CLIENT) @Override public void getSubItems(CreativeTabs par2CreativeTabs, NonNullList itemList) { @@ -81,11 +81,6 @@ public class ItemAdvancedChainsaw extends ItemChainsaw { return super.onBlockDestroyed(stack, worldIn, blockIn, pos, entityLiving); } - @Override - public float getDestroySpeed(ItemStack stack, IBlockState state) { - return super.getDestroySpeed(stack, state); - } - @Override public boolean canHarvestBlock(IBlockState blockIn) { return Items.DIAMOND_AXE.canHarvestBlock(blockIn); diff --git a/src/main/java/techreborn/items/tools/ItemChainsaw.java b/src/main/java/techreborn/items/tools/ItemChainsaw.java index 004be5ede..65348eef0 100644 --- a/src/main/java/techreborn/items/tools/ItemChainsaw.java +++ b/src/main/java/techreborn/items/tools/ItemChainsaw.java @@ -53,6 +53,7 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, IEnergyInt public int maxCharge = 1; public int cost = 250; + public float poweredSpeed = 20F; public float unpoweredSpeed = 2.0F; public double transferLimit = 100; public boolean isBreaking = false; @@ -60,12 +61,11 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, IEnergyInt public ItemChainsaw(ToolMaterial material, String unlocalizedName, int energyCapacity, float unpoweredSpeed) { super(material); - efficiency = 20F; setCreativeTab(TechRebornCreativeTab.instance); setMaxStackSize(1); setUnlocalizedName(unlocalizedName); this.maxCharge = energyCapacity; - this.unpoweredSpeed = unpoweredSpeed; + this.efficiency = unpoweredSpeed; this.addPropertyOverride(new ResourceLocation("techreborn:animated"), new IItemPropertyGetter() { @Override @@ -82,6 +82,16 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, IEnergyInt } }); } + + @Override + public float getDestroySpeed(ItemStack stack, IBlockState state) { + if (PoweredItem.canUseEnergy(cost, stack) && state.getBlock().isToolEffective("axe", state)) { + return this.poweredSpeed; + } + else { + return super.getDestroySpeed(stack, state); + } + } @Override public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos, diff --git a/src/main/java/techreborn/items/tools/ItemDiamondChainsaw.java b/src/main/java/techreborn/items/tools/ItemDiamondChainsaw.java index 15fc5b059..b0656d0f1 100644 --- a/src/main/java/techreborn/items/tools/ItemDiamondChainsaw.java +++ b/src/main/java/techreborn/items/tools/ItemDiamondChainsaw.java @@ -39,7 +39,7 @@ public class ItemDiamondChainsaw extends ItemChainsaw { public ItemDiamondChainsaw() { super(ToolMaterial.DIAMOND, "techreborn.diamondChainsaw", ConfigTechReborn.DiamondChainsawCharge, - 2.5F); + 1.0F); this.cost = 250; } diff --git a/src/main/java/techreborn/items/tools/ItemSteelChainsaw.java b/src/main/java/techreborn/items/tools/ItemSteelChainsaw.java index 5d47b4dab..4a39ad7c1 100644 --- a/src/main/java/techreborn/items/tools/ItemSteelChainsaw.java +++ b/src/main/java/techreborn/items/tools/ItemSteelChainsaw.java @@ -39,7 +39,7 @@ public class ItemSteelChainsaw extends ItemChainsaw { public ItemSteelChainsaw() { super(ToolMaterial.IRON, "techreborn.ironChainsaw", ConfigTechReborn.IronChainsawCharge, - 2.0F); + 0.5F); this.cost = 50; } diff --git a/src/main/java/techreborn/proxies/ClientProxy.java b/src/main/java/techreborn/proxies/ClientProxy.java index a701b2a64..653f6e59e 100644 --- a/src/main/java/techreborn/proxies/ClientProxy.java +++ b/src/main/java/techreborn/proxies/ClientProxy.java @@ -28,6 +28,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.statemap.StateMap; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.util.RecipeBookClient; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.MinecraftForge; @@ -43,6 +44,7 @@ import reborncore.client.multiblock.MultiblockRenderEvent; import techreborn.blocks.BlockRubberLeaves; import techreborn.client.*; import techreborn.client.gui.GuiBase; +import techreborn.client.gui.slot.GuiSlotConfiguration; import techreborn.client.keybindings.KeyBindings; import techreborn.client.render.ModelDynamicCell; import techreborn.client.render.entitys.RenderNukePrimed; @@ -74,6 +76,7 @@ public class ClientProxy extends CommonProxy { super.init(event); MinecraftForge.EVENT_BUS.register(new StackToolTipEvent()); multiblockRenderEvent = new MultiblockRenderEvent(); + MinecraftForge.EVENT_BUS.register(GuiSlotConfiguration.class); MinecraftForge.EVENT_BUS.register(multiblockRenderEvent); // TODO FIX ME ClientRegistry.registerKeyBinding(KeyBindings.config); @@ -107,4 +110,15 @@ public class ClientProxy extends CommonProxy { return new RenderNukePrimed(manager); } } + + @Override + public boolean fancyGraphics() { + return Minecraft.getMinecraft().gameSettings.fancyGraphics; + } + + @Override + public void rebuildRecipeBook() { + super.rebuildRecipeBook(); + RecipeBookClient.rebuildTable(); + } } diff --git a/src/main/java/techreborn/proxies/CommonProxy.java b/src/main/java/techreborn/proxies/CommonProxy.java index 6fe7ee856..38948ecc4 100644 --- a/src/main/java/techreborn/proxies/CommonProxy.java +++ b/src/main/java/techreborn/proxies/CommonProxy.java @@ -64,4 +64,12 @@ public class CommonProxy implements ICompatModule { return ""; } + public boolean fancyGraphics(){ + return true; + } + + public void rebuildRecipeBook(){ + + } + } diff --git a/src/main/java/techreborn/tiles/TileAssemblingMachine.java b/src/main/java/techreborn/tiles/TileAssemblingMachine.java index c516e82c7..11368d12b 100644 --- a/src/main/java/techreborn/tiles/TileAssemblingMachine.java +++ b/src/main/java/techreborn/tiles/TileAssemblingMachine.java @@ -25,12 +25,11 @@ package techreborn.tiles; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import reborncore.api.IToolDrop; import reborncore.api.recipe.IRecipeCrafterProvider; import reborncore.api.tile.IInventoryProvider; -import reborncore.api.IToolDrop; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.registration.RebornRegistry; @@ -45,7 +44,7 @@ import techreborn.lib.ModInfo; @RebornRegistry(modID = ModInfo.MOD_ID) public class TileAssemblingMachine extends TilePowerAcceptor - implements IToolDrop, ISidedInventory, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider { + implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider { @ConfigRegistry(config = "machines", category = "assembling_machine", key = "AssemblingMachineMaxInput", comment = "Assembling Machine Max Input (Value in EU)") public static int maxInput = 128; @@ -136,20 +135,6 @@ public class TileAssemblingMachine extends TilePowerAcceptor return this.crafter; } - @Override - public int[] getSlotsForFace(final EnumFacing side) { - return new int[] { 0, 1, 2 }; - } - - @Override - public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) { - return index == 0 || index == 1; - } - - @Override - public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) { - return index == 2; - } @SuppressWarnings("deprecation") @Override diff --git a/src/main/java/techreborn/tiles/TileAutoCraftingTable.java b/src/main/java/techreborn/tiles/TileAutoCraftingTable.java index 21590197a..9b82e7ca1 100644 --- a/src/main/java/techreborn/tiles/TileAutoCraftingTable.java +++ b/src/main/java/techreborn/tiles/TileAutoCraftingTable.java @@ -27,7 +27,6 @@ package techreborn.tiles; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; @@ -55,7 +54,7 @@ import java.util.List; /** * Created by modmuss50 on 20/06/2017. */ -public class TileAutoCraftingTable extends TilePowerAcceptor implements IContainerProvider, IInventoryProvider, ISidedInventory { +public class TileAutoCraftingTable extends TilePowerAcceptor implements IContainerProvider, IInventoryProvider { ResourceLocation currentRecipe; @@ -89,9 +88,11 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain public IRecipe getIRecipe() { if (customRecipe) { InventoryCrafting crafting = getCraftingInventory(); - for (IRecipe testRecipe : CraftingManager.REGISTRY) { - if (testRecipe.matches(crafting, world)) { - return testRecipe; + if(!crafting.isEmpty()){ + for (IRecipe testRecipe : CraftingManager.REGISTRY) { + if (testRecipe.matches(crafting, world)) { + return testRecipe; + } } } } @@ -439,25 +440,9 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain return super.isItemValidForSlot(index, stack); } + //This machine doesnt have a facing @Override - public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) { - if (index == 9) { - return false; - } - int bestSlot = findBestSlotForStack(getIRecipe(), itemStackIn); - if (bestSlot != -1) { - return index == bestSlot; - } - return false; - } - - @Override - public int[] getSlotsForFace(EnumFacing side) { - return new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - } - - @Override - public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) { - return index == 9 || index == 10; + public EnumFacing getFacingEnum() { + return EnumFacing.NORTH; } } diff --git a/src/main/java/techreborn/tiles/TileChargeOMat.java b/src/main/java/techreborn/tiles/TileChargeOMat.java index bd021a30b..6df135545 100644 --- a/src/main/java/techreborn/tiles/TileChargeOMat.java +++ b/src/main/java/techreborn/tiles/TileChargeOMat.java @@ -25,12 +25,15 @@ package techreborn.tiles; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; -import reborncore.api.power.IEnergyInterfaceItem; -import reborncore.api.tile.IInventoryProvider; +import net.minecraftforge.energy.CapabilityEnergy; +import net.minecraftforge.energy.IEnergyStorage; import reborncore.api.IToolDrop; +import reborncore.api.power.IEnergyItemInfo; +import reborncore.api.tile.IInventoryProvider; +import reborncore.common.RebornCoreConfig; +import reborncore.common.powerSystem.PoweredItem; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.registration.RebornRegistry; import reborncore.common.registration.impl.ConfigRegistry; @@ -38,12 +41,14 @@ import reborncore.common.util.Inventory; import techreborn.client.container.IContainerProvider; import techreborn.client.container.builder.BuiltContainer; import techreborn.client.container.builder.ContainerBuilder; +import techreborn.compat.CompatManager; import techreborn.init.ModBlocks; import techreborn.lib.ModInfo; +import techreborn.utils.IC2ItemCharger; @RebornRegistry(modID = ModInfo.MOD_ID) public class TileChargeOMat extends TilePowerAcceptor - implements IToolDrop, IInventoryProvider, ISidedInventory, IContainerProvider { + implements IToolDrop, IInventoryProvider, IContainerProvider { @ConfigRegistry(config = "machines", category = "charge_bench", key = "ChargeBenchMaxInput", comment = "Charge Bench Max Input (Value in EU)") public static int maxInput = 512; @@ -66,12 +71,22 @@ public class TileChargeOMat extends TilePowerAcceptor if (this.inventory.getStackInSlot(i) != ItemStack.EMPTY) { if (this.getEnergy() > 0) { final ItemStack stack = this.inventory.getStackInSlot(i); - if (stack.getItem() instanceof IEnergyInterfaceItem) { - final IEnergyInterfaceItem interfaceItem = (IEnergyInterfaceItem) stack.getItem(); - final double trans = Math.min(interfaceItem.getMaxPower(stack) - interfaceItem.getEnergy(stack), - Math.min(interfaceItem.getMaxTransfer(stack), this.getEnergy())); - interfaceItem.setEnergy(trans + interfaceItem.getEnergy(stack), stack); - this.useEnergy(trans); + if (stack.getItem() instanceof IEnergyItemInfo) { + IEnergyItemInfo item = (IEnergyItemInfo) inventory.getStackInSlot(0).getItem(); + if (PoweredItem.getEnergy(stack) != PoweredItem.getMaxPower(stack)) { + if (canUseEnergy(item.getMaxTransfer(stack))) { + useEnergy(item.getMaxTransfer(stack)); + PoweredItem.setEnergy(PoweredItem.getEnergy(stack) + item.getMaxTransfer(stack), stack); + } + } + } + if(CompatManager.isIC2Loaded){ + IC2ItemCharger.chargeIc2Item(this, stack); + } + if(stack.hasCapability(CapabilityEnergy.ENERGY, null)){ + IEnergyStorage energyStorage = stack.getCapability(CapabilityEnergy.ENERGY, null); + int max = Math.min(maxInput, getEnergyStored(null)); + useEnergy(energyStorage.receiveEnergy(max, false) / RebornCoreConfig.euPerFU); } } } @@ -87,28 +102,6 @@ public class TileChargeOMat extends TilePowerAcceptor return false; } - // ISidedInventory - @Override - public int[] getSlotsForFace(final EnumFacing side) { - return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 }; - } - - @Override - public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - return this.isItemValidForSlot(slotIndex, itemStack); - } - - @Override - public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - // if (itemStack.getItem() instanceof IElectricItem) { - // double CurrentCharge = ElectricItem.manager.getCharge(itemStack); - // double MaxCharge = ((IElectricItem) - // itemStack.getItem()).getMaxCharge(itemStack); - // if (CurrentCharge == MaxCharge) - // return true; - // } - return false; - } @Override public double getBaseMaxPower() { diff --git a/src/main/java/techreborn/tiles/TileChemicalReactor.java b/src/main/java/techreborn/tiles/TileChemicalReactor.java index 7009b6c75..449e41add 100644 --- a/src/main/java/techreborn/tiles/TileChemicalReactor.java +++ b/src/main/java/techreborn/tiles/TileChemicalReactor.java @@ -25,13 +25,12 @@ package techreborn.tiles; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import reborncore.api.IToolDrop; import reborncore.api.recipe.IRecipeCrafterProvider; import reborncore.api.tile.IInventoryProvider; -import reborncore.api.IToolDrop; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.registration.impl.ConfigRegistry; @@ -43,7 +42,7 @@ import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.ModBlocks; public class TileChemicalReactor extends TilePowerAcceptor - implements IToolDrop, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider, IContainerProvider { + implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider { @ConfigRegistry(config = "machines", category = "chemical_reactor", key = "ChemicalReactorMaxInput", comment = "Chemical Reactor Max Input (Value in EU)") public static int maxInput = 128; @@ -97,33 +96,6 @@ public class TileChemicalReactor extends TilePowerAcceptor return tagCompound; } - // ISidedInventory - @Override - public int[] getSlotsForFace(final EnumFacing side) { - return side == EnumFacing.DOWN ? new int[] { 0, 1, 2 } : new int[] { 0, 1, 2 }; - } - - @Override - public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - if (slotIndex == 2) - return false; - return this.isItemValidForSlot(slotIndex, itemStack); - } - - @Override - public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - return slotIndex == 2; - } - - // @Override - // public void addWailaInfo(List info) - // { - // super.addWailaInfo(info); - // info.add("Power Stored " + energy.getEnergyStored() +" EU"); - // if(crafter.currentRecipe !=null){ - // info.add("Power Usage " + crafter.currentRecipe.euPerTick() + " EU/t"); - // } - // } public int getProgressScaled(final int scale) { if (this.crafter.currentTickTime != 0 && this.crafter.currentNeededTicks > 0) { diff --git a/src/main/java/techreborn/tiles/TileChunkLoader.java b/src/main/java/techreborn/tiles/TileChunkLoader.java index bc24df016..d84fb31e0 100644 --- a/src/main/java/techreborn/tiles/TileChunkLoader.java +++ b/src/main/java/techreborn/tiles/TileChunkLoader.java @@ -27,8 +27,8 @@ package techreborn.tiles; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; -import reborncore.api.tile.IInventoryProvider; import reborncore.api.IToolDrop; +import reborncore.api.tile.IInventoryProvider; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.registration.RebornRegistry; import reborncore.common.registration.impl.ConfigRegistry; diff --git a/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java b/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java index 592a3be61..beccef5d9 100644 --- a/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java +++ b/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java @@ -29,9 +29,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import reborncore.api.IListInfoProvider; +import reborncore.api.IToolDrop; import reborncore.api.recipe.IRecipeCrafterProvider; import reborncore.api.tile.IInventoryProvider; -import reborncore.api.IToolDrop; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.registration.RebornRegistry; @@ -42,7 +42,6 @@ import techreborn.client.container.IContainerProvider; import techreborn.client.container.builder.BuiltContainer; import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.ModBlocks; -import techreborn.items.DynamicCell; import techreborn.lib.ModInfo; import java.util.List; @@ -105,23 +104,6 @@ public class TileIndustrialCentrifuge extends TilePowerAcceptor return tagCompound; } - // ISidedInventory - - @Override - public int[] getSlotsForFace(final EnumFacing side) { - return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 }; - } - - @Override - public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) { - return itemStackIn.isItemEqual(DynamicCell.getEmptyCell(1).copy()) ? index == 1 : index == 0; - } - - @Override - public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - return slotIndex >= 2 && slotIndex <= 5; - } - @Override public void addInfo(final List info, final boolean isRealTile) { super.addInfo(info, isRealTile); diff --git a/src/main/java/techreborn/tiles/TileIndustrialElectrolyzer.java b/src/main/java/techreborn/tiles/TileIndustrialElectrolyzer.java index ad2bf58f8..ed13d517f 100644 --- a/src/main/java/techreborn/tiles/TileIndustrialElectrolyzer.java +++ b/src/main/java/techreborn/tiles/TileIndustrialElectrolyzer.java @@ -25,13 +25,12 @@ package techreborn.tiles; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import reborncore.api.IToolDrop; import reborncore.api.recipe.IRecipeCrafterProvider; import reborncore.api.tile.IInventoryProvider; -import reborncore.api.IToolDrop; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.registration.RebornRegistry; @@ -48,7 +47,7 @@ import techreborn.lib.ModInfo; @RebornRegistry(modID = ModInfo.MOD_ID) public class TileIndustrialElectrolyzer extends TilePowerAcceptor - implements IToolDrop, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider, IContainerProvider { + implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider { @ConfigRegistry(config = "machines", category = "industrial_electrolyzer", key = "IndustrialElectrolyzerMaxInput", comment = "Industrial Electrolyzer Max Input (Value in EU)") public static int maxInput = 128; @@ -115,26 +114,6 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor // } // } - // ISidedInventory - @Override - public int[] getSlotsForFace(final EnumFacing side) { - return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 }; - } - - @Override - public boolean canInsertItem(final int slotIndex, final ItemStack stack, final EnumFacing side) { - if (slotIndex > 1) - return false; - if (slotIndex == 1) - return ItemUtils.isItemEqual(stack, DynamicCell.getEmptyCell(1), true, true); - return !ItemUtils.isItemEqual(stack, DynamicCell.getEmptyCell(1), true, true); - } - - @Override - public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5; - } - public int getProgressScaled(final int scale) { if (this.crafter.currentTickTime != 0) { return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks; diff --git a/src/main/java/techreborn/tiles/TileIronAlloyFurnace.java b/src/main/java/techreborn/tiles/TileIronAlloyFurnace.java index 777ea73be..77ed6c718 100644 --- a/src/main/java/techreborn/tiles/TileIronAlloyFurnace.java +++ b/src/main/java/techreborn/tiles/TileIronAlloyFurnace.java @@ -312,20 +312,6 @@ public class TileIronAlloyFurnace extends TileLegacyMachineBase return this.inventory; } - @Override - public int[] getSlotsForFace(final EnumFacing side) { - return new int[] { 0, 1, 2 }; - } - - @Override - public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) { - return index == 0 || index == 1; - } - - @Override - public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) { - return index == 2; - } public int getBurnTime() { return this.burnTime; diff --git a/src/main/java/techreborn/tiles/TileIronFurnace.java b/src/main/java/techreborn/tiles/TileIronFurnace.java index 2b9d3be14..721c57268 100644 --- a/src/main/java/techreborn/tiles/TileIronFurnace.java +++ b/src/main/java/techreborn/tiles/TileIronFurnace.java @@ -26,11 +26,9 @@ package techreborn.tiles; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.tileentity.TileEntityFurnace; -import net.minecraft.util.EnumFacing; import reborncore.api.tile.IInventoryProvider; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.tile.TileLegacyMachineBase; @@ -41,7 +39,7 @@ import techreborn.client.container.builder.BuiltContainer; import techreborn.client.container.builder.ContainerBuilder; public class TileIronFurnace extends TileLegacyMachineBase - implements IInventoryProvider, ISidedInventory, IContainerProvider { + implements IInventoryProvider, IContainerProvider { private static final int[] SLOTS_TOP = new int[] { 0, 2 }; private static final int[] SLOTS_BOTTOM = new int[] { 1 }; @@ -174,11 +172,6 @@ public class TileIronFurnace extends TileLegacyMachineBase return this.inventory; } - @Override - public int[] getSlotsForFace(final EnumFacing side) { - return side == EnumFacing.DOWN ? TileIronFurnace.SLOTS_BOTTOM : side == EnumFacing.UP ? TileIronFurnace.SLOTS_TOP : TileIronFurnace.SLOTS_SIDES; - } - @Override public boolean isItemValidForSlot(int index, ItemStack stack) { boolean isFuel = TileEntityFurnace.isItemFuel(stack); @@ -191,23 +184,6 @@ public class TileIronFurnace extends TileLegacyMachineBase return index != output; } - @Override - public boolean canInsertItem(int index, ItemStack stack, EnumFacing direction) { - boolean isFuel = TileEntityFurnace.isItemFuel(stack); - if(isFuel){ - ItemStack fuelSlotStack = getStackInSlot(fuelslot); - if(fuelSlotStack.isEmpty() || ItemUtils.isItemEqual(stack, fuelSlotStack, true, true) && fuelSlotStack.getMaxStackSize() != fuelSlotStack.getCount()){ - return index == fuelslot; - } - } - return index != output; - } - - @Override - public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) { - return true; - } - public int getBurnTime() { return this.fuel; } diff --git a/src/main/java/techreborn/tiles/TileMatterFabricator.java b/src/main/java/techreborn/tiles/TileMatterFabricator.java index 6ee7f0742..06bc3701c 100644 --- a/src/main/java/techreborn/tiles/TileMatterFabricator.java +++ b/src/main/java/techreborn/tiles/TileMatterFabricator.java @@ -27,8 +27,8 @@ package techreborn.tiles; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; -import reborncore.api.tile.IInventoryProvider; import reborncore.api.IToolDrop; +import reborncore.api.tile.IInventoryProvider; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.registration.RebornRegistry; import reborncore.common.registration.impl.ConfigRegistry; @@ -75,23 +75,6 @@ public class TileMatterFabricator extends TilePowerAcceptor return false; } - @Override - public int[] getSlotsForFace(EnumFacing side) { - return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5, 6 } : new int[] { 0, 1, 2, 3, 4, 5, 6 }; - } - - @Override - public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) { - if (slotIndex >= 6) - return false; - return isItemValidForSlot(slotIndex, itemStack); - } - - @Override - public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) { - return slotIndex >= 6 && slotIndex <= 10; - } - @Override public void update() { if (world.isRemote){ return; } diff --git a/src/main/java/techreborn/tiles/TileQuantumTank.java b/src/main/java/techreborn/tiles/TileQuantumTank.java index 01ed0102c..1e8148a0d 100644 --- a/src/main/java/techreborn/tiles/TileQuantumTank.java +++ b/src/main/java/techreborn/tiles/TileQuantumTank.java @@ -33,8 +33,8 @@ import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import reborncore.api.IListInfoProvider; -import reborncore.api.tile.IInventoryProvider; import reborncore.api.IToolDrop; +import reborncore.api.tile.IInventoryProvider; import reborncore.common.registration.RebornRegistry; import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.tile.TileLegacyMachineBase; diff --git a/src/main/java/techreborn/tiles/TileRollingMachine.java b/src/main/java/techreborn/tiles/TileRollingMachine.java index 9f4eeee8b..9305c4f27 100644 --- a/src/main/java/techreborn/tiles/TileRollingMachine.java +++ b/src/main/java/techreborn/tiles/TileRollingMachine.java @@ -30,8 +30,8 @@ import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; -import reborncore.api.tile.IInventoryProvider; import reborncore.api.IToolDrop; +import reborncore.api.tile.IInventoryProvider; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.registration.RebornRegistry; import reborncore.common.registration.impl.ConfigRegistry; @@ -192,23 +192,6 @@ public class TileRollingMachine extends TilePowerAcceptor tagCompound.setInteger("tickTime", this.tickTime); } - @Override - public int[] getSlotsForFace(final EnumFacing side) { - if (side.equals(EnumFacing.DOWN)) - return new int[] { 0 }; - return new int[0]; - } - - @Override - public boolean canInsertItem(final int Index, final ItemStack itemStack, final EnumFacing side) { - return false; - } - - @Override - public boolean canExtractItem(final int Index, final ItemStack itemStack, final EnumFacing side) { - return Index == outputSlot; - } - @Override public void invalidate() { super.invalidate(); diff --git a/src/main/java/techreborn/tiles/TileScrapboxinator.java b/src/main/java/techreborn/tiles/TileScrapboxinator.java index ae56275bf..595bbbc08 100644 --- a/src/main/java/techreborn/tiles/TileScrapboxinator.java +++ b/src/main/java/techreborn/tiles/TileScrapboxinator.java @@ -26,11 +26,10 @@ package techreborn.tiles; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; -import reborncore.api.tile.IInventoryProvider; import reborncore.api.IToolDrop; +import reborncore.api.tile.IInventoryProvider; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.registration.RebornRegistry; @@ -46,7 +45,7 @@ import techreborn.lib.ModInfo; @RebornRegistry(modID = ModInfo.MOD_ID) public class TileScrapboxinator extends TilePowerAcceptor - implements IToolDrop, IInventoryProvider, ISidedInventory, IContainerProvider { + implements IToolDrop, IInventoryProvider, IContainerProvider { @ConfigRegistry(config = "machines", category = "scrapboxinator", key = "ScrapboxinatorMaxInput", comment = "Scrapboxinator Max Input (Value in EU)") public static int maxInput = 32; @@ -152,25 +151,6 @@ public class TileScrapboxinator extends TilePowerAcceptor return false; } - // ISidedInventory - - @Override - public int[] getSlotsForFace(EnumFacing side) { - return new int[] { 0, 1}; - } - - @Override - public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction){ - if (index == 0) { - return true; - } - return false; - } - - @Override - public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction){ - return index == 1; - } @Override public double getBaseMaxPower() { return maxEnergy; diff --git a/src/main/java/techreborn/tiles/cable/TileCable.java b/src/main/java/techreborn/tiles/cable/TileCable.java index 23529ee5a..1e097213b 100644 --- a/src/main/java/techreborn/tiles/cable/TileCable.java +++ b/src/main/java/techreborn/tiles/cable/TileCable.java @@ -24,9 +24,6 @@ package techreborn.tiles.cable; -import java.util.ArrayList; -import java.util.List; - import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.SPacketUpdateTileEntity; @@ -45,6 +42,9 @@ import reborncore.common.util.StringUtils; import techreborn.blocks.cable.BlockCable; import techreborn.blocks.cable.EnumCableType; +import java.util.ArrayList; +import java.util.List; + /** * Created by modmuss50 on 19/05/2017. */ diff --git a/src/main/java/techreborn/tiles/fusionReactor/TileFusionControlComputer.java b/src/main/java/techreborn/tiles/fusionReactor/TileFusionControlComputer.java index a18451784..5bf6fb3e3 100644 --- a/src/main/java/techreborn/tiles/fusionReactor/TileFusionControlComputer.java +++ b/src/main/java/techreborn/tiles/fusionReactor/TileFusionControlComputer.java @@ -311,31 +311,6 @@ public class TileFusionControlComputer extends TilePowerAcceptor implements IToo public ITextComponent getDisplayName() { return null; } - - @Override - public int[] getSlotsForFace(EnumFacing side) { - return new int[] { 0, 1, 2 }; - } - - /** - * Returns true if automation can insert the given item in the given slot from the given side. - */ - @Override - public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction){ - if (index == 0 || index == 1) { - return true; - } - return false; - } - - /** - * Returns true if automation can extract the given item in the given slot from the given side. - */ - @Override - public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction){ - return index == 2; - } - @Override public Inventory getInventory() { diff --git a/src/main/java/techreborn/tiles/generator/TileBaseFluidGenerator.java b/src/main/java/techreborn/tiles/generator/TileBaseFluidGenerator.java index 7737b8433..c264a09c2 100644 --- a/src/main/java/techreborn/tiles/generator/TileBaseFluidGenerator.java +++ b/src/main/java/techreborn/tiles/generator/TileBaseFluidGenerator.java @@ -31,8 +31,8 @@ import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; -import reborncore.api.tile.IInventoryProvider; import reborncore.api.IToolDrop; +import reborncore.api.tile.IInventoryProvider; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.util.FluidUtils; diff --git a/src/main/java/techreborn/tiles/generator/TileCreativeSolarPanel.java b/src/main/java/techreborn/tiles/generator/TileCreativeSolarPanel.java index 8613e4e32..4306e0f49 100644 --- a/src/main/java/techreborn/tiles/generator/TileCreativeSolarPanel.java +++ b/src/main/java/techreborn/tiles/generator/TileCreativeSolarPanel.java @@ -28,8 +28,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.common.Optional; -import reborncore.api.power.EnumPowerTier; import reborncore.api.IToolDrop; +import reborncore.api.power.EnumPowerTier; import reborncore.common.powerSystem.TilePowerAcceptor; import techreborn.init.ModBlocks; diff --git a/src/main/java/techreborn/tiles/generator/TileDragonEggSyphon.java b/src/main/java/techreborn/tiles/generator/TileDragonEggSyphon.java index f43c33715..109f4c603 100644 --- a/src/main/java/techreborn/tiles/generator/TileDragonEggSyphon.java +++ b/src/main/java/techreborn/tiles/generator/TileDragonEggSyphon.java @@ -29,8 +29,8 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; -import reborncore.api.tile.IInventoryProvider; import reborncore.api.IToolDrop; +import reborncore.api.tile.IInventoryProvider; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.registration.RebornRegistry; diff --git a/src/main/java/techreborn/tiles/generator/TileSolidFuelGenerator.java b/src/main/java/techreborn/tiles/generator/TileSolidFuelGenerator.java index f18b3d8b2..6a5c078c6 100644 --- a/src/main/java/techreborn/tiles/generator/TileSolidFuelGenerator.java +++ b/src/main/java/techreborn/tiles/generator/TileSolidFuelGenerator.java @@ -31,8 +31,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.ForgeModContainer; -import reborncore.api.tile.IInventoryProvider; import reborncore.api.IToolDrop; +import reborncore.api.tile.IInventoryProvider; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.registration.RebornRegistry; @@ -182,16 +182,6 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr .syncIntegerValue(this::getTotalBurnTime, this::setTotalBurnTime).addInventory().create(this); } - @Override - public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) { - return TileSolidFuelGenerator.getItemBurnTime(itemStackIn) != 0; - } - - @Override - public int[] getSlotsForFace(EnumFacing side) { - return new int[] { fuelSlot }; - } - @Override public boolean canBeUpgraded() { return false; diff --git a/src/main/java/techreborn/tiles/multiblock/TileDistillationTower.java b/src/main/java/techreborn/tiles/multiblock/TileDistillationTower.java index 6a5054c38..8c030b970 100644 --- a/src/main/java/techreborn/tiles/multiblock/TileDistillationTower.java +++ b/src/main/java/techreborn/tiles/multiblock/TileDistillationTower.java @@ -141,21 +141,6 @@ public class TileDistillationTower extends TilePowerAcceptor this.crafter.writeToNBT(tagCompound); return tagCompound; } - - @Override - public int[] getSlotsForFace(final EnumFacing side) { - return new int[] { 0, 1, 2, 3, 4, 5 }; - } - - @Override - public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) { - return index == 0 || index == 1; - } - - @Override - public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) { - return index == 2 || index == 3 || index == 4 || index == 5; - } // IToolDrop @Override diff --git a/src/main/java/techreborn/tiles/multiblock/TileImplosionCompressor.java b/src/main/java/techreborn/tiles/multiblock/TileImplosionCompressor.java index 4b82d9539..5bb263a39 100644 --- a/src/main/java/techreborn/tiles/multiblock/TileImplosionCompressor.java +++ b/src/main/java/techreborn/tiles/multiblock/TileImplosionCompressor.java @@ -29,9 +29,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; +import reborncore.api.IToolDrop; import reborncore.api.recipe.IRecipeCrafterProvider; import reborncore.api.tile.IInventoryProvider; -import reborncore.api.IToolDrop; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.registration.RebornRegistry; @@ -104,21 +104,6 @@ public class TileImplosionCompressor extends TilePowerAcceptor return tagCompound; } - @Override - public int[] getSlotsForFace(final EnumFacing side) { - return new int[] { 0, 1, 2, 3 }; - } - - @Override - public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) { - return index == 0 || index == 1; - } - - @Override - public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) { - return index == 2 || index == 3; - } - public int getProgressScaled(final int scale) { if (this.crafter.currentTickTime != 0) { return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks; diff --git a/src/main/java/techreborn/tiles/multiblock/TileIndustrialBlastFurnace.java b/src/main/java/techreborn/tiles/multiblock/TileIndustrialBlastFurnace.java index f83578c36..6ecf5bd15 100644 --- a/src/main/java/techreborn/tiles/multiblock/TileIndustrialBlastFurnace.java +++ b/src/main/java/techreborn/tiles/multiblock/TileIndustrialBlastFurnace.java @@ -34,9 +34,9 @@ import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; +import reborncore.api.IToolDrop; import reborncore.api.recipe.IRecipeCrafterProvider; import reborncore.api.tile.IInventoryProvider; -import reborncore.api.IToolDrop; import reborncore.common.multiblock.IMultiblockPart; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.recipes.RecipeCrafter; @@ -171,24 +171,6 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo return tagCompound; } - // ISidedInventory - @Override - public int[] getSlotsForFace(final EnumFacing side) { - return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3 } : new int[] { 0, 1, 2, 3 }; - } - - @Override - public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - if (slotIndex >= 2) - return false; - return this.isItemValidForSlot(slotIndex, itemStack); - } - - @Override - public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - return slotIndex == 2 || slotIndex == 3; - } - public int getProgressScaled(final int scale) { if (this.crafter.currentTickTime != 0) { return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks; diff --git a/src/main/java/techreborn/tiles/multiblock/TileIndustrialGrinder.java b/src/main/java/techreborn/tiles/multiblock/TileIndustrialGrinder.java index 21ad6a93d..8aad77c8e 100644 --- a/src/main/java/techreborn/tiles/multiblock/TileIndustrialGrinder.java +++ b/src/main/java/techreborn/tiles/multiblock/TileIndustrialGrinder.java @@ -37,9 +37,9 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; +import reborncore.api.IToolDrop; import reborncore.api.recipe.IRecipeCrafterProvider; import reborncore.api.tile.IInventoryProvider; -import reborncore.api.IToolDrop; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.registration.RebornRegistry; @@ -159,19 +159,6 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro return super.getCapability(capability, facing); } - // ISidedInventory - @Override - public int[] getSlotsForFace(final EnumFacing side) { - return new int[] { 1, 0, 2, 3, 4, 5, 6 }; - } - - @Override - public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - if (slotIndex >= 2) - return false; - return this.isItemValidForSlot(slotIndex, itemStack); - } - @Override public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) { if (slotIndex == 1) { @@ -185,11 +172,6 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro return true; } - @Override - public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5 || slotIndex == 6; - } - public int getProgressScaled(final int scale) { if (this.crafter.currentTickTime != 0) { return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks; diff --git a/src/main/java/techreborn/tiles/multiblock/TileIndustrialSawmill.java b/src/main/java/techreborn/tiles/multiblock/TileIndustrialSawmill.java index 9df8c8db8..446558651 100644 --- a/src/main/java/techreborn/tiles/multiblock/TileIndustrialSawmill.java +++ b/src/main/java/techreborn/tiles/multiblock/TileIndustrialSawmill.java @@ -37,9 +37,9 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; +import reborncore.api.IToolDrop; import reborncore.api.recipe.IRecipeCrafterProvider; import reborncore.api.tile.IInventoryProvider; -import reborncore.api.IToolDrop; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.registration.RebornRegistry; @@ -191,18 +191,6 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IToolDro return maxInput; } - @Override - public int[] getSlotsForFace(final EnumFacing side) { - return new int[] { 1, 0, 2, 3, 4, 5 }; - } - - @Override - public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing direction) { - if (slotIndex >= 2) - return false; - return this.isItemValidForSlot(slotIndex, itemStack); - } - @Override public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) { if (slotIndex == 1) { @@ -215,11 +203,6 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IToolDro return true; } - @Override - public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5; - } - // IToolDrop @Override public ItemStack getToolDrop(final EntityPlayer entityPlayer) { diff --git a/src/main/java/techreborn/tiles/multiblock/TileVacuumFreezer.java b/src/main/java/techreborn/tiles/multiblock/TileVacuumFreezer.java index b34a4310b..24a649923 100644 --- a/src/main/java/techreborn/tiles/multiblock/TileVacuumFreezer.java +++ b/src/main/java/techreborn/tiles/multiblock/TileVacuumFreezer.java @@ -28,9 +28,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import reborncore.api.IToolDrop; import reborncore.api.recipe.IRecipeCrafterProvider; import reborncore.api.tile.IInventoryProvider; -import reborncore.api.IToolDrop; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.util.Inventory; @@ -133,21 +133,6 @@ public class TileVacuumFreezer extends TilePowerAcceptor return this.crafter; } - @Override - public int[] getSlotsForFace(final EnumFacing side) { - return new int[] { 0, 1 }; - } - - @Override - public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) { - return index == 0; - } - - @Override - public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) { - return index == 1; - } - @Override public BuiltContainer createContainer(final EntityPlayer player) { return new ContainerBuilder("vacuumfreezer").player(player.inventory).inventory().hotbar().addInventory() diff --git a/src/main/java/techreborn/tiles/storage/TileEnergyStorage.java b/src/main/java/techreborn/tiles/storage/TileEnergyStorage.java index 93cb5a631..375eb4cc8 100644 --- a/src/main/java/techreborn/tiles/storage/TileEnergyStorage.java +++ b/src/main/java/techreborn/tiles/storage/TileEnergyStorage.java @@ -29,10 +29,13 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; +import net.minecraftforge.energy.CapabilityEnergy; +import net.minecraftforge.energy.IEnergyStorage; +import reborncore.api.IToolDrop; import reborncore.api.power.EnumPowerTier; import reborncore.api.power.IEnergyItemInfo; import reborncore.api.tile.IInventoryProvider; -import reborncore.api.IToolDrop; +import reborncore.common.RebornCoreConfig; import reborncore.common.powerSystem.PoweredItem; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.util.Inventory; @@ -81,6 +84,11 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IToolDrop, I if(CompatManager.isIC2Loaded){ IC2ItemCharger.chargeIc2Item(this, stack); } + if(stack.hasCapability(CapabilityEnergy.ENERGY, null)){ + IEnergyStorage energyStorage = stack.getCapability(CapabilityEnergy.ENERGY, null); + int max = Math.min(maxInput, getEnergyStored(null)); + useEnergy(energyStorage.receiveEnergy(max, false) / RebornCoreConfig.euPerFU); + } } if (!inventory.getStackInSlot(1).isEmpty()) { ItemStack stack = inventory.getStackInSlot(1); @@ -154,21 +162,6 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IToolDrop, I return inventory; } - @Override - public int[] getSlotsForFace(EnumFacing side) { - return new int[] { 0, 1 }; - } - - @Override - public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) { - return true; - } - - @Override - public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) { - return true; - } - @Override public boolean canBeUpgraded() { return false; diff --git a/src/main/java/techreborn/tiles/teir1/TileAlloySmelter.java b/src/main/java/techreborn/tiles/teir1/TileAlloySmelter.java index 755339b18..8d66fdd0d 100644 --- a/src/main/java/techreborn/tiles/teir1/TileAlloySmelter.java +++ b/src/main/java/techreborn/tiles/teir1/TileAlloySmelter.java @@ -25,14 +25,13 @@ package techreborn.tiles.teir1; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import reborncore.api.IToolDrop; import reborncore.api.recipe.IRecipeCrafterProvider; import reborncore.api.recipe.RecipeHandler; import reborncore.api.tile.IInventoryProvider; -import reborncore.api.IToolDrop; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.registration.RebornRegistry; @@ -49,7 +48,7 @@ import techreborn.lib.ModInfo; @RebornRegistry(modID = ModInfo.MOD_ID) public class TileAlloySmelter extends TilePowerAcceptor - implements IToolDrop, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider, IContainerProvider { + implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider { @ConfigRegistry(config = "machines", category = "alloy_smelter", key = "AlloySmelterMaxInput", comment = "Alloy Smelter Max Input (Value in EU)") public static int maxInput = 32; @@ -102,24 +101,6 @@ public class TileAlloySmelter extends TilePowerAcceptor return tagCompound; } - // ISidedInventory - @Override - public int[] getSlotsForFace(final EnumFacing side) { - return side == EnumFacing.DOWN ? new int[] { 0, 1, 2 } : new int[] { 0, 1, 2 }; - } - - @Override - public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - if (slotIndex == 2) - return false; - return this.isItemValidForSlot(slotIndex, itemStack); - } - - @Override - public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - return slotIndex == 2; - } - public int getProgressScaled(final int scale) { if (this.crafter.currentTickTime != 0 && this.crafter.currentNeededTicks != 0) { return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks; diff --git a/src/main/java/techreborn/tiles/teir1/TileCompressor.java b/src/main/java/techreborn/tiles/teir1/TileCompressor.java index 040906132..831ab064a 100644 --- a/src/main/java/techreborn/tiles/teir1/TileCompressor.java +++ b/src/main/java/techreborn/tiles/teir1/TileCompressor.java @@ -27,9 +27,9 @@ package techreborn.tiles.teir1; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import reborncore.api.IToolDrop; import reborncore.api.recipe.IRecipeCrafterProvider; import reborncore.api.tile.IInventoryProvider; -import reborncore.api.IToolDrop; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.util.Inventory; @@ -72,26 +72,6 @@ public class TileCompressor extends TilePowerAcceptor implements IToolDrop, IInv return false; } - // ISidedInventory - @Override - public int[] getSlotsForFace(final EnumFacing side) { - if (side.equals(EnumFacing.UP)) - return new int[] { 0 }; - else if (side.equals(EnumFacing.DOWN)) - return new int[] { 1 }; - return new int[0]; - } - - @Override - public boolean canInsertItem(final int Index, final ItemStack itemStack, final EnumFacing side) { - return Index == 0; - } - - @Override - public boolean canExtractItem(final int Index, final ItemStack itemStack, final EnumFacing side) { - return Index == 1; - } - public int getProgressScaled(final int scale) { if (this.crafter.currentTickTime != 0) { return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks; diff --git a/src/main/java/techreborn/tiles/teir1/TileElectricFurnace.java b/src/main/java/techreborn/tiles/teir1/TileElectricFurnace.java index 8205fdce2..646f3d349 100644 --- a/src/main/java/techreborn/tiles/teir1/TileElectricFurnace.java +++ b/src/main/java/techreborn/tiles/teir1/TileElectricFurnace.java @@ -26,7 +26,6 @@ package techreborn.tiles.teir1; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.util.EnumFacing; @@ -34,7 +33,6 @@ import reborncore.api.IToolDrop; import reborncore.api.tile.IInventoryProvider; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.powerSystem.TilePowerAcceptor; -import reborncore.common.tile.IMachineSlotProvider; import reborncore.common.util.Inventory; import techreborn.client.container.IContainerProvider; import techreborn.client.container.builder.BuiltContainer; @@ -42,7 +40,7 @@ import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.ModBlocks; public class TileElectricFurnace extends TilePowerAcceptor - implements IToolDrop, IInventoryProvider, IContainerProvider, IMachineSlotProvider { + implements IToolDrop, IInventoryProvider, IContainerProvider { public Inventory inventory = new Inventory(3, "TileElectricFurnace", 64, this); public int capacity = 1000; @@ -165,28 +163,6 @@ public class TileElectricFurnace extends TilePowerAcceptor return false; } - // ISidedInventory - @Override - public int[] getSlotsForFace(final EnumFacing side) { - if (side.equals(EnumFacing.UP)) - return new int[] { 0 }; - else if (side.equals(EnumFacing.DOWN)) - return new int[] { 1 }; - return new int[0]; - } - - @Override - public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - if (slotIndex == 2) - return false; - return this.isItemValidForSlot(slotIndex, itemStack); - } - - @Override - public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - return slotIndex == 1; - } - @Override public double getBaseMaxPower() { return this.capacity; @@ -232,21 +208,6 @@ public class TileElectricFurnace extends TilePowerAcceptor .syncIntegerValue(this::getBurnTime, this::setBurnTime).addInventory().create(this); } - @Override - public int[] getInputSlots() { - return new int[] { input1 }; - } - - @Override - public int[] getOuputSlots() { - return new int[] { output }; - } - - @Override - public IInventory getMachineInv() { - return inventory; - } - @Override public boolean canBeUpgraded() { return true; diff --git a/src/main/java/techreborn/tiles/teir1/TileExtractor.java b/src/main/java/techreborn/tiles/teir1/TileExtractor.java index a0744f46d..69dd89079 100644 --- a/src/main/java/techreborn/tiles/teir1/TileExtractor.java +++ b/src/main/java/techreborn/tiles/teir1/TileExtractor.java @@ -28,9 +28,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import reborncore.api.IToolDrop; import reborncore.api.recipe.IRecipeCrafterProvider; import reborncore.api.tile.IInventoryProvider; -import reborncore.api.IToolDrop; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.util.Inventory; @@ -130,25 +130,6 @@ public class TileExtractor extends TilePowerAcceptor return this.crafter; } - @Override - public int[] getSlotsForFace(final EnumFacing side) { - if (side.equals(EnumFacing.UP)) - return new int[] { 0 }; - else if (side.equals(EnumFacing.DOWN)) - return new int[] { 1 }; - return new int[0]; - } - - @Override - public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) { - return index == 0; - } - - @Override - public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) { - return index == 1; - } - @Override public BuiltContainer createContainer(final EntityPlayer player) { return new ContainerBuilder("extractor").player(player.inventory).inventory().hotbar().addInventory().tile(this) diff --git a/src/main/java/techreborn/tiles/teir1/TileGrinder.java b/src/main/java/techreborn/tiles/teir1/TileGrinder.java index c2c597e01..5e23e3c49 100644 --- a/src/main/java/techreborn/tiles/teir1/TileGrinder.java +++ b/src/main/java/techreborn/tiles/teir1/TileGrinder.java @@ -28,9 +28,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import reborncore.api.IToolDrop; import reborncore.api.recipe.IRecipeCrafterProvider; import reborncore.api.tile.IInventoryProvider; -import reborncore.api.IToolDrop; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.util.Inventory; @@ -131,25 +131,6 @@ public class TileGrinder extends TilePowerAcceptor return this.crafter; } - @Override - public int[] getSlotsForFace(final EnumFacing side) { - if (side.equals(EnumFacing.UP)) - return new int[] { 0 }; - else if (side.equals(EnumFacing.DOWN)) - return new int[] { 1 }; - return new int[0]; - } - - @Override - public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) { - return index == 0; - } - - @Override - public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) { - return index == 1; - } - @Override public BuiltContainer createContainer(final EntityPlayer player) { return new ContainerBuilder("grinder").player(player.inventory).inventory().hotbar().addInventory().tile(this) diff --git a/src/main/java/techreborn/tiles/teir1/TileRecycler.java b/src/main/java/techreborn/tiles/teir1/TileRecycler.java index e80a74fb4..3ae572f69 100644 --- a/src/main/java/techreborn/tiles/teir1/TileRecycler.java +++ b/src/main/java/techreborn/tiles/teir1/TileRecycler.java @@ -138,28 +138,6 @@ public class TileRecycler extends TilePowerAcceptor implements IToolDrop, IInven return false; } - // ISidedInventory - @Override - public int[] getSlotsForFace(final EnumFacing side) { - if (side.equals(EnumFacing.UP)) - return new int[] { 0 }; - else if (side.equals(EnumFacing.DOWN)) - return new int[] { 1 }; - return new int[0]; - } - - @Override - public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - if (slotIndex == 1) - return false; - return this.isItemValidForSlot(slotIndex, itemStack); - } - - @Override - public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) { - return slotIndex == 1; - } - @Override public double getBaseMaxPower() { return this.capacity; diff --git a/src/main/java/techreborn/tiles/transformers/TileTransformer.java b/src/main/java/techreborn/tiles/transformers/TileTransformer.java index 1269af948..eb84a7ae8 100644 --- a/src/main/java/techreborn/tiles/transformers/TileTransformer.java +++ b/src/main/java/techreborn/tiles/transformers/TileTransformer.java @@ -31,8 +31,8 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraft.util.text.TextFormatting; import reborncore.api.IListInfoProvider; -import reborncore.api.power.EnumPowerTier; import reborncore.api.IToolDrop; +import reborncore.api.power.EnumPowerTier; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.registration.RebornRegistry; import reborncore.common.registration.impl.ConfigRegistry; diff --git a/src/main/resources/assets/techreborn/lang/en_us.lang b/src/main/resources/assets/techreborn/lang/en_us.lang index beab9c576..83e0b3adf 100644 --- a/src/main/resources/assets/techreborn/lang/en_us.lang +++ b/src/main/resources/assets/techreborn/lang/en_us.lang @@ -377,6 +377,7 @@ item.techreborn.dustsmall.diorite.name=Small Pile of Diorite Dust item.techreborn.dustsmall.granite.name=Small Pile of Granite Dust item.techreborn.cell.name=Empty Cell +item.techreborn.cell.fluid.name=$fluid$ Cell item.techreborn.rebattery.name=Battery item.techreborn.lithiumBattery.name=Lithium Battery item.techreborn.energyCrystal.name=Energy Crystal diff --git a/src/main/resources/assets/techreborn/lang/pt_br.lang b/src/main/resources/assets/techreborn/lang/pt_br.lang new file mode 100644 index 000000000..bbbc31f88 --- /dev/null +++ b/src/main/resources/assets/techreborn/lang/pt_br.lang @@ -0,0 +1,720 @@ + +item.missingRecipe.name=Faltando um Placeholder de Receita + +itemGroup.techreborn=Tech Reborn + +#machines +tile.techreborn:pump.name=Bomba +tile.techreborn:gas_turbine.name=Turbina à Gás +tile.techreborn:industrial_block.name=Industrial +tile.techreborn:thermal_generator.name=Gerador Térmico +tile.techreborn:quantum_tank.name=Tanque Quântico +tile.techreborn:quantum_chest.name=Baú Quântico +tile.techreborn:digital_chest.name=Baú Digital +tile.techreborn:industrial_centrifuge.name=Centrífuga Industrial +tile.techreborn:rolling_machine.name=Máquina de Rolagem +tile.techreborn:machine_casing.standard.name=Estrutura de Máquina Padrão +tile.techreborn:machine_casing.reinforced.name=Estrutura de Máquina Reforçada +tile.techreborn:machine_casing.advanced.name=Estrutura de Máquina Avançada +tile.techreborn:industrial_blast_furnace.name=Fornalha Industrial +tile.techreborn:alloy_smelter.name=Fundidora de Ligas +tile.techreborn:matter_fabricator.name=Fabricador de Matéria +tile.techreborn:implosion_compressor.name=Compressor à Implosão +tile.techreborn:industrial_grinder.name=Triturador Industrial +tile.techreborn:chunk_loader.name=Chunkloader Industrial +tile.techreborn:magic_energy_converter.name=Conversor de Energia Mágica +tile.techreborn:diesel_generator.name=Gerador à Diesel +tile.techreborn:heat_generator.name=Gerador à Calor +tile.techreborn:industrial_electrolyzer.name=Eletrolizador Industrial +tile.techreborn:magic_energy_absorber.name=Absorvedor de Energia Mágica +tile.techreborn:assembly_machine.name=Máquina de Montagem +tile.techreborn:semi_fluid_generator.name=Gerador à Semi-fluidos +tile.techreborn:iron_alloy_furnace.name=Fornalha de Ferro para Ligas +tile.techreborn:chemical_reactor.name=Reator Químico +tile.techreborn:dragon_egg_syphon.name=Dragon Egg Energy Siphon +tile.techreborn:interdimensional_su.name=Cubo de Energia Transdimensional +tile.techreborn:adjustable_su.name=Cubo de Energia Ajustável +tile.techreborn:lapotronic_su.name=Controlador LESU +tile.techreborn:lsu_storage.name=Armazenamento LESU +tile.techreborn:distillation_tower.name=Torre de Destilação +tile.techreborn:electric_crafting_table.name=Mesa de Auto-Fabricação Automática +tile.techreborn:vacuum_freezer.name=Congelador à Vacuo +tile.techreborn:plasma_generator.name=Greador à Plasma +tile.techreborn:fusion_control_computer.name=Controlador de Fusão +tile.techreborn:computer_cube.name=Computador em Cubo do Tech Reborn +tile.techreborn:fusion_coil.name=Bobina de Fusão +tile.techreborn:lightning_rod.name=Para-raios +tile.techreborn:industrial_sawmill.name=Serraria +tile.techreborn:charge_o_mat.name=Carregador +tile.techreborn:player_detector.all.name=Detector de Players (Todos) +tile.techreborn:player_detector.others.name=Detector de Players (Outros) +tile.techreborn:player_detector.you.name=Detector de Players (Você) +tile.techreborn:solid_fuel_generator.name=Gerador +tile.techreborn:extractor.name=Extrator +tile.techreborn:grinder.name=Triturador +tile.techreborn:compressor.name=Compressor +tile.techreborn:electric_furnace.name=Fornalha Elétrica +tile.techreborn:machine_frame.highly_advanced.name=Estrutura de Máquina Altamente Avançada +tile.techreborn:machine_frame.advanced.name=Estrutura de Máquina Avançada +tile.techreborn:machine_frame.basic.name=Estrutura de Máquina Básica +tile.techreborn:ore2.copper.name=Minério de Cobre +tile.techreborn:ore2.tin.name=Minério de Estanho +tile.techreborn:solar_panel.basic.name=Painel Solar Básico +tile.techreborn:solar_panel.hybrid.name=Painel Solar Híbrido +tile.techreborn:solar_panel.advanced.name=Painel Solar Avançado +tile.techreborn:solar_panel.ultimate.name=Painel Solar Ultimate +tile.techreborn:solar_panel.quantum.name=Painel Solar Quântico + +tile.techreborn:creative_solar_panel.name=Painel Criativo +tile.techreborn:water_mill.name=Moinho D'água +tile.techreborn:wind_mill.name=Gerador Eólico +tile.techreborn:iron_furnace.name=Fornalha de Ferro +tile.techreborn:recycler.name=Reciclador +tile.techreborn:scrapboxinator.name=Sucateira +tile.techreborn:low_voltage_su.name=Caixa de Baterias +tile.techreborn:medium_voltage_su.name=MFE +tile.techreborn:high_voltage_su.name=MFSU +tile.techreborn:reinforced_glass.name=Vidro Reforçado +tile.techreborn:nuke.name=Bomba Nuke +tile.techreborn:lv_transformer.name=Transformador BV +tile.techreborn:mv_transformer.name=Transformador MV +tile.techreborn:hv_transformer.name=Transformador AV +tile.techreborn:ev_transformer.name=Transformador EV +tile.techreborn:auto_crafting_table.name=Mesa de Auto-Fabricação + + +#Blocks +tile.techreborn:rubber_log.name=Madeira de Seringueira +tile.techreborn:rubber_planks.name=Tábuas de Madeira de Seringueira +tile.techreborn:rubber_leaves.name=Folhas de Seringueira +tile.techreborn:rubber_sapling.name=Muda de Seringueira + +tile.techreborn:refined_iron_fence.name=Cerca de Ferro +tile.techreborn:lamp_incandescent.name=Lâmpada Incandescente +tile.techreborn:lamp_led.name=Lâmpada de LED + +#Ores +tile.techreborn:ore.galena.name=Minério de Galena +tile.techreborn:ore.iridium.name=Minério de Irídio +tile.techreborn:ore.ruby.name=Minério de Rubi +tile.techreborn:ore.sapphire.name=Minério de Safira +tile.techreborn:ore.bauxite.name=Minério de Bauxita +tile.techreborn:ore.pyrite.name=Minério de Pirita +tile.techreborn:ore.cinnabar.name=Minério de Cinábrio +tile.techreborn:ore.sphalerite.name=Minério de Esfarelite +tile.techreborn:ore.tungsten.name=Minério de Tungstênio +tile.techreborn:ore.sheldonite.name=Minério de Sheldonite +tile.techreborn:ore.peridot.name=Minério de Peridoto +tile.techreborn:ore.sodalite.name=Minério de Sodalite +tile.techreborn:ore.tetrahedrite.name=Minério de Tetraedrite +tile.techreborn:ore.cassiterite.name=Minério de Cassiterite +tile.techreborn:ore.lead.name=Minério de Chumbo +tile.techreborn:ore.silver.name=Minério de Prata + +#Storage +tile.techreborn:storage.silver.name=Bloco de Prata +tile.techreborn:storage.aluminum.name=Bloco de Alumínio +tile.techreborn:storage.titanium.name=Bloco de Titanio +tile.techreborn:storage.chrome.name=Bloco de Crômo +tile.techreborn:storage.steel.name=Bloco de Aço +tile.techreborn:storage.brass.name=Bloco de Latão +tile.techreborn:storage.lead.name=Bloco de Chumbo +tile.techreborn:storage.electrum.name=Bloco de Electro +tile.techreborn:storage.zinc.name=Bloco de Zinco +tile.techreborn:storage.platinum.name=Bloco de Platina +tile.techreborn:storage.tungsten.name=Bloco de Tungstênio +tile.techreborn:storage.nickel.name=Bloco de Níquel +tile.techreborn:storage.invar.name=Bloco de Invar +tile.techreborn:storage.osmium.name=Bloco de Ósmio +tile.techreborn:storage.iridium.name=Bloco de Irídio +tile.techreborn:storage2.tungstensteel.name=Bloco de Aço de Tungstênio +tile.techreborn:storage2.lodestone.name=Bloco de Pedra-ímã +tile.techreborn:storage2.tellurium.name=Bloco de Telúrio +tile.techreborn:storage2.iridium_reinforced_tungstensteel.name=Bloco de Aço de Tungstênio Reforçado com Irídio +tile.techreborn:storage2.iridium_reinforced_stone.name=Pedra Reforçada com Irídio +tile.techreborn:storage2.ruby.name=Bloco de Rubi +tile.techreborn:storage2.sapphire.name=Bloco de Safira +tile.techreborn:storage2.peridot.name=Bloco de Peridoto +tile.techreborn:storage2.yellow_garnet.name=Bloco de Cristal Amarelo +tile.techreborn:storage2.red_garnet.name=Bloco de Cristal Vermelho +tile.techreborn:storage2.refined_iron.name=Bloco de Ferro Refinado +tile.techreborn:storage2.copper.name=Bloco de Cobre +tile.techreborn:storage2.tin.name=Bloco de Estanho +tile.techreborn:farm.name=Farm + + +#Fluids +tile.techreborn:berylium.name=Berílo Líquido +tile.techreborn:calcium.name=Calcio Líquido +tile.techreborn:calciumcarbonate.name=Carbonato de Cálcio Líquido +tile.techreborn:chlorite.name=Clorite Líquido +tile.techreborn:deuterium.name=Deutério Líquido +tile.techreborn:glyceryl.name=Glicerilo Líquido +tile.techreborn:helium.name=Hélio +tile.techreborn:helium3.name=Hélio3 +tile.techreborn:heliumplasma.name=Plasma de Hélio +tile.techreborn:hydrogen.name=Hidrogênio +tile.techreborn:lithium.name=Lítio Líquido +tile.techreborn:mercury.name=Mercúrio Líquido +tile.techreborn:methane.name=Metano Líquido +tile.techreborn:nitrocoalfuel.name=Combustível de Nitrogênio Líquido +tile.techreborn:nitrofuel.name=Combustível Nitroso Líquido +tile.techreborn:nitrogen.name=Nitrogênio Líquido +tile.techreborn:nitrogendioxide.name=Dióxido de Nitrogênio Líquido +tile.techreborn:potassium.name=Potássio Líquido +tile.techreborn:silicon.name=Silicone Líquido +tile.techreborn:sodium.name=Sódio Líquido +tile.techreborn:sodiumpersulfate.name=Persulfato de Sódio Líquido +tile.techreborn:tritium.name=Tritio Líquido +tile.techreborn:wolframium.name=Wolframium Líquido +tile.techreborn:compressedair.name=Ar Comprimido +tile.techreborn:electrolyzedwater.name=Água Eletrolizada +tile.techreborn:supercondensator.name=Supercondensador +fluid.fluid.fluidberylium=Berílo +fluid.fluid.fluidcalcium=Calcio +fluid.fluid.fluidcalciumcarbonate=Carbonato de Cálcio +fluid.fluid.fluidchlorite=Clorite +fluid.fluid.fluiddeuterium=Deutério +fluid.fluid.fluidglyceryl=Glicerilo +fluid.fluid.fluidhelium=Hélio +fluid.fluid.fluidhelium3=Hélio3 +fluid.fluid.fluidheliumplasma=Plasma de Hélio +fluid.fluid.fluidhydrogen=Hidrogênio +fluid.fluid.fluidlithium=Lítio +fluid.fluid.fluidmercury=Mercúrio +fluid.fluid.fluidmethane=Metano +fluid.fluid.fluidnitrocoalfuel=Combustível de Nitrogênio +fluid.fluid.fluidnitrofuel=Combustível Nitroso +fluid.fluid.fluidnitrogen=Nitrogênio +fluid.fluid.fluidnitrogendioxide=Dióxido de Nitrogênio +fluid.fluid.fluidpotassium=Potássio +fluid.fluid.fluidsilicon=Silicone +fluid.fluid.fluidsodium=Sódio +fluid.fluid.fluidsodiumpersulfate=Persulfato de Sódio +fluid.fluid.fluidtritium=Tritio +fluid.fluid.fluidwolframium=Wolframium +fluid.fluid.electrolyzedwater=Água Eletrolizada +fluid.fluid.compresseair=Ar Comprimido +fluid.tile.techreborn:glyceryl=Glicerilo +fluid.tile.techreborn:berylium=Berílo +fluid.tile.techreborn:chlorite=Clorite +fluid.tile.techreborn:helium3=Hélio3 +fluid.tile.techreborn:deuterium=Deutério +fluid.tile.techreborn:helium=Hélio +fluid.tile.techreborn:calciumcarbonate=Carbonato de Cálcio +fluid.titanium.name=Titânio Derretido +fluid.chrome.name=Crômo Derretido +fluid.platinum.name=Platina Derretido +fluid.iridium.name=Irídio Derretido +fluid.invar.name=Invar Derretido +fluid.tungsten.name=Tungstênio Derretido + +#Dusts +item.techreborn.dust.almandine.name=Pó de Almandine +item.techreborn.dust.aluminumBrass.name=Pó de Alumínio-bronze +item.techreborn.dust.aluminum.name=Pó de Alumínio +item.techreborn.dust.alumite.name=Pó de Alumite +item.techreborn.dust.andradite.name=Pó de Andradite +item.techreborn.dust.antimony.name=Pó de Antimônio +item.techreborn.dust.ardite.name=Pó de Ardite +item.techreborn.dust.ashes.name=Cinzas +item.techreborn.dust.basalt.name=Pó de Basalto +item.techreborn.dust.bauxite.name=Pó de Bauxita +item.techreborn.dust.biotite.name=Pó de Biotite +item.techreborn.dust.brass.name=Pó de Latão +item.techreborn.dust.bronze.name=Pó de Bronze +item.techreborn.dust.cadmium.name=Pó de Cádmio +item.techreborn.dust.calcite.name=Pó de Calcita +item.techreborn.dust.charcoal.name=Pó de Carvão Vegetal +item.techreborn.dust.chrome.name=Pó de Crômo +item.techreborn.dust.cinnabar.name=Pó de Cinábrio +item.techreborn.dust.clay.name=Pó de Argila +item.techreborn.dust.coal.name=Pó de Carvão +item.techreborn.dust.cobalt.name=Pó de Cobalto +item.techreborn.dust.copper.name=Pó de Cobre +item.techreborn.dust.cupronickel.name=Pó de Cobre-níquel +item.techreborn.dust.dark_ashes.name=Cinzas Negras +item.techreborn.dust.darkIron.name=Pó de Aço Negro +item.techreborn.dust.diamond.name=Pó de Diamante +item.techreborn.dust.electrum.name=Pó de Electro +item.techreborn.dust.emerald.name=Pó de Esmeralda +item.techreborn.dust.ender_eye.name=Pó de Olho do End +item.techreborn.dust.ender_pearl.name=Pó de Pérola do End +item.techreborn.dust.endstone.name=Pó de Rocha do End +item.techreborn.dust.flint.name=Pó de Pederneira +item.techreborn.dust.gold.name=Pó de Ouro +item.techreborn.dust.graphite.name=Pó de Grafite +item.techreborn.dust.grossular.name=Pó de Grossular +item.techreborn.dust.indium.name=Pó de Índio +item.techreborn.dust.invar.name=Pó de Invar +item.techreborn.dust.iridium.name=Pó de Irídio +item.techreborn.dust.iron.name=Pó de Ferro +item.techreborn.dust.lazurite.name=Pó de Lazurita +item.techreborn.dust.lead.name=Pó de Chumbo +item.techreborn.dust.magnesium.name=Pó de Magnésio +item.techreborn.dust.manganese.name=Pó de Manganês +item.techreborn.dust.marble.name=Pó de Marble +item.techreborn.dust.netherrack.name=Pó de Rocha do Nether +item.techreborn.dust.nickel.name=Pó de Níquel +item.techreborn.dust.obsidian.name=Pó de Obsidiana +item.techreborn.dust.osmium.name=Pó de Ósmio +item.techreborn.dust.peridot.name=Pó de Peridoto +item.techreborn.dust.phosphorous.name=Pó de Fósforo +item.techreborn.dust.platinum.name=Pó de Platina +item.techreborn.dust.potassiumFeldspar.name=Pó de Feldspato de Potássio +item.techreborn.dust.pyrite.name=Pó de Pirita +item.techreborn.dust.pyrope.name=Pó de Piropa +item.techreborn.dust.red_garnet.name=Pó de Cristal Vermelho +item.techreborn.dust.ruby.name=Pó de Rubi +item.techreborn.dust.saltpeter.name=Pó de Salitre +item.techreborn.dust.sapphire.name=Pó de Safira +item.techreborn.dust.silicon.name=Pó de Silicone +item.techreborn.dust.silver.name=Pó de Prata +item.techreborn.dust.sodalite.name=Pó de Sodalite +item.techreborn.dust.spessartine.name=Pó de Espessartine +item.techreborn.dust.sphalerite.name=Pó de Esfalerita +item.techreborn.dust.steel.name=Pó de Aço +item.techreborn.dust.sulfur.name=Pó de Enxofre +item.techreborn.dust.tellurium.name=Pó de Telúrio +item.techreborn.dust.teslatite.name=Pó de Teslatita +item.techreborn.dust.tetrahedrite.name=Pó de Tetraedrita +item.techreborn.dust.tin.name=Pó de Estanho +item.techreborn.dust.titanium.name=Pó de Titânio +item.techreborn.dust.tungsten.name=Pó de Tungstênio +item.techreborn.dust.uvarovite.name=Pó de Uvarovite +item.techreborn.dust.vinteum.name=Pó de Vintênio +item.techreborn.dust.voidstone.name=Pó de Voidstone +item.techreborn.dust.yellow_garnet.name=Pó de Cristal Amarelo +item.techreborn.dust.zinc.name=Pó de Zinco +item.techreborn.dust.galena.name=Pó de Galena +item.techreborn.dust.saw_dust.name=Serragem +item.techreborn.dust.olivine.name=Pó de Olivine +item.techreborn.dust.andesite.name=Pó de Andesito +item.techreborn.dust.diorite.name=Pó de Diorito +item.techreborn.dust.granite.name=Pó de Granito + +item.techreborn.wrench.name=Chave Inglesa +tile.techreborn:cable.copper.name=Cabo de Cobre +tile.techreborn:cable.tin.name=Cabo de Estanho +tile.techreborn:cable.gold.name=Cabo de Ouro +tile.techreborn:cable.hv.name=Cabo de Alta Voltagem +tile.techreborn:cable.glassfiber.name=Cabo de Fibra de Vidro +tile.techreborn:cable.insulatedcopper.name=Cabo de Cobre Isolado +tile.techreborn:cable.insulatedgold.name=Cabo de Ouro Isolado +tile.techreborn:cable.insulatedhv.name=Cabo de Alta Voltagem Isolado +item.techreborn.scrapbox.name=Caixa de Sucata +item.techreborn.part.carbon_mesh.name=Malha de Carbono +item.techreborn.part.carbon_fiber.name=Fibra de Carbono + +#Small Dusts +item.techreborn.dustsmall.almandine.name=Um Pouco de Pó de Almandine +item.techreborn.dustsmall.aluminum.name=Um Pouco de Pó de Alumínio +item.techreborn.dustsmall.andradite.name=Um Pouco de Pó de Andradite +item.techreborn.dustsmall.ashes.name=Um Pouco de Cinzas +item.techreborn.dustsmall.basalt.name=Um Pouco de Pó de Basalto +item.techreborn.dustsmall.bauxite.name=Um Pouco de Pó de Bauxita +item.techreborn.dustsmall.brass.name=Um Pouco de Pó de Latão +item.techreborn.dustsmall.bronze.name=Um Pouco de Pó de Bronze +item.techreborn.dustsmall.calcite.name=Um Pouco de Pó de Calcita +item.techreborn.dustsmall.charcoal.name=Um Pouco de Pó de Carvão Vegetal +item.techreborn.dustsmall.chrome.name=Um Pouco de Pó de Crômo +item.techreborn.dustsmall.cinnabar.name=Um Pouco de Pó de Cinábrio +item.techreborn.dustsmall.clay.name=Um Pouco de Pó de Argila +item.techreborn.dustsmall.coal.name=Um Pouco de Pó de Carvão +item.techreborn.dustsmall.copper.name=Um Pouco de Pó de Cobre +item.techreborn.dustsmall.dark_ashes.name=Um Pouco de Cinzas Negras +item.techreborn.dustsmall.diamond.name=Um Pouco de Pó de Diamante +item.techreborn.dustsmall.electrum.name=Um Pouco de Pó de Electro +item.techreborn.dustsmall.emerald.name=Um Pouco de Pó de Esmeralda +item.techreborn.dustsmall.ender_eye.name=Um Pouco de Pó de Olho do End +item.techreborn.dustsmall.ender_pearl.name=Um Pouco de Pó de Pérola do End +item.techreborn.dustsmall.endstone.name=Um Pouco de Pó de Rocha do End +item.techreborn.dustsmall.flint.name=Um Pouco de Pó de Pederneira +item.techreborn.dustsmall.galena.name=Um Pouco de Pó de Galena +item.techreborn.dustsmall.glowstone.name=Um Pouco de Pó de Pedra Luminosa +item.techreborn.dustsmall.gold.name=Um Pouco de Pó de Ouro +item.techreborn.dustsmall.grossular.name=Um Pouco de Pó de Grossular +item.techreborn.dustsmall.invar.name=Um Pouco de Pó de Invar +item.techreborn.dustsmall.iron.name=Um Pouco de Pó de Ferro +item.techreborn.dustsmall.lazurite.name=Um Pouco de Pó de Lazurita +item.techreborn.dustsmall.lead.name=Um Pouco de Pó de Chumbo +item.techreborn.dustsmall.magnesium.name=Um Pouco de Pó de Magnésio +item.techreborn.dustsmall.manganese.name=Um Pouco de Pó de Manganês +item.techreborn.dustsmall.marble.name=Um Pouco de Pó de Marble +item.techreborn.dustsmall.netherrack.name=Um Pouco de Pó de Rocha do Nether +item.techreborn.dustsmall.nickel.name=Um Pouco de Pó de Níquel +item.techreborn.dustsmall.obsidian.name=Um Pouco de Pó de Obsidiana +item.techreborn.dustsmall.peridot.name=Um Pouco de Pó de Peridoto +item.techreborn.dustsmall.phosphorous.name=Um Pouco de Pó de Fósforo +item.techreborn.dustsmall.platinum.name=Um Pouco de Pó de Platina +item.techreborn.dustsmall.pyrite.name=Um Pouco de Pó de Pirita +item.techreborn.dustsmall.pyrope.name=Um Pouco de Pó de Piropa +item.techreborn.dustsmall.red_garnet.name=Um Pouco de Pó de Cristal Vermelho +item.techreborn.dustsmall.redstone.name=Um Pouco de Pó de Redstone +item.techreborn.dustsmall.ruby.name=Um Pouco de Pó de Rubi +item.techreborn.dustsmall.saltpeter.name=Um Pouco de Pó de Salitre +item.techreborn.dustsmall.sapphire.name=Um Pouco de Pó de Safira +item.techreborn.dustsmall.saw_dust.name=Um Pouco de Serragem +item.techreborn.dustsmall.silver.name=Um Pouco de Pó de Prata +item.techreborn.dustsmall.sodalite.name=Um Pouco de Pó de Sodalite +item.techreborn.dustsmall.spessartine.name=Um Pouco de Pó de Espessartine +item.techreborn.dustsmall.sphalerite.name=Um Pouco de Pó de Esfalerita +item.techreborn.dustsmall.steel.name=Um Pouco de Pó de Aço +item.techreborn.dustsmall.sulfur.name=Um Pouco de Pó de Enxofre +item.techreborn.dustsmall.tin.name=Um Pouco de Pó de Estanho +item.techreborn.dustsmall.titanium.name=Um Pouco de Pó de Titânio +item.techreborn.dustsmall.tungsten.name=Um Pouco de Pó de Tungstênio +item.techreborn.dustsmall.uvarovite.name=Um Pouco de Pó de Uvarovite +item.techreborn.dustsmall.voidstone.name=Um Pouco de Pó de Voidstone +item.techreborn.dustsmall.yellow_garnet.name=Um Pouco de Pó de Cristal Amarelo +item.techreborn.dustsmall.zinc.name=Um Pouco de Pó de Zinco +item.techreborn.dustsmall.olivine.name=Um Pouco de Pó de Olivine +item.techreborn.dustsmall.andesite.name=Um Pouco de Pó de Andesito +item.techreborn.dustsmall.diorite.name=Um Pouco de Pó de Diorito +item.techreborn.dustsmall.granite.name=Um Pouco de Pó de Granito + +item.techreborn.cell.name=Célula Vazia +item.techreborn.cell.fluid.name=Célula de $fluid$ +item.techreborn.rebattery.name=Bateria +item.techreborn.lithiumBattery.name=Bateria de Lítio +item.techreborn.energyCrystal.name=Cristal de Energia +item.techreborn.lapotronCrystal.name=Cristal Lapotron +item.techreborn.treetap.name=Drenador +item.techreborn.nanosaber.name=Nano-Sabre +item.techreborn.upgrade.overclock.name=Atualização (Overclock) +item.techreborn.upgrade.transformer.name=Atualização (Transformador Interno) +item.techreborn.upgrade.energy_storage.name=Atualização (Armazenamento de Energia) +item.techreborn.upgrade.range.name=Atualização (Alcance) +item.techreborn.upgrade.ejection.name=Atualização (Ejetor) +item.techreborn.upgrade.injection.name=Atualização (Importador) +item.techreborn.electric_treetap.name=Atualização (Drenagem) + +#Gems +item.techreborn.gem.ruby.name=Rubi +item.techreborn.gem.sapphire.name=Safira +item.techreborn.gem.peridot.name=Peridoto +item.techreborn.gem.red_garnet.name=Cristal Vermelho +item.techreborn.gem.yellow_garnet.name=Cristal Amarelo + +#Ingots +item.techreborn.ingot.aluminum.name=Lingote de Alumínio +item.techreborn.ingot.brass.name=Lingote de Latão +item.techreborn.ingot.bronze.name=Lingote de Bronze +item.techreborn.ingot.chrome.name=Lingote de Crômo +item.techreborn.ingot.copper.name=Lingote de Cobre +item.techreborn.ingot.electrum.name=Lingote de Electro +item.techreborn.ingot.invar.name=Lingote de Invar +item.techreborn.ingot.iridium.name=Lingote de Irídio +item.techreborn.ingot.lead.name=Lingote de Chumbo +item.techreborn.ingot.nickel.name=Lingote de Níquel +item.techreborn.ingot.platinum.name=Lingote de Platina +item.techreborn.ingot.silver.name=Lingote de Prata +item.techreborn.ingot.steel.name=Lingote de Aço +item.techreborn.ingot.tin.name=Lingote de Estanho +item.techreborn.ingot.titanium.name=Lingote de Titânio +item.techreborn.ingot.tungsten.name=Lingote de Tungstênio +item.techreborn.ingot.hot_tungstensteel.name=Lingote de Aço de Tungstênio Quente +item.techreborn.ingot.tungstensteel.name=Lingote de Aço de Tungstênio +item.techreborn.ingot.zinc.name=Lingote de Zinco +item.techreborn.ingot.advanced_alloy.name=Lingote de Liga Avançada +item.techreborn.ingot.mixed_metal.name=Lingote de Metal Misturado +item.techreborn.ingot.iridium_alloy.name=Lingote de Liga de Irídio +item.techreborn.ingot.refined_iron.name=Lingote de Ferro Refinado + +#Nuggets +item.techreborn.nuggets.aluminum.name=Pepita de Alumínio +item.techreborn.nuggets.antimony.name=Pepita de Antimônio +item.techreborn.nuggets.brass.name=Pepita de Latão +item.techreborn.nuggets.bronze.name=Pepita de Bronze +item.techreborn.nuggets.chrome.name=Pepita de Crômo +item.techreborn.nuggets.copper.name=Pepita de Cobre +item.techreborn.nuggets.electrum.name=Pepita de Electro +item.techreborn.nuggets.invar.name=Pepita de Invar +item.techreborn.nuggets.iridium.name=Pepita de Irídio +item.techreborn.nuggets.iron.name=Pepita de Ferro +item.techreborn.nuggets.lead.name=Pepita de Chumbo +item.techreborn.nuggets.nickel.name=Pepita de Níquel +item.techreborn.nuggets.osmium.name=Pepita de Ósmio +item.techreborn.nuggets.platinum.name=Pepita de Platina +item.techreborn.nuggets.silver.name=Pepita de Prata +item.techreborn.nuggets.steel.name=Pepita de Aço +item.techreborn.nuggets.tin.name=Pepita de Estanho +item.techreborn.nuggets.titanium.name=Pepita de Titânio +item.techreborn.nuggets.tungsten.name=Pepita de Tungstênio +item.techreborn.nuggets.tungstensteel.name=Pepita de Aço de Tungstênio +item.techreborn.nuggets.hot_tungstensteel.name=Pepita de Aço de Tungstênio Quente +item.techreborn.nuggets.zinc.name=Pepita de Zinco +item.techreborn.nuggets.refined_iron.name=Pepita de Ferro Refinado +item.techreborn.nuggets.diamond.name=Pepita de Diamante + +#Plates +item.techreborn.plate.aluminum.name=Placa de Alumínio +item.techreborn.plate.brass.name=Placa de Latão +item.techreborn.plate.bronze.name=Placa de Bronze +item.techreborn.plate.carbon.name=Placa de Carbono +item.techreborn.plate.coal.name=Placa de Carvão +item.techreborn.plate.chrome.name=Placa de Crômo +item.techreborn.plate.copper.name=Placa de Cobre +item.techreborn.plate.diamond.name=Placa de Diamante +item.techreborn.plate.electrum.name=Placa de Electro +item.techreborn.plate.emerald.name=Placa de Esmeralda +item.techreborn.plate.gold.name=Placa de Ouro +item.techreborn.plate.invar.name=Placa de Invar +item.techreborn.plate.iridium.name=Placa de Irídio +item.techreborn.plate.iron.name=Placa de Ferro +item.techreborn.plate.lapis.name=Placa de Lápis-Lazuli +item.techreborn.plate.lead.name=Placa de Chumbo +item.techreborn.plate.nickel.name=Placa de Níquel +item.techreborn.plate.obsidian.name=Placa de Obsidiana +item.techreborn.plate.peridot.name=Placa de Peridoto +item.techreborn.plate.platinum.name=Placa de Platina +item.techreborn.plate.red_garnet.name=Placa de Cristal Vermelho +item.techreborn.plate.redstone.name=Placa de Redstone +item.techreborn.plate.ruby.name=Placa de Rubi +item.techreborn.plate.sapphire.name=Placa de Safira +item.techreborn.plate.silicon.name=Placa de Silicone +item.techreborn.plate.silver.name=Placa de Prata +item.techreborn.plate.steel.name=Placa de Aço +item.techreborn.plate.teslatite.name=Placa de Teslatite +item.techreborn.plate.tin.name=Placa de Estanho +item.techreborn.plate.titanium.name=Placa de Titânio +item.techreborn.plate.tungsten.name=Placa de Tungstênio +item.techreborn.plate.hot_tungstensteel.name=Placa de Aço de Tungstênio Quente +item.techreborn.plate.tungstensteel.name=Placa de Aço de Tungstênio +item.techreborn.plate.yellow_garnet.name=Placa de Cristal Amarelo +item.techreborn.plate.zinc.name=Placa de Zinco +item.techreborn.plate.refined_iron.name=Placa de Ferro Refinado +item.techreborn.plate.wood.name=Placa de Madeira +item.techreborn.plate.advanced_alloy.name=Placa de Liga Avançada +item.techreborn.plate.lazurite.name=Placa de Lazurita +item.techreborn.plate.magnalium.name=Placa de Magnálio +item.techreborn.plate.iridium_alloy.name=Placa de Liga de Irídio + +#Parts +item.techreborn.part.energy_flow_circuit.name=Circuito de Fluxo de Energia +item.techreborn.part.data_control_circuit.name=Circuito de Controle de Dados +item.techreborn.part.data_orb.name=Orbe de Dados +item.techreborn.part.data_storage_circuit.name=Circuito de Armazenamento de Dados +item.techreborn.part.diamond_grinding_head.name=Cabeça de Trituração de Diamante +item.techreborn.part.diamond_saw_blade.name=Serra de Diamante +item.techreborn.part.tungsten_grinding_head.name=Cabeça de Trituração de Tungstênio +item.techreborn.part.helium_coolant_simple.name=Célula Refrigerante de Hélio de 60k +item.techreborn.part.helium_coolant_triple.name=Célula Refrigerante de Hélio de 180k +item.techreborn.part.helium_coolant_six.name=Célula Refrigerante de Hélio de 360k +item.techreborn.part.nak_coolant_simple.name=Célula Refrigerante de SPA de 60k +item.techreborn.part.nak_coolant_triple.name=Célula Refrigerante de SPA de 180k +item.techreborn.part.nak_coolant_six.name=Célula Refrigerante de SPA de 360k +item.techreborn.part.cupronickel_heating_coil.name=Bobina de Aquacimento de Cobre-níquel +item.techreborn.part.nichrome_heating_coil.name=Bobina de Aquacimento de Crômo-níquel +item.techreborn.part.kanthal_heating_coil.name=Bobina de Aquacimento de CromAFeR +item.techreborn.part.super_conductor.name=Supercondutor +item.techreborn.part.thorium_cell.name=Haste de Combustível (Tório) +item.techreborn.part.double_thorium_cell.name=Haste Dupla de Combustível (Tório) +item.techreborn.part.quad_thorium_cell.name=Haste Quadrupla de Combustível (Tório) +item.techreborn.part.plutonium_cell.name=Haste de Combustível (Plutônio) +item.techreborn.part.double_plutonium_cell.name=Haste Dupla de Combustível (Plutônio) +item.techreborn.part.quad_plutonium_cell.name=Haste Quadrupla de Combustível (Plutônio) +item.techreborn.part.iridium_neutron_reflector.name=Refletor de Neutrons de Irídio +item.techreborn.part.computer_monitor.name=Monitor de Computador +item.techreborn.part.machine_parts.name=Partes de Máquina +item.techreborn.part.neutron_reflector.name=Refletor de Neutrons +item.techreborn.part.thick_neutron_reflector.name=Refletor de Neutrons Grosso +item.techreborn.part.sap.name=Seiva +item.techreborn.part.rubber.name=Borracha +item.techreborn.part.scrap.name=Sucata +item.techreborn.part.electronic_circuit.name=Circuito Eletrônico +item.techreborn.part.advanced_circuit.name=Circuito Eletrônico Avançado +item.techreborn.part.coolant_simple.name=Célula Refrigerante de 10k +item.techreborn.part.coolant_triple.name=Célula Refrigerante de 30k +item.techreborn.part.coolant_six.name=Célula Refrigerante de 60k + +item.techreborn.frequencyTransmitter.name=Transmissor de Frequências + +#Tools +item.techreborn.rockcutter.name=Cortador de Rochas +item.techreborn.lithiumbatpack.name=Mochila-Bateria de Lítio +item.techreborn.lapotronpack.name=Mochila-Orbe Lapotrônica +item.techreborn.omniTool.name=Ferramenta Todo-Uso +item.techreborn.ironDrill.name=Broca de Aço +item.techreborn.diamondDrill.name=Broca de Diamante +item.techreborn.advancedDrill.name=Broca Avançada +item.techreborn.ironChainsaw.name=Motosserra de Aço +item.techreborn.diamondChainsaw.name=Motosserra de Diamante +item.techreborn.advancedChainsaw.name=Motosserra Avançada +item.techreborn.lapotronicorb.name=Orbe de Energia Lapotrônica +item.techreborn.cloakingdevice.name=Dispositivo de Camuflagem +item.techreborn.steelJackhammer.name=Martelo Hidráulico de Aço +item.techreborn.diamondJackhammer.name=Martelo Hidráulico de Diamante +item.techreborn.advancedJackhammer.name=Martelo Hidráulico Avançado + +item.bronzeSword.name=Espada de Bronze +item.bronzePickaxe.name=Picareta de Bronze +item.bronzeSpade.name=Pá de Bronze +item.bronzeAxe.name=Machado de Bronze +item.bronzeHoe.name=Enxada de Bronze +item.bronzeHelmet.name=Elmo de Bronze +item.bronzeChestplate.name=Armadura de Bronze +item.bronzeLeggings.name=Calças de Bronze +item.bronzeBoots.name=Botas de Bronze + +item.rubySword.name=Espada de Rubi +item.rubyPickaxe.name=Picareta de Rubi +item.rubySpade.name=Pá de Rubi +item.rubyAxe.name=Machado de Rubi +item.rubyHoe.name=Enxada de Rubi +item.rubyHelmet.name=Elmo de Rubi +item.rubyChestplate.name=Armadura de Rubi +item.rubyLeggings.name=Calças de Rubi +item.rubyBoots.name=Botas de Rubi + +item.sapphireSword.name=Espada de Safira +item.sapphirePickaxe.name=Picareta de Safira +item.sapphireSpade.name=Pá de Safira +item.sapphireAxe.name=Machado de Safira +item.sapphireHoe.name=Enxada de Safira +item.sapphireHelmet.name=Elmo de Safira +item.sapphireChestplate.name=Armadura de Safira +item.sapphireLeggings.name=Calças de Safira +item.sapphireBoots.name=Botas de Safira + +item.peridotSword.name=Espada de Peridoto +item.peridotPickaxe.name=Picareta de Peridoto +item.peridotSpade.name=Pá de Peridoto +item.peridotAxe.name=Machado de Peridoto +item.peridotHoe.name=Enxada de Peridoto +item.peridotHelmet.name=Elmo de Peridoto +item.peridotChestplate.name=Armadura de Peridoto +item.peridotLeggings.name=Calças de Peridoto +item.peridotBoots.name=Botas de Peridoto + +#Fluid +fluid.fluidberylium=Berílo +fluid.fluidcalcium=Cálcio +fluid.fluidcalciumcarbonate=Carbonato de Cálcio +fluid.fluidcarbon=Carbono +fluid.fluidcarbonfiber=Fibra de Carbono +fluid.fluidchlorite=Clorite +fluid.fluiddeuterium=Deutério +fluid.fluiddiesel=Diesel +fluid.fluidglyceryl=Glicerilo +fluid.fluidhelium=Hélio +fluid.fluidhelium3=Hélio3 +fluid.fluidheliumplasma=Plasma de Hélio +fluid.fluidhydrogen=Hidrogênio +fluid.fluidlithium=Lítio +fluid.fluidmercury=Mercúrio +fluid.fluidmethane=Metano +fluid.fluidnitrocarbon=Carbono Nitroso +fluid.fluidnitrocoalfuel=Combustível de Nitrogênio +fluid.fluidnitrodiesel=Diesel Nitroso +fluid.fluidnitrofuel=Combustível Nitroso +fluid.fluidnitrogen=Nitrogênio +fluid.fluidnitrogendioxide=Dióxido de Nitrogênio +fluid.fluidoil=Óleo +fluid.fluidpotassium=Potássio +fluid.fluidsilicon=Silicone +fluid.fluidsodium=Sódio +fluid.fluidsodiumSulfide=Sulfeto de Sódio +fluid.fluidSulfur=Enxofre +fluid.fluidsulfuricacid=Ácido Sulfúrico +fluid.fluidcompressedair=Ar Comprimido +fluid.fluidelectrolyzedwater=Água Eletrolizada +fluid.fluidsodiumpersulfate=Persulfato de Sódio +fluid.fluidtritium=Tritio +fluid.fluidwolframium=Wolframium + +#Items +item.techreborn.uuMatter.name=Matéria UU +item.techreborn.manual.name=Manual Tech Reborn +item.techreborn.debug.name=Ferramenta de Debug + +#Recipe Handlers +techreborn.recipe.alloysmelter=Receita de Fundidora de Ligas +techreborn.recipe.ironalloysmelter=Receita de Fundidora de Ligas de Ferro +techreborn.recipe.assemblingmachine=Receita de Máquina de Montagem +techreborn.recipe.blastfurnace=Receita de Fornalha Industrial +techreborn.recipe.centrifuge=Receita de Centrífuga +techreborn.recipe.grinder=Receita de Triturador Industrial +techreborn.recipe.industrialelectrolyzer=Receita de Eletrolizador Industrial +techreborn.recipe.industrialsawmill=Receita de Serraria Industrial +techreborn.recipe.lathe=Receita de Torneador +techreborn.recipe.platecuttingmachine=Receita de Máquina de Cortar Placas +techreborn.recipe.chemicalReactor=Receita de Reator Químico +techreborn.recipe.implosioncompressor=Receita de Compressor à Implosão +techreborn.recipe.distillationtower=Receita de Torre de Destilação + +#Message +techreborn.message.missingmultiblock=Estrutura Incompleta +techreborn.message.setTo=Marcado em +techreborn.message.in=em +techreborn.message.noCoordsSet=Nenhuma Coordenada +techreborn.message.coordsHaveBeen=As coordenadas foram +techreborn.message.cleared=Limpas +techreborn.message.detects=Detecta +techreborn.message.allPlayers=Todos os Players +techreborn.message.onlyOtherPlayers=Apenas Outros Players +techreborn.message.onlyYou=Apenas Você +techreborn.message.nanosaberActive=Ativo +techreborn.message.nanosaberActivate=Ativar +techreborn.message.nanosaberDeactivating=Desativando +techreborn.message.nanosaberInactive=Inactivo +techreborn.message.nanosaberEnergyErrorTo=Sem energia suficiente para +techreborn.message.nanosaberEnergyError=Sem energia suficiente: + +#Cables +Cable.copperCable.name=Cabo de Cobre +Cable.insulatedCopperCable.name=Cabo de Cobre Isolado +Cable.goldCable.name=Cabo de Ouro +Cable.insulatedGoldCable.name=Cabo de Ouro Isolado +Cable.doubleInsulatedGoldCable.name=Cabo de Ouro Duplamente Isolado +Cable.ironCable.name=Cabo de Ferro +Cable.copperCable.name=Cabo de Cobre +Cable.insulatedIronCable.name=Cabo de Ferro Isolado +Cable.doubleInsulatedIronCable.name=Cabo de de Ferro Duplamente Isolado +Cable.trippleInsulatedIronCable.name=Cabo de Ferro Triplamente Isolado +Cable.glassFiberCable.name=Cabo de Fibra de Vidro +Cable.tinCable.name=Cabo de Estanho + +desc.uninsulatedCable=Danifica Entidades! +desc.transfer=Transferência de Energia: +desc.tier=Nível: + +keys.techreborn.category=Categoria: TechReborn +keys.techreborn.config=Config + +# JEI Integration +techreborn.jei.recipe.start.cost=Começa aos: %s +techreborn.jei.recipe.running.cost=%s/t: %s +techreborn.jei.recipe.processing.time.1=Tempo: %s ticks +techreborn.jei.recipe.processing.time.2=(%s segundos) +jei.techreborn.scrapbox.name=Abrindo Caixas de Sucata +techreborn.desc.rubberSap=Para obter seiva, você precisa encontrar uma seringueira, ou obter uma muda de seringueira e fazê-la crescer. Depois de obter uma seringueira, procure por pequenas manchas amareladas na árvore. Se você não vir nenhuma, espere um pouco e, eventualmente, estes pontos de seiva amarelada aparecerão. Para colher a seiva, use um drenador no tronco. +techreborn.desc.scrapBox=Caixas de Sucata podem ser abertas simplesmente com as mãos, ou por ejetores. Isso mesmo! Basta jogar suas caixas de sucata em ejetores e lhes dar um sinal redstone, e boom! Item aleatório! +techreborn.desc.scrapBoxNoDispenser=Caixas de Sucata podem ser abertas com as mãos! + +techreborn.jei.category.alloy.furnace=Fundidora de Ligas +techreborn.jei.category.generator.gas=Gerador à Gás +techreborn.jei.category.generator.semifluid=Gerador à Semi-fluidos +techreborn.jei.category.generator.diesel=Gerador à Diesel +techreborn.jei.category.generator.thermal=Gerador Térmico +techreborn.jei.category.generator.plasma=Gerador à Plasma + +#Death Messages +death.attack.shock=%s foi Eletrocutado + + +#Entitys +entity.nuke.name=Bomba Nuke + +#Tooltips +tooltip.wip=WIP Em desenvolvimento +tooltip.upBroken=Atualizações NÃO funcionam! +tooltip.ingredient=Atualmente, apenas um ingrediente de fabricação + +#Advancements + +advancements.techreborn.root.desc=Agora que você achou um minério do Tech Reborn, você pode achar um drenador muito útil. +advancements.techreborn.treetap=Drenador +advancements.techreborn.treetap.desc=Agora que você fez seu drenador, você vai querer usá-lo na seiva de uma seringueira. +advancements.techreborn.sap=Seiva de Borracha +advancements.techreborn.sap.desc=Muito bem. Você agora tem uma seiva de borracha. Você agora vai querer queimá-la numa fornalha para conseguir borracha. diff --git a/src/main/resources/assets/techreborn/lang/zh_cn.lang b/src/main/resources/assets/techreborn/lang/zh_cn.lang index 1d3a9de23..ba34ce015 100644 --- a/src/main/resources/assets/techreborn/lang/zh_cn.lang +++ b/src/main/resources/assets/techreborn/lang/zh_cn.lang @@ -128,6 +128,7 @@ tile.techreborn:storage.nickel.name=镍块 tile.techreborn:storage.invar.name=殷钢块 tile.techreborn:storage.osmium.name=锇块 tile.techreborn:storage.iridium.name=铱块 +tile.techreborn:storage.bronze.name=青铜块 tile.techreborn:storage2.tungstensteel.name=钨钢块 tile.techreborn:storage2.lodestone.name=磁石块 tile.techreborn:storage2.tellurium.name=碲块 @@ -375,6 +376,7 @@ item.techreborn.dustsmall.diorite.name=小堆闪长岩粉 item.techreborn.dustsmall.granite.name=小堆花岗岩粉 item.techreborn.cell.name=空单元 +item.techreborn.cell.fluid.name=$fluid$单元 item.techreborn.rebattery.name=充电电池 item.techreborn.lithiumBattery.name=锂电池 item.techreborn.energyCrystal.name=能量水晶 diff --git a/src/main/resources/assets/techreborn/textures/gui/elements.png b/src/main/resources/assets/techreborn/textures/gui/elements.png new file mode 100644 index 000000000..71dd8f868 Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/gui/elements.png differ diff --git a/src/main/resources/assets/techreborn/textures/gui/gui_sheet.png b/src/main/resources/assets/techreborn/textures/gui/gui_sheet.png index 3e6b8473f..8d1f243c9 100644 Binary files a/src/main/resources/assets/techreborn/textures/gui/gui_sheet.png and b/src/main/resources/assets/techreborn/textures/gui/gui_sheet.png differ