diff --git a/build.gradle b/build.gradle index b794e2a6f..2df713910 100644 --- a/build.gradle +++ b/build.gradle @@ -13,11 +13,16 @@ buildscript { maven { url "https://plugins.gradle.org/m2/" } + maven { + name = "CB Repo" + url = "http://chickenbones.net/maven" + } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' classpath "gradle.plugin.net.minecrell:licenser:0.2.1" classpath 'de.undercouch:gradle-download-task:3.4.3' + classpath 'net.covers1624:GradleStuff:1.0-SNAPSHOT' } } @@ -26,6 +31,7 @@ apply plugin: 'maven' apply plugin: 'maven-publish' apply plugin: net.minecrell.gradle.licenser.Licenser apply plugin: 'de.undercouch.download' +apply plugin: 'net.covers1624.contained-deps' sourceCompatibility = 1.8 targetCompatibility = 1.8 @@ -36,17 +42,28 @@ repositories { name = "Modmuss50" url = "http://maven.modmuss50.me/" } + maven { + // JEI + name "JEI" + url "http://dvs1.progwml6.com/files/maven" + } } version = "3.0.0" +configurations { + shade + compile.extendsFrom shade +} + + def ENV = System.getenv() if (ENV.BUILD_NUMBER) { version = version + "." + "${System.getenv().BUILD_NUMBER}" } minecraft { - version = "1.12.2-14.23.4.2757" + version = "1.12.2-14.23.5.2768" mappings = "snapshot_20180720" replace "@MODVERSION@", project.version useDepAts = true @@ -65,6 +82,7 @@ dependencies { deobfCompile('RebornCore:RebornCore-1.12.2:+:universal') { transitive = false } + deobfCompile "mezz.jei:jei_1.12.2:+" } processResources @@ -101,16 +119,14 @@ task deobfJar(type: Jar) { } +containedDeps { + configuration = "shade" + tasks = "jar" +} + jar { exclude "**/*.psd" classifier = 'universal' - // configurations.shade.each { dep -> - // from(project.zipTree(dep)){ - // include 'ic2/api/' - // include 'forestry/api/fuels/' - // exclude 'META-INF', 'META-INF/**', '**/*.java' - // } - // } manifest { attributes 'FMLAT': 'techreborn_at.cfg' } @@ -186,12 +202,6 @@ publishing { artifact sourceJar { classifier "sources" } - - - //Removes all of the dependencies from the maven pom, fixes issues when other projects try to depend on tr - pom.withXml { - asNode().remove(asNode().get('dependencies')) - } } } repositories { @@ -434,4 +444,4 @@ String humanizeArg(String arg){ task copyToLib(type: Copy) { into "$buildDir/output/lib" from configurations.runtime -} \ No newline at end of file +} diff --git a/src/main/java/techreborn/TechReborn.java b/src/main/java/techreborn/TechReborn.java index d583121e6..36b3b1b8b 100644 --- a/src/main/java/techreborn/TechReborn.java +++ b/src/main/java/techreborn/TechReborn.java @@ -56,6 +56,9 @@ import reborncore.common.util.Torus; import techreborn.api.TechRebornAPI; import techreborn.client.GuiHandler; import techreborn.command.TechRebornDevCommand; +import techreborn.compat.CompatManager; +import techreborn.compat.ICompatModule; +import techreborn.config.ConfigTechReborn; import techreborn.entities.EntityNukePrimed; import techreborn.events.BlockBreakHandler; import techreborn.events.TRRecipeHandler; @@ -125,6 +128,10 @@ public class TechReborn { EntityRegistry.registerModEntity(new ResourceLocation("techreborn", "nuke"), EntityNukePrimed.class, "nuke", 0, INSTANCE, 160, 5, true); proxy.preInit(event); + + for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) { + compatModule.preInit(event); + } } @Mod.EventHandler @@ -134,6 +141,11 @@ public class TechReborn { MinecraftForge.EVENT_BUS.register(new ModLoot()); // Sounds ModSounds.init(); + + for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) { + compatModule.init(event); + } + // Client only init, needs to be done before parts system proxy.init(event); // WorldGen @@ -151,9 +163,12 @@ public class TechReborn { MinecraftForge.EVENT_BUS.register(new TRTickHandler()); MinecraftForge.EVENT_BUS.register(worldGen.retroGen); //Village stuff - VillagerRegistry.instance().registerVillageCreationHandler(new VillagePlantaionHandler()); - MapGenStructureIO.registerStructureComponent(VillageComponentRubberPlantaion.class, new ResourceLocation(MOD_ID, "rubberplantation").toString()); - ModLootTables.CHESTS_RUBBER_PLANTATION.toString(); //Done to make it load, then it will be read from disk + if (ConfigTechReborn.enableRubberTreePlantation) { + VillagerRegistry.instance().registerVillageCreationHandler(new VillagePlantaionHandler()); + MapGenStructureIO.registerStructureComponent(VillageComponentRubberPlantaion.class, new ResourceLocation(MOD_ID, "rubberplantation").toString()); + ModLootTables.CHESTS_RUBBER_PLANTATION.toString(); //Done to make it load, then it will be read from disk + } + // Scrapbox if (BehaviorDispenseScrapbox.dispenseScrapboxes) { BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(TRContent.SCRAP_BOX, new BehaviorDispenseScrapbox()); diff --git a/src/main/java/techreborn/client/container/IRightClickHandler.java b/src/main/java/techreborn/api/IC2Helper.java similarity index 73% rename from src/main/java/techreborn/client/container/IRightClickHandler.java rename to src/main/java/techreborn/api/IC2Helper.java index e845013a4..afd38dbdb 100644 --- a/src/main/java/techreborn/client/container/IRightClickHandler.java +++ b/src/main/java/techreborn/api/IC2Helper.java @@ -22,15 +22,21 @@ * SOFTWARE. */ -package techreborn.client.container; +package techreborn.api; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import techreborn.client.container.builder.BuiltContainer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; -/** - * Created by Mark on 12/04/2017. - */ -public interface IRightClickHandler { +import java.util.List; + +public interface IC2Helper { + + public void initDuplicates(); + + public boolean extractSap(EntityPlayer player, World world, BlockPos pos, EnumFacing side, IBlockState state, List stacks); - public boolean handleRightClick(int slotID, EntityPlayer player, BuiltContainer container); } diff --git a/src/main/java/techreborn/api/TechRebornAPI.java b/src/main/java/techreborn/api/TechRebornAPI.java index 92f61a0fc..d2a5dafb1 100644 --- a/src/main/java/techreborn/api/TechRebornAPI.java +++ b/src/main/java/techreborn/api/TechRebornAPI.java @@ -39,6 +39,8 @@ public final class TechRebornAPI { public static ISubItemRetriever subItemRetriever; + public static IC2Helper ic2Helper; + public static void addRollingOreMachinceRecipe(ResourceLocation resourceLocation, ItemStack output, Object... components) { RollingMachineRecipe.instance.addShapedOreRecipe(resourceLocation, output, components); } diff --git a/src/main/java/techreborn/api/recipe/BaseRecipe.java b/src/main/java/techreborn/api/recipe/BaseRecipe.java index 5e81366e0..47e43a109 100644 --- a/src/main/java/techreborn/api/recipe/BaseRecipe.java +++ b/src/main/java/techreborn/api/recipe/BaseRecipe.java @@ -137,7 +137,7 @@ public abstract class BaseRecipe implements IBaseRecipeType, Cloneable { throw new InvalidParameterException("input is invalid!"); } } - if (RecipeTranslator.getStackFromObject(inuput) == null) { + if (RecipeTranslator.getStackFromObject(inuput) == null || RecipeTranslator.getStackFromObject(inuput).isEmpty()) { throw new InvalidParameterException("Could not determin recipe input for " + inuput); } inputs.add(inuput); diff --git a/src/main/java/techreborn/blocks/BlockOre.java b/src/main/java/techreborn/blocks/BlockOre.java index 09bbae090..8d03dd65b 100644 --- a/src/main/java/techreborn/blocks/BlockOre.java +++ b/src/main/java/techreborn/blocks/BlockOre.java @@ -77,7 +77,7 @@ public class BlockOre extends Block { Block ore = state.getBlock(); Random random = new Random(); - // Secondary drop, like Yellow Garnet from Sphalerite ore added via event handler. + // Secondary drop, like Yellow Garnet from Sphalerite ore added via event handler. if (ore == TRContent.Ores.RUBY.block) { OreDrop ruby = new OreDrop(TRContent.Gems.RUBY.getStack(rubyMinQuatity), rubyMaxQuantity); drops.add(ruby.getDrops(fortune, random)); diff --git a/src/main/java/techreborn/blocks/cable/BlockCable.java b/src/main/java/techreborn/blocks/cable/BlockCable.java index b64e2bfaf..a52183ef1 100644 --- a/src/main/java/techreborn/blocks/cable/BlockCable.java +++ b/src/main/java/techreborn/blocks/cable/BlockCable.java @@ -126,7 +126,7 @@ public class BlockCable extends BlockContainer { @Nullable @Override public TileEntity createNewTileEntity(World worldIn, int meta) { - return new TileCable(); + return new TileCable(getStateFromMeta(meta).getValue(TYPE)); } // Block diff --git a/src/main/java/techreborn/client/GuiHandler.java b/src/main/java/techreborn/client/GuiHandler.java index 5942a0b1d..21d843f10 100644 --- a/src/main/java/techreborn/client/GuiHandler.java +++ b/src/main/java/techreborn/client/GuiHandler.java @@ -30,7 +30,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.IGuiHandler; import techreborn.client.container.ContainerDestructoPack; -import techreborn.client.container.IContainerProvider; +import reborncore.client.containerBuilder.IContainerProvider; import techreborn.client.gui.*; import techreborn.client.gui.GuiAutoCrafting; import techreborn.tiles.*; diff --git a/src/main/java/techreborn/client/IconSupplier.java b/src/main/java/techreborn/client/IconSupplier.java deleted file mode 100644 index b13bcceaa..000000000 --- a/src/main/java/techreborn/client/IconSupplier.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.event.TextureStitchEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public class IconSupplier { - public static String armour_head_name = "techreborn:gui/slot_sprites/armour_head"; - @SideOnly(Side.CLIENT) - public static TextureAtlasSprite armour_head; - - public static String armour_chest_name = "techreborn:gui/slot_sprites/armour_chest"; - @SideOnly(Side.CLIENT) - public static TextureAtlasSprite armour_chest; - - public static String armour_legs_name = "techreborn:gui/slot_sprites/armour_legs"; - @SideOnly(Side.CLIENT) - public static TextureAtlasSprite armour_legs; - - public static String armour_feet_name = "techreborn:gui/slot_sprites/armour_feet"; - @SideOnly(Side.CLIENT) - public static TextureAtlasSprite armour_feet; - - @SideOnly(Side.CLIENT) - @SubscribeEvent - public void preTextureStitch(TextureStitchEvent.Pre event) { - TextureMap map = event.getMap(); - armour_head = map.registerSprite(new ResourceLocation(armour_head_name)); - armour_chest = map.registerSprite(new ResourceLocation(armour_chest_name)); - armour_legs = map.registerSprite(new ResourceLocation(armour_legs_name)); - armour_feet = map.registerSprite(new ResourceLocation(armour_feet_name)); - } - -} diff --git a/src/main/java/techreborn/client/container/IContainerProvider.java b/src/main/java/techreborn/client/container/IContainerProvider.java deleted file mode 100644 index 51202625d..000000000 --- a/src/main/java/techreborn/client/container/IContainerProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.container; - -import net.minecraft.entity.player.EntityPlayer; -import techreborn.client.container.builder.BuiltContainer; - -public interface IContainerProvider { - BuiltContainer createContainer(EntityPlayer player); -} diff --git a/src/main/java/techreborn/client/container/builder/BuiltContainer.java b/src/main/java/techreborn/client/container/builder/BuiltContainer.java deleted file mode 100644 index d470499cf..000000000 --- a/src/main/java/techreborn/client/container/builder/BuiltContainer.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.container.builder; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.*; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.lang3.Range; -import org.apache.commons.lang3.tuple.MutableTriple; -import org.apache.commons.lang3.tuple.Pair; -import reborncore.common.tile.TileMachineBase; -import reborncore.common.util.ItemUtils; -import techreborn.client.container.IRightClickHandler; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.Consumer; -import java.util.function.IntConsumer; -import java.util.function.IntSupplier; -import java.util.function.Predicate; - -public class BuiltContainer extends Container { - - private final String name; - - private final Predicate canInteract; - private final List> playerSlotRanges; - private final List> tileSlotRanges; - - private final ArrayList> shortValues; - private final ArrayList> integerValues; - private List> craftEvents; - private Integer[] integerParts; - - private final TileMachineBase tile; - - public BuiltContainer(final String name, final Predicate canInteract, - final List> playerSlotRange, - final List> tileSlotRange, TileMachineBase tile) { - this.name = name; - - this.canInteract = canInteract; - - this.playerSlotRanges = playerSlotRange; - this.tileSlotRanges = tileSlotRange; - - this.shortValues = new ArrayList<>(); - this.integerValues = new ArrayList<>(); - - this.tile = tile; - } - - public void addShortSync(final List> syncables) { - - for (final Pair syncable : syncables) - this.shortValues.add(MutableTriple.of(syncable.getLeft(), syncable.getRight(), (short) 0)); - this.shortValues.trimToSize(); - } - - public void addIntegerSync(final List> syncables) { - - for (final Pair syncable : syncables) - this.integerValues.add(MutableTriple.of(syncable.getLeft(), syncable.getRight(), 0)); - this.integerValues.trimToSize(); - this.integerParts = new Integer[this.integerValues.size()]; - } - - public void addCraftEvents(final List> craftEvents) { - this.craftEvents = craftEvents; - } - - public void addSlot(final Slot slot) { - this.addSlotToContainer(slot); - } - - @Override - public boolean canInteractWith(final EntityPlayer playerIn) { - if(this.tile != null) { - return playerIn.getDistanceSq((double) tile.getPos().getX() + 0.5D, (double) tile.getPos().getY() + 0.5D, (double) tile.getPos().getZ() + 0.5D) <= 64.0D; - } else { - return this.canInteract.test(playerIn); // < - } - } - - @Override - public final void onCraftMatrixChanged(final IInventory inv) { - if (!this.craftEvents.isEmpty()) - this.craftEvents.forEach(consumer -> consumer.accept((InventoryCrafting) inv)); - } - - @Override - public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) { - if (dragType == 1 && slotId > 0 && slotId < 1000) { - Slot slot = this.inventorySlots.get(slotId); - if (slot instanceof IRightClickHandler) { - if (((IRightClickHandler) slot).handleRightClick(slot.getSlotIndex(), player, this)) { - return ItemStack.EMPTY; - } - } - } - return super.slotClick(slotId, dragType, clickTypeIn, player); - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - - for (final IContainerListener listener : this.listeners) { - - int i = 0; - if (!this.shortValues.isEmpty()) - for (final MutableTriple value : this.shortValues) { - final short supplied = (short) value.getLeft().getAsInt(); - if (supplied != value.getRight()) { - - listener.sendWindowProperty(this, i, supplied); - value.setRight(supplied); - } - i++; - } - - if (!this.integerValues.isEmpty()) - for (final MutableTriple value : this.integerValues) { - final int supplied = value.getLeft().getAsInt(); - if (supplied != value.getRight()) { - - listener.sendWindowProperty(this, i, supplied >> 16); - listener.sendWindowProperty(this, i + 1, (short) (supplied & 0xFFFF)); - value.setRight(supplied); - } - i += 2; - } - } - } - - @Override - public void addListener(final IContainerListener listener) { - super.addListener(listener); - - int i = 0; - if (!this.shortValues.isEmpty()) - for (final MutableTriple value : this.shortValues) { - final short supplied = (short) value.getLeft().getAsInt(); - - listener.sendWindowProperty(this, i, supplied); - value.setRight(supplied); - i++; - } - - if (!this.integerValues.isEmpty()) - for (final MutableTriple value : this.integerValues) { - final int supplied = value.getLeft().getAsInt(); - - listener.sendWindowProperty(this, i, supplied >> 16); - listener.sendWindowProperty(this, i + 1, (short) (supplied & 0xFFFF)); - value.setRight(supplied); - i += 2; - } - - } - - @SideOnly(Side.CLIENT) - @Override - public void updateProgressBar(final int id, final int value) { - - if (id < this.shortValues.size()) { - this.shortValues.get(id).getMiddle().accept((short) value); - this.shortValues.get(id).setRight((short) value); - } else if (id - this.shortValues.size() < this.integerValues.size() * 2) { - - if ((id - this.shortValues.size()) % 2 == 0) - this.integerParts[(id - this.shortValues.size()) / 2] = value; - else { - this.integerValues.get((id - this.shortValues.size()) / 2).getMiddle().accept( - (this.integerParts[(id - this.shortValues.size()) / 2] & 0xFFFF) << 16 | value & 0xFFFF); - } - } - } - - @Override - public ItemStack transferStackInSlot(final EntityPlayer player, final int index) { - - ItemStack originalStack = ItemStack.EMPTY; - - final Slot slot = this.inventorySlots.get(index); - - if (slot != null && slot.getHasStack()) { - - final ItemStack stackInSlot = slot.getStack(); - originalStack = stackInSlot.copy(); - - boolean shifted = false; - - for (final Range range : this.playerSlotRanges) - if (range.contains(index)) { - - if (this.shiftToTile(stackInSlot)) - shifted = true; - break; - } - - if (!shifted) - for (final Range range : this.tileSlotRanges) - if (range.contains(index)) { - if (this.shiftToPlayer(stackInSlot)) - shifted = true; - break; - } - - slot.onSlotChange(stackInSlot, originalStack); - if (stackInSlot.getCount() <= 0) - slot.putStack(ItemStack.EMPTY); - else - slot.onSlotChanged(); - if (stackInSlot.getCount() == originalStack.getCount()) - return ItemStack.EMPTY; - slot.onTake(player, stackInSlot); - } - return originalStack; - - - } - - protected boolean shiftItemStack(final ItemStack stackToShift, final int start, final int end) { - boolean changed = false; - if (stackToShift.isStackable()) { - for (int slotIndex = start; stackToShift.getCount() > 0 && slotIndex < end; slotIndex++) { - final Slot slot = this.inventorySlots.get(slotIndex); - final ItemStack stackInSlot = slot.getStack(); - if (!stackInSlot.isEmpty() && ItemUtils.isItemEqual(stackInSlot, stackToShift, true, true) - && slot.isItemValid(stackToShift)) { - final int resultingStackSize = stackInSlot.getCount() + stackToShift.getCount(); - final int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit()); - if (resultingStackSize <= max) { - stackToShift.setCount(0); - stackInSlot.setCount(resultingStackSize); - slot.onSlotChanged(); - changed = true; - } else if (stackInSlot.getCount() < max) { - stackToShift.shrink(max - stackInSlot.getCount()); - stackInSlot.setCount(max); - slot.onSlotChanged(); - changed = true; - } - } - } - } - if (stackToShift.getCount() > 0) { - for (int slotIndex = start; stackToShift.getCount() > 0 && slotIndex < end; slotIndex++) { - final Slot slot = this.inventorySlots.get(slotIndex); - ItemStack stackInSlot = slot.getStack(); - if (stackInSlot.isEmpty() && slot.isItemValid(stackToShift)) { - final int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit()); - stackInSlot = stackToShift.copy(); - stackInSlot.setCount(Math.min(stackToShift.getCount(), max)); - stackToShift.shrink(stackInSlot.getCount()); - slot.putStack(stackInSlot); - slot.onSlotChanged(); - changed = true; - } - } - } - return changed; - } - - private boolean shiftToTile(final ItemStack stackToShift) { - for (final Range range : this.tileSlotRanges) - if (this.shiftItemStack(stackToShift, range.getMinimum(), range.getMaximum() + 1)) - return true; - return false; - } - - private boolean shiftToPlayer(final ItemStack stackToShift) { - for (final Range range : this.playerSlotRanges) - if (this.shiftItemStack(stackToShift, range.getMinimum(), range.getMaximum() + 1)) - return true; - return false; - } - - public String getName() { - return this.name; - } -} diff --git a/src/main/java/techreborn/client/container/builder/ContainerBuilder.java b/src/main/java/techreborn/client/container/builder/ContainerBuilder.java deleted file mode 100644 index 5445b8169..000000000 --- a/src/main/java/techreborn/client/container/builder/ContainerBuilder.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.container.builder; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.inventory.Slot; -import org.apache.commons.lang3.Range; -import org.apache.commons.lang3.tuple.Pair; -import reborncore.common.tile.TileMachineBase; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.Consumer; -import java.util.function.IntConsumer; -import java.util.function.IntSupplier; -import java.util.function.Predicate; - -public class ContainerBuilder { - - private final String name; - - private Predicate canInteract = player -> true; - - final List slots; - final List> playerInventoryRanges, tileInventoryRanges; - - final List> shortValues; - final List> integerValues; - - final List> craftEvents; - - public ContainerBuilder(final String name) { - - this.name = name; - - this.slots = new ArrayList<>(); - this.playerInventoryRanges = new ArrayList<>(); - this.tileInventoryRanges = new ArrayList<>(); - - this.shortValues = new ArrayList<>(); - this.integerValues = new ArrayList<>(); - - this.craftEvents = new ArrayList<>(); - } - - public ContainerBuilder interact(final Predicate canInteract) { - this.canInteract = canInteract; - return this; - } - - public ContainerPlayerInventoryBuilder player(final InventoryPlayer player) { - return new ContainerPlayerInventoryBuilder(this, player); - } - - public ContainerTileInventoryBuilder tile(final TileMachineBase tile) { - return new ContainerTileInventoryBuilder(this, tile); - } - - void addPlayerInventoryRange(final Range range) { - this.playerInventoryRanges.add(range); - } - - void addTileInventoryRange(final Range range) { - this.tileInventoryRanges.add(range); - } - - public BuiltContainer create(final TileMachineBase tile) { - final BuiltContainer built = new BuiltContainer(this.name, this.canInteract, - this.playerInventoryRanges, - this.tileInventoryRanges, tile); - if (!this.shortValues.isEmpty()) - built.addShortSync(this.shortValues); - if (!this.integerValues.isEmpty()) - built.addIntegerSync(this.integerValues); - if (!this.craftEvents.isEmpty()) - built.addCraftEvents(this.craftEvents); - - this.slots.forEach(built::addSlot); - - this.slots.clear(); - return built; - } -} diff --git a/src/main/java/techreborn/client/container/builder/ContainerPlayerInventoryBuilder.java b/src/main/java/techreborn/client/container/builder/ContainerPlayerInventoryBuilder.java deleted file mode 100644 index c84acda5b..000000000 --- a/src/main/java/techreborn/client/container/builder/ContainerPlayerInventoryBuilder.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.container.builder; - -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.EntityEquipmentSlot; -import net.minecraft.inventory.Slot; -import net.minecraftforge.items.wrapper.InvWrapper; -import org.apache.commons.lang3.Range; -import techreborn.client.IconSupplier; -import techreborn.client.container.builder.slot.SpriteSlot; - -public final class ContainerPlayerInventoryBuilder { - - private final InventoryPlayer player; - private final ContainerBuilder parent; - private Range main; - private Range hotbar; - private Range armor; - - ContainerPlayerInventoryBuilder(final ContainerBuilder parent, final InventoryPlayer player) { - this.player = player; - this.parent = parent; - } - - public ContainerPlayerInventoryBuilder inventory(final int xStart, final int yStart) { - final int startIndex = this.parent.slots.size(); - for (int i = 0; i < 3; ++i) - for (int j = 0; j < 9; ++j) - this.parent.slots.add(new Slot(this.player, j + i * 9 + 9, xStart + j * 18, yStart + i * 18)); - this.main = Range.between(startIndex, this.parent.slots.size() - 1); - return this; - } - - public ContainerPlayerInventoryBuilder hotbar(final int xStart, final int yStart) { - final int startIndex = this.parent.slots.size(); - for (int i = 0; i < 9; ++i) - this.parent.slots.add(new Slot(this.player, i, xStart + i * 18, yStart)); - this.hotbar = Range.between(startIndex, this.parent.slots.size() - 1); - return this; - } - - public ContainerPlayerInventoryBuilder inventory() { - return this.inventory(8, 94); - } - - public ContainerPlayerInventoryBuilder hotbar() { - return this.hotbar(8, 152); - } - - public ContainerPlayerArmorInventoryBuilder armor() { - return new ContainerPlayerArmorInventoryBuilder(this); - } - - public ContainerBuilder addInventory() { - if (this.hotbar != null) - this.parent.addPlayerInventoryRange(this.hotbar); - if (this.main != null) - this.parent.addPlayerInventoryRange(this.main); - if (this.armor != null) - this.parent.addTileInventoryRange(this.armor); - - return this.parent; - } - - public static final class ContainerPlayerArmorInventoryBuilder { - private final ContainerPlayerInventoryBuilder parent; - private final int startIndex; - - public ContainerPlayerArmorInventoryBuilder(final ContainerPlayerInventoryBuilder parent) { - this.parent = parent; - this.startIndex = parent.parent.slots.size(); - } - - private ContainerPlayerArmorInventoryBuilder armor(final int index, final int xStart, final int yStart, - final EntityEquipmentSlot slotType, final String sprite) { - this.parent.parent.slots.add(new SpriteSlot(new InvWrapper(this.parent.player), index, xStart, yStart, sprite, 1) - .setFilter(stack -> stack.getItem().isValidArmor(stack, slotType, this.parent.player.player))); - return this; - } - - public ContainerPlayerArmorInventoryBuilder helmet(final int xStart, final int yStart) { - return this.armor(this.parent.player.getSizeInventory() - 2, xStart, yStart, EntityEquipmentSlot.HEAD, IconSupplier.armour_head_name); - } - - public ContainerPlayerArmorInventoryBuilder chestplate(final int xStart, final int yStart) { - return this.armor(this.parent.player.getSizeInventory() - 3, xStart, yStart, EntityEquipmentSlot.CHEST, IconSupplier.armour_chest_name); - } - - public ContainerPlayerArmorInventoryBuilder leggings(final int xStart, final int yStart) { - return this.armor(this.parent.player.getSizeInventory() - 4, xStart, yStart, EntityEquipmentSlot.LEGS, IconSupplier.armour_legs_name); - } - - public ContainerPlayerArmorInventoryBuilder boots(final int xStart, final int yStart) { - return this.armor(this.parent.player.getSizeInventory() - 5, xStart, yStart, EntityEquipmentSlot.FEET, IconSupplier.armour_feet_name); - } - - public ContainerPlayerArmorInventoryBuilder complete(final int xStart, final int yStart) { - return this.helmet(xStart, yStart).chestplate(xStart, yStart + 18).leggings(xStart, yStart + 18 + 18) - .boots(xStart, yStart + 18 + 18 + 18); - } - - public ContainerPlayerInventoryBuilder addArmor() { - this.parent.armor = Range.between(this.startIndex, this.parent.parent.slots.size() - 1); - return this.parent; - } - } -} \ No newline at end of file diff --git a/src/main/java/techreborn/client/container/builder/ContainerTileInventoryBuilder.java b/src/main/java/techreborn/client/container/builder/ContainerTileInventoryBuilder.java deleted file mode 100644 index 7ee948350..000000000 --- a/src/main/java/techreborn/client/container/builder/ContainerTileInventoryBuilder.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.container.builder; - -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.energy.CapabilityEnergy; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; -import org.apache.commons.lang3.Range; -import org.apache.commons.lang3.Validate; -import org.apache.commons.lang3.tuple.Pair; -import reborncore.api.recipe.IRecipeCrafterProvider; -import reborncore.api.tile.IUpgradeable; -import reborncore.client.gui.slots.BaseSlot; -import reborncore.client.gui.slots.SlotFake; -import reborncore.client.gui.slots.SlotOutput; -import reborncore.common.powerSystem.TilePowerAcceptor; -import reborncore.common.tile.TileMachineBase; -import techreborn.TechReborn; -import techreborn.client.container.builder.slot.FilteredSlot; -import techreborn.client.container.builder.slot.FurnaceFuelSlot; -import techreborn.client.container.builder.slot.UpgradeSlot; - -import java.util.function.Consumer; -import java.util.function.IntConsumer; -import java.util.function.IntSupplier; -import java.util.function.Predicate; - -public class ContainerTileInventoryBuilder { - - private final TileMachineBase tile; - private final ContainerBuilder parent; - private final int rangeStart; - - ContainerTileInventoryBuilder(final ContainerBuilder parent, final TileMachineBase tile) { - this.tile = tile; - this.parent = parent; - this.rangeStart = parent.slots.size(); - //Ensure that the tile has an inv - Validate.isTrue(tile.getInventoryForTile().isPresent()); - if (tile.canBeUpgraded()) { - upgradeSlots(tile); - } - } - - public ContainerTileInventoryBuilder slot(final int index, final int x, final int y) { - this.parent.slots.add(new BaseSlot(this.tile.getInventoryForTile().get(), index, x, y)); - return this; - } - - public ContainerTileInventoryBuilder outputSlot(final int index, final int x, final int y) { - this.parent.slots.add(new SlotOutput(this.tile.getInventoryForTile().get(), index, x, y)); - return this; - } - - public ContainerTileInventoryBuilder fakeSlot(final int index, final int x, final int y) { - this.parent.slots.add(new SlotFake(this.tile.getInventoryForTile().get(), index, x, y, false, false, Integer.MAX_VALUE)); - return this; - } - - public ContainerTileInventoryBuilder filterSlot(final int index, final int x, final int y, - final Predicate filter) { - this.parent.slots.add(new FilteredSlot(this.tile.getInventoryForTile().get(), index, x, y).setFilter(filter)); - return this; - } - - public ContainerTileInventoryBuilder energySlot(final int index, final int x, final int y) { - this.parent.slots.add(new FilteredSlot(this.tile.getInventoryForTile().get(), index, x, y) - .setFilter(stack -> stack.hasCapability(CapabilityEnergy.ENERGY, EnumFacing.UP))); - return this; - } - - public ContainerTileInventoryBuilder fluidSlot(final int index, final int x, final int y) { - this.parent.slots.add(new FilteredSlot(this.tile.getInventoryForTile().get(), index, x, y).setFilter( - stack -> stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, EnumFacing.UP))); - return this; - } - - public ContainerTileInventoryBuilder fuelSlot(final int index, final int x, final int y) { - this.parent.slots.add(new FurnaceFuelSlot(this.tile.getInventoryForTile().get(), index, x, y)); - return this; - } - - private ContainerTileInventoryBuilder upgradeSlots(IUpgradeable upgradeable) { - if (upgradeable.canBeUpgraded()) { - for (int i = 0; i < upgradeable.getUpgradeSlotCount(); i++) { - this.parent.slots.add(new UpgradeSlot(upgradeable.getUpgradeInvetory(), i, -19, i * 18 + 12)); - } - } - return this; - } - - /** - * @param supplier The supplier must supply a variable holding inside a Short, it - * will be truncated by force. - * @param setter The setter to call when the variable has been updated. - * @return ContainerTileInventoryBuilder Inventory which will do the sync - */ - public ContainerTileInventoryBuilder syncShortValue(final IntSupplier supplier, final IntConsumer setter) { - this.parent.shortValues.add(Pair.of(supplier, setter)); - return this; - } - - /** - * @param supplier The supplier it can supply a variable holding in an Integer it - * will be split inside multiples shorts. - * @param setter The setter to call when the variable has been updated. - * @return ContainerTileInventoryBuilder Inventory which will do the sync - */ - public ContainerTileInventoryBuilder syncIntegerValue(final IntSupplier supplier, final IntConsumer setter) { - this.parent.integerValues.add(Pair.of(supplier, setter)); - return this; - } - - public ContainerTileInventoryBuilder syncEnergyValue() { - if (this.tile instanceof TilePowerAcceptor) - return this.syncIntegerValue(() -> (int) ((TilePowerAcceptor) this.tile).getEnergy(), - ((TilePowerAcceptor) this.tile)::setEnergy) - .syncIntegerValue(() -> (int) ((TilePowerAcceptor) this.tile).extraPowerStoage, - ((TilePowerAcceptor) this.tile)::setExtraPowerStoage) - .syncIntegerValue(() -> (int) ((TilePowerAcceptor) this.tile).getPowerChange(), - ((TilePowerAcceptor) this.tile)::setPowerChange); - TechReborn.LOGGER.error(this.tile + " is not an instance of TilePowerAcceptor! Energy cannot be synced."); - return this; - } - - public ContainerTileInventoryBuilder syncCrafterValue() { - if (this.tile instanceof IRecipeCrafterProvider) - return this - .syncIntegerValue(() -> ((IRecipeCrafterProvider) this.tile).getRecipeCrafter().currentTickTime, - (currentTickTime) -> ((IRecipeCrafterProvider) this.tile) - .getRecipeCrafter().currentTickTime = currentTickTime) - .syncIntegerValue(() -> ((IRecipeCrafterProvider) this.tile).getRecipeCrafter().currentNeededTicks, - (currentNeededTicks) -> ((IRecipeCrafterProvider) this.tile) - .getRecipeCrafter().currentNeededTicks = currentNeededTicks); - TechReborn.LOGGER - .error(this.tile + " is not an instance of IRecipeCrafterProvider! Craft progress cannot be synced."); - return this; - } - - public ContainerTileInventoryBuilder onCraft(final Consumer onCraft) { - this.parent.craftEvents.add(onCraft); - return this; - } - - public ContainerBuilder addInventory() { - this.parent.tileInventoryRanges.add(Range.between(this.rangeStart, this.parent.slots.size() - 1)); - return this.parent; - } -} diff --git a/src/main/java/techreborn/client/container/builder/slot/FilteredSlot.java b/src/main/java/techreborn/client/container/builder/slot/FilteredSlot.java deleted file mode 100644 index 7df050f9a..000000000 --- a/src/main/java/techreborn/client/container/builder/slot/FilteredSlot.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.container.builder.slot; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.items.IItemHandler; -import reborncore.client.gui.slots.BaseSlot; - -import java.util.function.Predicate; - -public class FilteredSlot extends BaseSlot { - - private Predicate filter; - private int stackLimit = 64; - - public FilteredSlot(final IItemHandler inventory, final int index, final int xPosition, final int yPosition) { - super(inventory, index, xPosition, yPosition); - } - - public FilteredSlot(final IItemHandler inventory, final int index, final int xPosition, final int yPosition, int stackLimit) { - super(inventory, index, xPosition, yPosition); - this.stackLimit = stackLimit; - } - - public FilteredSlot setFilter(final Predicate filter) { - this.filter = filter; - return this; - } - - @Override - public boolean isItemValid(final ItemStack stack) { - try { - return this.filter.test(stack); - } catch (NullPointerException e) { - return true; - } - } - - @Override - public int getSlotStackLimit() { - return stackLimit; - } -} diff --git a/src/main/java/techreborn/client/container/builder/slot/SpriteSlot.java b/src/main/java/techreborn/client/container/builder/slot/SpriteSlot.java deleted file mode 100644 index 75e9c9cd1..000000000 --- a/src/main/java/techreborn/client/container/builder/slot/SpriteSlot.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.container.builder.slot; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import net.minecraftforge.items.IItemHandler; - -import javax.annotation.Nullable; - -public class SpriteSlot extends FilteredSlot { - - private final String spriteName; - int stacksize; - - public SpriteSlot(final IItemHandler inventory, final int index, final int xPosition, final int yPosition, final String sprite, final int stacksize) { - super(inventory, index, xPosition, yPosition); - this.spriteName = sprite; - this.stacksize = stacksize; - } - - public SpriteSlot(final IItemHandler inventory, final int index, final int xPosition, final int yPosition, final String sprite) { - this(inventory, index, xPosition, yPosition, sprite, 64); - } - - @Override - public int getSlotStackLimit() { - return this.stacksize; - } - - @Override - @Nullable - @SideOnly(Side.CLIENT) - public String getSlotTexture() { - return this.spriteName; - } -} diff --git a/src/main/java/techreborn/client/container/builder/slot/UpgradeSlot.java b/src/main/java/techreborn/client/container/builder/slot/UpgradeSlot.java deleted file mode 100644 index dfec904c3..000000000 --- a/src/main/java/techreborn/client/container/builder/slot/UpgradeSlot.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.container.builder.slot; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.items.IItemHandler; -import reborncore.api.tile.IUpgrade; -import reborncore.client.gui.slots.BaseSlot; - -public class UpgradeSlot extends BaseSlot { - - public UpgradeSlot(final IItemHandler inventory, final int index, final int xPosition, final int yPosition) { - super(inventory, index, xPosition, yPosition); - } - - @Override - public boolean isItemValid(final ItemStack stack) { - return stack.getItem() instanceof IUpgrade; - } - - @Override - public int getSlotStackLimit() { - return 1; - } -} diff --git a/src/main/java/techreborn/client/gui/GuiAESU.java b/src/main/java/techreborn/client/gui/GuiAESU.java index 2c7d16e64..b8f4d6be6 100644 --- a/src/main/java/techreborn/client/gui/GuiAESU.java +++ b/src/main/java/techreborn/client/gui/GuiAESU.java @@ -27,9 +27,10 @@ package techreborn.client.gui; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; +import reborncore.client.gui.builder.GuiBase; import reborncore.common.network.NetworkManager; import reborncore.common.powerSystem.PowerSystem; -import techreborn.client.gui.widget.GuiButtonUpDown; +import reborncore.client.gui.builder.widget.GuiButtonUpDown; import techreborn.packets.PacketAesu; import techreborn.tiles.storage.TileAdjustableSU; @@ -48,7 +49,7 @@ public class GuiAESU extends GuiBase { protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - + this.drawSlot(62, 45, layer); this.drawSlot(98, 45, layer); this.drawArmourSlots(8, 18, layer); @@ -64,13 +65,13 @@ public class GuiAESU extends GuiBase { if(GuiBase.slotConfigType == SlotConfigType.NONE){ GlStateManager.pushMatrix(); GlStateManager.scale(0.6, 0.6, 1); - this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getEnergy()) + "/" - + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getMaxPower()) + " " + drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) tile.getEnergy()) + "/" + + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) 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); + builder.drawMultiEnergyBar(this, 81, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); buttonList.add(new GuiButtonUpDown(300, 121, 79, this, layer)); buttonList.add(new GuiButtonUpDown(301, 121 + 12, 79, this, layer)); diff --git a/src/main/java/techreborn/client/gui/GuiAlloyFurnace.java b/src/main/java/techreborn/client/gui/GuiAlloyFurnace.java index 04a981de4..3debc8f17 100644 --- a/src/main/java/techreborn/client/gui/GuiAlloyFurnace.java +++ b/src/main/java/techreborn/client/gui/GuiAlloyFurnace.java @@ -64,7 +64,7 @@ public class GuiAlloyFurnace extends GuiContainer { @Override protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) { - final String name = I18n.format("tile.techreborn:iron_alloy_furnace.name"); + final String name = I18n.format("tile.techreborn.iron_alloy_furnace.name"); this.fontRenderer.drawString(name, this.xSize / 2 - this.fontRenderer.getStringWidth(name) / 2, 6, 4210752); this.fontRenderer.drawString(I18n.format("container.inventory", new Object[0]), 8, diff --git a/src/main/java/techreborn/client/gui/GuiAlloySmelter.java b/src/main/java/techreborn/client/gui/GuiAlloySmelter.java index 59ef75ff8..e74dc97b1 100644 --- a/src/main/java/techreborn/client/gui/GuiAlloySmelter.java +++ b/src/main/java/techreborn/client/gui/GuiAlloySmelter.java @@ -42,13 +42,13 @@ public class GuiAlloySmelter extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); - this.drawSlot(34, 47, layer); - this.drawSlot(126, 47, layer); - this.drawOutputSlot(80, 47, layer); + drawSlot(34, 47, layer); + drawSlot(126, 47, layer); + drawOutputSlot(80, 47, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override @@ -56,8 +56,8 @@ public class GuiAlloySmelter extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, TRBuilder.ProgressDirection.LEFT, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, TRBuilder.ProgressDirection.LEFT, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiAssemblingMachine.java b/src/main/java/techreborn/client/gui/GuiAssemblingMachine.java index 00f6a6408..038f998e0 100644 --- a/src/main/java/techreborn/client/gui/GuiAssemblingMachine.java +++ b/src/main/java/techreborn/client/gui/GuiAssemblingMachine.java @@ -26,6 +26,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; import techreborn.tiles.machine.tier1.TileAssemblingMachine; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; public class GuiAssemblingMachine extends GuiBase { @@ -42,15 +44,15 @@ public class GuiAssemblingMachine extends GuiBase { final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; // Battery slot - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); // Input slots - this.drawSlot(55, 35, layer); - this.drawSlot(55, 55, layer); + drawSlot(55, 35, layer); + drawSlot(55, 55, layer); - this.drawOutputSlot(101, 45, layer); + drawOutputSlot(101, 45, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override @@ -58,7 +60,7 @@ public class GuiAssemblingMachine extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiAutoCrafting.java b/src/main/java/techreborn/client/gui/GuiAutoCrafting.java index 94d09deb9..48e5d78aa 100644 --- a/src/main/java/techreborn/client/gui/GuiAutoCrafting.java +++ b/src/main/java/techreborn/client/gui/GuiAutoCrafting.java @@ -32,6 +32,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.ResourceLocation; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import reborncore.common.network.NetworkManager; import techreborn.packets.PacketAutoCraftingTableLock; import techreborn.tiles.machine.tier1.TileAutoCraftingTable; @@ -85,8 +87,8 @@ public class GuiAutoCrafting extends GuiBase { renderItemStack(recipe.getRecipeOutput(), 95, 42); } final Layer layer = Layer.FOREGROUND; - this.builder.drawMultiEnergyBar(this, 9, 26, (int) this.tileAutoCraftingTable.getEnergy(), (int) this.tileAutoCraftingTable.getMaxPower(), mouseX, mouseY, 0, layer); - this.builder.drawProgressBar(this, tileAutoCraftingTable.getProgress(), tileAutoCraftingTable.getMaxProgress(), 120, 44, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 9, 26, (int) tileAutoCraftingTable.getEnergy(), (int) tileAutoCraftingTable.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tileAutoCraftingTable.getProgress(), tileAutoCraftingTable.getMaxProgress(), 120, 44, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); } @Override @@ -102,12 +104,12 @@ public class GuiAutoCrafting extends GuiBase { drawOutputSlot(95, 42, layer); drawString("Inventory", 8, 82, 4210752, layer); - this.builder.drawLockButton(this, 145, 4, mouseX, mouseY, layer, tileAutoCraftingTable.locked); + builder.drawLockButton(this, 145, 4, mouseX, mouseY, layer, tileAutoCraftingTable.locked); } @Override protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { - if (this.builder.isInRect(145 + getGuiLeft(), 4 + getGuiTop(), 20, 12, mouseX, mouseY)) { + if (builder.isInRect(145 + getGuiLeft(), 4 + getGuiTop(), 20, 12, mouseX, mouseY)) { NetworkManager.sendToServer(new PacketAutoCraftingTableLock(tileAutoCraftingTable, !tileAutoCraftingTable.locked)); return; } diff --git a/src/main/java/techreborn/client/gui/GuiBase.java b/src/main/java/techreborn/client/gui/GuiBase.java deleted file mode 100644 index 110494887..000000000 --- a/src/main/java/techreborn/client/gui/GuiBase.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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; - -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.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import org.lwjgl.input.Keyboard; -import reborncore.api.tile.IUpgradeable; -import reborncore.common.tile.TileMachineBase; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.gui.slot.GuiFluidConfiguration; -import techreborn.client.gui.slot.GuiSlotConfiguration; -import techreborn.client.gui.widget.GuiButtonPowerBar; -import techreborn.init.TRContent; -import techreborn.items.DynamicCell; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Prospector - */ -public class GuiBase extends GuiContainer { - - public int xSize = 176; - public int ySize = 176; - public TRBuilder builder = new TRBuilder(); - public TileEntity tile; - public BuiltContainer container; - public static SlotConfigType slotConfigType = SlotConfigType.NONE; - - public boolean upgrades; - - public GuiBase(EntityPlayer player, TileEntity tile, BuiltContainer container) { - super(container); - this.tile = tile; - this.container = container; - slotConfigType = SlotConfigType.NONE; - } - - protected void drawSlot(int x, int y, Layer layer) { - if (layer == Layer.BACKGROUND) { - x += guiLeft; - y += guiTop; - } - builder.drawSlot(this, x - 1, y - 1); - } - - protected void drawScrapSlot(int x, int y, Layer layer) { - if (layer == Layer.BACKGROUND) { - x += guiLeft; - y += guiTop; - } - builder.drawScrapSlot(this, x - 1, y - 1); - } - - protected void drawOutputSlotBar(int x, int y, int count, Layer layer) { - if (layer == Layer.BACKGROUND) { - x += guiLeft; - y += guiTop; - } - builder.drawOutputSlotBar(this, x - 4, y - 4, count); - } - - protected void drawArmourSlots(int x, int y, Layer layer) { - if (layer == Layer.BACKGROUND) { - x += guiLeft; - y += guiTop; - } - builder.drawSlot(this, x - 1, y - 1); - builder.drawSlot(this, x - 1, y - 1 + 18); - builder.drawSlot(this, x - 1, y - 1 + 18 + 18); - builder.drawSlot(this, x - 1, y - 1 + 18 + 18 + 18); - } - - protected void drawOutputSlot(int x, int y, Layer layer) { - if (layer == Layer.BACKGROUND) { - x += guiLeft; - y += guiTop; - } - builder.drawOutputSlot(this, x - 5, y - 5); - } - - protected void drawSelectedStack(int x, int y, Layer layer) { - if (layer == Layer.BACKGROUND) { - x += guiLeft; - y += guiTop; - } - builder.drawSelectedStack(this, x, y); - } - - @Override - public void initGui() { - super.initGui(); - GuiSlotConfiguration.init(this); - if(getMachine().getTank() != null && getMachine().showTankConfig()){ - GuiFluidConfiguration.init(this); - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int mouseX, int mouseY) { - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - builder.drawDefaultBackground(this, guiLeft, guiTop, xSize, ySize); - if (drawPlayerSlots()) { - builder.drawPlayerSlots(this, guiLeft + xSize / 2, guiTop + 93, true); - } - if (tryAddUpgrades() && tile instanceof IUpgradeable) { - IUpgradeable upgradeable = (IUpgradeable) tile; - if (upgradeable.canBeUpgraded()) { - builder.drawUpgrades(this, upgradeable, guiLeft, guiTop); - upgrades = true; - } - } - if(getMachine().hasSlotConfig()){ - builder.drawSlotTab(this, guiLeft, guiTop, mouseX, mouseY, upgrades, new ItemStack(TRContent.WRENCH)); - } - if(getMachine().showTankConfig()){ - builder.drawSlotTab(this, guiLeft, guiTop + 27, mouseX, mouseY, upgrades, DynamicCell.getCellWithFluid(FluidRegistry.LAVA)); - } - } - - public boolean drawPlayerSlots() { - return true; - } - - public boolean tryAddUpgrades() { - return true; - } - - @SideOnly(Side.CLIENT) - @Override - protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { - this.buttonList.clear(); - drawTitle(); - if(slotConfigType == SlotConfigType.ITEMS && getMachine().hasSlotConfig()){ - GuiSlotConfiguration.draw(this, mouseX, mouseY); - } - - if(slotConfigType == SlotConfigType.FLUIDS && getMachine().showTankConfig()){ - GuiFluidConfiguration.draw(this, mouseX, mouseY); - } - - int offset = 0; - if(!upgrades){ - offset = 80; - } - if (builder.isInRect(guiLeft - 19, guiTop + 92 - offset, 12, 12, mouseX, mouseY) && getMachine().hasSlotConfig()) { - List list = new ArrayList<>(); - list.add("Configure slots"); - GuiUtils.drawHoveringText(list, mouseX - guiLeft , mouseY - guiTop , width, height, -1, mc.fontRenderer); - GlStateManager.disableLighting(); - GlStateManager.color(1, 1, 1, 1); - } - if (builder.isInRect(guiLeft - 19, guiTop + 92 - offset + 27, 12, 12, mouseX, mouseY) && getMachine().showTankConfig()) { - List list = new ArrayList<>(); - list.add("Configure Fluids"); - GuiUtils.drawHoveringText(list, mouseX - guiLeft , mouseY - guiTop , width, height, -1, mc.fontRenderer); - GlStateManager.disableLighting(); - GlStateManager.color(1, 1, 1, 1); - } - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - this.drawDefaultBackground(); - super.drawScreen(mouseX, mouseY, partialTicks); - this.renderHoveredToolTip(mouseX, mouseY); - } - - protected void drawTitle() { - drawCentredString(I18n.format(tile.getBlockType().getTranslationKey() + ".name"), 6, 4210752, Layer.FOREGROUND); - } - - protected void drawCentredString(String string, int y, int colour, Layer layer) { - drawString(string, (xSize / 2 - mc.fontRenderer.getStringWidth(string) / 2), y, colour, layer); - } - - protected void drawCentredString(String string, int y, int colour, int modifier, Layer layer) { - drawString(string, (xSize / 2 - (mc.fontRenderer.getStringWidth(string)) / 2) + modifier, y, colour, layer); - } - - protected void drawString(String string, int x, int y, int colour, Layer layer) { - int factorX = 0; - int factorY = 0; - if (layer == Layer.BACKGROUND) { - factorX = guiLeft; - factorY = guiTop; - } - mc.fontRenderer.drawString(string, x + factorX, y + factorY, colour); - GlStateManager.color(1, 1, 1, 1); - } - - public void addPowerButton(int x, int y, int id, Layer layer) { - int factorX = 0; - int factorY = 0; - if (layer == Layer.BACKGROUND) { - factorX = guiLeft; - factorY = guiTop; - } - buttonList.add(new GuiButtonPowerBar(id, x + factorX, y + factorY, this, layer)); - } - - @Override - protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { - if(slotConfigType == SlotConfigType.ITEMS && getMachine().hasSlotConfig()){ - if(GuiSlotConfiguration.mouseClicked(mouseX, mouseY, mouseButton, this)){ - return; - } - } - if(slotConfigType == SlotConfigType.FLUIDS && getMachine().showTankConfig()){ - if(GuiFluidConfiguration.mouseClicked(mouseX, mouseY, mouseButton, this)){ - return; - } - } - super.mouseClicked(mouseX, mouseY, mouseButton); - } - - @Override - protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { - if(slotConfigType == SlotConfigType.ITEMS && getMachine().hasSlotConfig()){ - GuiSlotConfiguration.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick, this); - } - if(slotConfigType == SlotConfigType.FLUIDS && getMachine().showTankConfig()){ - GuiFluidConfiguration.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) && getMachine().hasSlotConfig()){ - if(slotConfigType != SlotConfigType.ITEMS){ - slotConfigType = SlotConfigType.ITEMS; - } else { - slotConfigType = SlotConfigType.NONE; - } - if(slotConfigType == SlotConfigType.ITEMS){ - GuiSlotConfiguration.reset(); - } - } - if(isPointInRegion(-26, 84 - offset + 27, 30, 30, mouseX, mouseY) && getMachine().showTankConfig()){ - if(slotConfigType != SlotConfigType.FLUIDS){ - slotConfigType = SlotConfigType.FLUIDS; - } else { - slotConfigType = SlotConfigType.NONE; - } - } - if(slotConfigType == SlotConfigType.ITEMS && getMachine().hasSlotConfig()){ - if(GuiSlotConfiguration.mouseReleased(mouseX, mouseY, state, this)){ - return; - } - } - if(slotConfigType == SlotConfigType.FLUIDS && getMachine().showTankConfig()){ - if(GuiFluidConfiguration.mouseReleased(mouseX, mouseY, state, this)){ - return; - } - } - super.mouseReleased(mouseX, mouseY, state); - } - - @Override - protected void keyTyped(char typedChar, int keyCode) throws IOException { - if(slotConfigType == SlotConfigType.ITEMS){ - if(isCtrlKeyDown() && keyCode == Keyboard.KEY_C){ - GuiSlotConfiguration.copyToClipboard(); - return; - } else if(isCtrlKeyDown() && keyCode == Keyboard.KEY_V){ - GuiSlotConfiguration.pasteFromClipboard(); - return; - } - } - super.keyTyped(typedChar, keyCode); - } - - @Override - public void onGuiClosed() { - slotConfigType = SlotConfigType.NONE; - 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 TileMachineBase getMachine(){ - return (TileMachineBase) tile; - } - - - public enum Layer { - BACKGROUND, FOREGROUND - } - - public enum SlotConfigType{ - NONE, - ITEMS, - FLUIDS - } -} diff --git a/src/main/java/techreborn/client/gui/GuiBatbox.java b/src/main/java/techreborn/client/gui/GuiBatbox.java index 887fb6a2a..ad4803c41 100644 --- a/src/main/java/techreborn/client/gui/GuiBatbox.java +++ b/src/main/java/techreborn/client/gui/GuiBatbox.java @@ -26,6 +26,7 @@ package techreborn.client.gui; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; +import reborncore.client.gui.builder.GuiBase; import reborncore.common.powerSystem.PowerSystem; import techreborn.tiles.storage.TileLowVoltageSU; @@ -43,8 +44,8 @@ public class GuiBatbox extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - this.drawSlot(62, 45, layer); - this.drawSlot(98, 45, layer); + drawSlot(62, 45, layer); + drawSlot(98, 45, layer); } @Override @@ -55,10 +56,10 @@ public class GuiBatbox extends GuiBase { if(GuiBase.slotConfigType == SlotConfigType.NONE){ 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); + drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) tile.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) 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); + builder.drawMultiEnergyBar(this, 81, 28, (int) tile.getEnergy(), (int) 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 90d63c726..baf6510c8 100644 --- a/src/main/java/techreborn/client/gui/GuiBlastFurnace.java +++ b/src/main/java/techreborn/client/gui/GuiBlastFurnace.java @@ -30,13 +30,15 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; +import reborncore.ClientProxy; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockSet; -import techreborn.client.gui.widget.GuiButtonHologram; import techreborn.init.TRContent; -import techreborn.proxies.ClientProxy; import techreborn.tiles.machine.multiblock.TileIndustrialBlastFurnace; +import reborncore.client.gui.builder.widget.GuiButtonHologram; import java.io.IOException; @@ -65,24 +67,24 @@ public class GuiBlastFurnace extends GuiBase { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); final GuiBase.Layer layer = Layer.BACKGROUND; - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); - this.drawSlot(50, 27, layer); - this.drawSlot(50, 47, layer); - this.drawOutputSlotBar(92, 36, 2, layer); + drawSlot(50, 27, layer); + drawSlot(50, 47, layer); + drawOutputSlotBar(92, 36, 2, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) { super.drawGuiContainerForegroundLayer(mouseX, mouseY); - this.hasMultiBlock = this.tile.getCachedHeat() != 0; + this.hasMultiBlock = tile.getCachedHeat() != 0; final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawBigHeatBar(this, 31, 71, tile.getCachedHeat(), 3230, layer); + builder.drawBigHeatBar(this, 31, 71, tile.getCachedHeat(), 3230, layer); if (hasMultiBlock) { addHologramButton(6, 4, 212, layer); builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); @@ -91,7 +93,7 @@ public class GuiBlastFurnace extends GuiBase { addHologramButton(76, 56, 212, layer); builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); } - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); } public void addHologramButton(int x, int y, int id, Layer layer) { @@ -113,7 +115,7 @@ public class GuiBlastFurnace extends GuiBase { // This code here makes a basic multiblock and then sets to the selected one. final Multiblock multiblock = new Multiblock(); IBlockState standardCasing = TRContent.MachineBlocks.BASIC.getCasing().getDefaultState(); - + this.addComponent(0, 0, 0, standardCasing, multiblock); this.addComponent(1, 0, 0, standardCasing, multiblock); this.addComponent(0, 0, 1, standardCasing, multiblock); @@ -154,14 +156,11 @@ public class GuiBlastFurnace extends GuiBase { final MultiblockSet set = new MultiblockSet(multiblock); ClientProxy.multiblockRenderEvent.setMultiblock(set); - ClientProxy.multiblockRenderEvent.parent = this.tile.getPos(); -// new Location(this.tile.getPos().getX(), -// this.tile.getPos().getY(), this.tile.getPos().getZ(), this.tile.getWorld()); + ClientProxy.multiblockRenderEvent.parent = tile.getPos(); MultiblockRenderEvent.anchor = new BlockPos( - this.tile.getPos().getX() - - EnumFacing.byIndex(this.tile.getFacingInt()).getXOffset() * 2, - this.tile.getPos().getY() - 1, this.tile.getPos().getZ() - - EnumFacing.byIndex(this.tile.getFacingInt()).getZOffset() * 2); + tile.getPos().getX() - EnumFacing.byIndex(tile.getFacingInt()).getXOffset() * 2, + tile.getPos().getY() - 1, + tile.getPos().getZ() - EnumFacing.byIndex(tile.getFacingInt()).getZOffset() * 2); } } else { ClientProxy.multiblockRenderEvent.setMultiblock(null); diff --git a/src/main/java/techreborn/client/gui/GuiCentrifuge.java b/src/main/java/techreborn/client/gui/GuiCentrifuge.java index 86a55a982..7a540676d 100644 --- a/src/main/java/techreborn/client/gui/GuiCentrifuge.java +++ b/src/main/java/techreborn/client/gui/GuiCentrifuge.java @@ -25,6 +25,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import techreborn.tiles.TileIndustrialCentrifuge; public class GuiCentrifuge extends GuiBase { @@ -41,17 +43,17 @@ public class GuiCentrifuge extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); - this.drawSlot(40, 34, layer); - this.drawSlot(40, 54, layer); + drawSlot(40, 34, layer); + drawSlot(40, 54, layer); - this.drawSlot(82, 44, layer); - this.drawSlot(101, 25, layer); - this.drawSlot(120, 44, layer); - this.drawSlot(101, 63, layer); + drawSlot(82, 44, layer); + drawSlot(101, 25, layer); + drawSlot(120, 44, layer); + drawSlot(101, 63, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override @@ -59,7 +61,7 @@ public class GuiCentrifuge extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 61, 47, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 61, 47, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiChargeBench.java b/src/main/java/techreborn/client/gui/GuiChargeBench.java index 890413745..cf9180c0a 100644 --- a/src/main/java/techreborn/client/gui/GuiChargeBench.java +++ b/src/main/java/techreborn/client/gui/GuiChargeBench.java @@ -25,6 +25,7 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; +import reborncore.client.gui.builder.GuiBase; import techreborn.tiles.TileChargeOMat; public class GuiChargeBench extends GuiBase { @@ -41,12 +42,12 @@ public class GuiChargeBench extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - this.drawSlot(62, 25, layer); - this.drawSlot(98, 25, layer); - this.drawSlot(62, 45, layer); - this.drawSlot(98, 45, layer); - this.drawSlot(62, 65, layer); - this.drawSlot(98, 65, layer); + drawSlot(62, 25, layer); + drawSlot(98, 25, layer); + drawSlot(62, 45, layer); + drawSlot(98, 45, layer); + drawSlot(62, 65, layer); + drawSlot(98, 65, layer); } @Override @@ -54,6 +55,6 @@ public class GuiChargeBench extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(this, 81, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiChemicalReactor.java b/src/main/java/techreborn/client/gui/GuiChemicalReactor.java index a600c1053..46dc4dba3 100644 --- a/src/main/java/techreborn/client/gui/GuiChemicalReactor.java +++ b/src/main/java/techreborn/client/gui/GuiChemicalReactor.java @@ -26,6 +26,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; import techreborn.tiles.machine.tier1.TileChemicalReactor; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; public class GuiChemicalReactor extends GuiBase { @@ -41,13 +43,13 @@ public class GuiChemicalReactor extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); - this.drawSlot(34, 47, layer); - this.drawSlot(126, 47, layer); - this.drawOutputSlot(80, 47, layer); + drawSlot(34, 47, layer); + drawSlot(126, 47, layer); + drawOutputSlot(80, 47, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override @@ -55,8 +57,8 @@ public class GuiChemicalReactor extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, TRBuilder.ProgressDirection.LEFT, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, TRBuilder.ProgressDirection.LEFT, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiCompressor.java b/src/main/java/techreborn/client/gui/GuiCompressor.java index 44a1d5294..bd175f3ab 100644 --- a/src/main/java/techreborn/client/gui/GuiCompressor.java +++ b/src/main/java/techreborn/client/gui/GuiCompressor.java @@ -26,6 +26,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; import techreborn.tiles.machine.tier1.TileCompressor; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; public class GuiCompressor extends GuiBase { @@ -41,12 +43,12 @@ public class GuiCompressor extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); - this.drawSlot(55, 45, layer); - this.drawOutputSlot(101, 45, layer); + drawSlot(55, 45, layer); + drawOutputSlot(101, 45, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override @@ -54,7 +56,7 @@ public class GuiCompressor extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + this.builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + this.builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiDieselGenerator.java b/src/main/java/techreborn/client/gui/GuiDieselGenerator.java index f770b919c..9b76aeb53 100644 --- a/src/main/java/techreborn/client/gui/GuiDieselGenerator.java +++ b/src/main/java/techreborn/client/gui/GuiDieselGenerator.java @@ -27,6 +27,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import techreborn.tiles.generator.advanced.TileDieselGenerator; @SideOnly(Side.CLIENT) @@ -45,7 +47,7 @@ public class GuiDieselGenerator extends GuiBase { final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; drawSlot(25, 35, layer); drawSlot(25, 55, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @@ -54,9 +56,9 @@ public class GuiDieselGenerator extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 130, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); - this.builder.drawTank(this, 44, 25, mouseX, mouseY, this.tile.tank.getFluid(), this.tile.tank.getCapacity(), this.tile.tank.isEmpty(), layer); + builder.drawProgressBar(this, tile.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 130, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawTank(this, 44, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer); } diff --git a/src/main/java/techreborn/client/gui/GuiDigitalChest.java b/src/main/java/techreborn/client/gui/GuiDigitalChest.java index de13f0d50..cb19369e0 100644 --- a/src/main/java/techreborn/client/gui/GuiDigitalChest.java +++ b/src/main/java/techreborn/client/gui/GuiDigitalChest.java @@ -25,15 +25,16 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; +import reborncore.client.gui.builder.GuiBase; import techreborn.tiles.TileDigitalChest; public class GuiDigitalChest extends GuiBase { - TileDigitalChest digitalChest; + TileDigitalChest tile; - public GuiDigitalChest(final EntityPlayer player, final TileDigitalChest digitalChest) { - super(player, digitalChest, digitalChest.createContainer(player)); - this.digitalChest = digitalChest; + public GuiDigitalChest(final EntityPlayer player, final TileDigitalChest tile) { + super(player, tile, tile.createContainer(player)); + this.tile = tile; } @Override @@ -41,8 +42,8 @@ public class GuiDigitalChest extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - this.drawSlot(80, 24, layer); - this.drawSlot(80, 64, layer); + drawSlot(80, 24, layer); + drawSlot(80, 64, layer); } @Override @@ -50,14 +51,14 @@ public class GuiDigitalChest extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - if (!this.digitalChest.storedItem.isEmpty() && !this.digitalChest.inventory.getStackInSlot(1).isEmpty()) { - this.builder.drawBigBlueBar(this, 31, 43, - this.digitalChest.storedItem.getCount() + this.digitalChest.inventory.getStackInSlot(1).getCount(), - this.digitalChest.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer); + if (!tile.storedItem.isEmpty() && tile.inventory.getStackInSlot(1) != null) { + builder.drawBigBlueBar(this, 31, 43, + tile.storedItem.getCount() + tile.inventory.getStackInSlot(1).getCount(), + tile.maxCapacity, mouseX - guiLeft, mouseY - guiTop, "Stored", layer); } - if (this.digitalChest.storedItem.isEmpty() && !this.digitalChest.inventory.getStackInSlot(1).isEmpty()) { - this.builder.drawBigBlueBar(this, 31, 43, this.digitalChest.inventory.getStackInSlot(1).getCount(), - this.digitalChest.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer); + if (tile.storedItem.isEmpty() && tile.inventory.getStackInSlot(1) != null) { + builder.drawBigBlueBar(this, 31, 43, tile.inventory.getStackInSlot(1).getCount(), + tile.maxCapacity, mouseX - guiLeft, mouseY - guiTop, "Stored", layer); } } } diff --git a/src/main/java/techreborn/client/gui/GuiDistillationTower.java b/src/main/java/techreborn/client/gui/GuiDistillationTower.java index 379dcfae0..f09850367 100644 --- a/src/main/java/techreborn/client/gui/GuiDistillationTower.java +++ b/src/main/java/techreborn/client/gui/GuiDistillationTower.java @@ -30,12 +30,15 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; +import reborncore.ClientProxy; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockSet; -import techreborn.client.gui.widget.GuiButtonHologram; +import techreborn.blocks.BlockMachineCasing; +import reborncore.client.gui.builder.widget.GuiButtonHologram; import techreborn.init.TRContent; -import techreborn.proxies.ClientProxy; import techreborn.tiles.machine.multiblock.TileDistillationTower; import java.io.IOException; @@ -62,14 +65,14 @@ public class GuiDistillationTower extends GuiBase { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); final GuiBase.Layer layer = Layer.BACKGROUND; // Battery slot - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); // Input slots - this.drawSlot(35, 27, layer); - this.drawSlot(35, 47, layer); + drawSlot(35, 27, layer); + drawSlot(35, 47, layer); // Four output slots - this.drawOutputSlotBar(78, 36, 4, layer); + drawOutputSlotBar(78, 36, 4, layer); // JEI Button - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override @@ -77,8 +80,8 @@ public class GuiDistillationTower extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 55, 40, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 55, 40, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); if (tile.getMutliBlock()) { addHologramButton(6, 4, 212, layer); builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); @@ -107,55 +110,54 @@ public class GuiDistillationTower extends GuiBase { { // This code here makes a basic multiblock and then sets to the selected one. final Multiblock multiblock = new Multiblock(); - IBlockState advancedCasing = TRContent.MachineBlocks.ADVANCED.getCasing().getDefaultState(); + IBlockState advancedCasing = TRContent.MachineBlocks.ADVANCED.getCasing().getDefaultState(); IBlockState standardCasing = TRContent.MachineBlocks.BASIC.getCasing().getDefaultState(); - this.addComponent(0, 0, 0, standardCasing, multiblock); - this.addComponent(1, 0, 0, standardCasing, multiblock); - this.addComponent(0, 0, 1, standardCasing, multiblock); - this.addComponent(-1, 0, 0, standardCasing, multiblock); - this.addComponent(0, 0, -1, standardCasing, multiblock); - this.addComponent(-1, 0, -1, standardCasing, multiblock); - this.addComponent(-1, 0, 1, standardCasing, multiblock); - this.addComponent(1, 0, -1, standardCasing, multiblock); - this.addComponent(1, 0, 1, standardCasing, multiblock); + addComponent(0, 0, 0, standardCasing, multiblock); + addComponent(1, 0, 0, standardCasing, multiblock); + addComponent(0, 0, 1, standardCasing, multiblock); + addComponent(-1, 0, 0, standardCasing, multiblock); + addComponent(0, 0, -1, standardCasing, multiblock); + addComponent(-1, 0, -1, standardCasing, multiblock); + addComponent(-1, 0, 1, standardCasing, multiblock); + addComponent(1, 0, -1, standardCasing, multiblock); + addComponent(1, 0, 1, standardCasing, multiblock); - this.addComponent(1, 1, 0, advancedCasing, multiblock); - this.addComponent(0, 1, 1, advancedCasing, multiblock); - this.addComponent(-1, 1, 0, advancedCasing, multiblock); - this.addComponent(0, 1, -1, advancedCasing, multiblock); - this.addComponent(-1, 1, -1, advancedCasing, multiblock); - this.addComponent(-1, 1, 1, advancedCasing, multiblock); - this.addComponent(1, 1, -1, advancedCasing, multiblock); - this.addComponent(1, 1, 1, advancedCasing, multiblock); + addComponent(1, 1, 0, advancedCasing, multiblock); + addComponent(0, 1, 1, advancedCasing, multiblock); + addComponent(-1, 1, 0, advancedCasing, multiblock); + addComponent(0, 1, -1, advancedCasing, multiblock); + addComponent(-1, 1, -1, advancedCasing, multiblock); + addComponent(-1, 1, 1, advancedCasing, multiblock); + addComponent(1, 1, -1, advancedCasing, multiblock); + addComponent(1, 1, 1, advancedCasing, multiblock); - this.addComponent(1, 2, 0, standardCasing, multiblock); - this.addComponent(0, 2, 1, standardCasing, multiblock); - this.addComponent(-1, 2, 0, standardCasing, multiblock); - this.addComponent(0, 2, -1, standardCasing, multiblock); - this.addComponent(-1, 2, -1, standardCasing, multiblock); - this.addComponent(-1, 2, 1, standardCasing, multiblock); - this.addComponent(1, 2, -1, standardCasing, multiblock); - this.addComponent(1, 2, 1, standardCasing, multiblock); + addComponent(1, 2, 0, standardCasing, multiblock); + addComponent(0, 2, 1, standardCasing, multiblock); + addComponent(-1, 2, 0, standardCasing, multiblock); + addComponent(0, 2, -1, standardCasing, multiblock); + addComponent(-1, 2, -1, standardCasing, multiblock); + addComponent(-1, 2, 1, standardCasing, multiblock); + addComponent(1, 2, -1, standardCasing, multiblock); + addComponent(1, 2, 1, standardCasing, multiblock); - this.addComponent(0, 3, 0, advancedCasing, multiblock); - this.addComponent(1, 3, 0, advancedCasing, multiblock); - this.addComponent(0, 3, 1, advancedCasing, multiblock); - this.addComponent(-1, 3, 0, advancedCasing, multiblock); - this.addComponent(0, 3, -1, advancedCasing, multiblock); - this.addComponent(-1, 3, -1, advancedCasing, multiblock); - this.addComponent(-1, 3, 1, advancedCasing, multiblock); - this.addComponent(1, 3, -1, advancedCasing, multiblock); - this.addComponent(1, 3, 1, advancedCasing, multiblock); + addComponent(0, 3, 0, advancedCasing, multiblock); + addComponent(1, 3, 0, advancedCasing, multiblock); + addComponent(0, 3, 1, advancedCasing, multiblock); + addComponent(-1, 3, 0, advancedCasing, multiblock); + addComponent(0, 3, -1, advancedCasing, multiblock); + addComponent(-1, 3, -1, advancedCasing, multiblock); + addComponent(-1, 3, 1, advancedCasing, multiblock); + addComponent(1, 3, -1, advancedCasing, multiblock); + addComponent(1, 3, 1, advancedCasing, multiblock); final MultiblockSet set = new MultiblockSet(multiblock); ClientProxy.multiblockRenderEvent.setMultiblock(set); - ClientProxy.multiblockRenderEvent.parent = this.tile.getPos(); + ClientProxy.multiblockRenderEvent.parent = tile.getPos(); MultiblockRenderEvent.anchor = new BlockPos( - this.tile.getPos().getX() - - EnumFacing.byIndex(this.tile.getFacingInt()).getXOffset() * 2, - this.tile.getPos().getY() - 1, this.tile.getPos().getZ() - - EnumFacing.byIndex(this.tile.getFacingInt()).getZOffset() * 2); + tile.getPos().getX() - EnumFacing.byIndex(tile.getFacingInt()).getXOffset() * 2, + tile.getPos().getY() - 1, + tile.getPos().getZ() - EnumFacing.byIndex(tile.getFacingInt()).getZOffset() * 2); } } else { ClientProxy.multiblockRenderEvent.setMultiblock(null); diff --git a/src/main/java/techreborn/client/gui/GuiElectricFurnace.java b/src/main/java/techreborn/client/gui/GuiElectricFurnace.java index 648e8ee5d..73acad9a5 100644 --- a/src/main/java/techreborn/client/gui/GuiElectricFurnace.java +++ b/src/main/java/techreborn/client/gui/GuiElectricFurnace.java @@ -26,6 +26,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; import techreborn.tiles.machine.tier1.TileElectricFurnace; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; public class GuiElectricFurnace extends GuiBase { @@ -37,24 +39,24 @@ public class GuiElectricFurnace extends GuiBase { } @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) { - super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); - final Layer layer = Layer.BACKGROUND; + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { + super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY); + Layer layer = Layer.BACKGROUND; - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); - this.drawSlot(55, 45, layer); - this.drawOutputSlot(101, 45, layer); + drawSlot(55, 45, layer); + drawOutputSlot(101, 45, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override - protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) { + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { super.drawGuiContainerForegroundLayer(mouseX, mouseY); - final Layer layer = Layer.FOREGROUND; + Layer layer = Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.gaugeProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tile.gaugeProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiExtractor.java b/src/main/java/techreborn/client/gui/GuiExtractor.java index d699771bd..f67a20543 100644 --- a/src/main/java/techreborn/client/gui/GuiExtractor.java +++ b/src/main/java/techreborn/client/gui/GuiExtractor.java @@ -26,6 +26,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; import techreborn.tiles.machine.tier1.TileExtractor; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; public class GuiExtractor extends GuiBase { @@ -41,12 +43,12 @@ public class GuiExtractor extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); - this.drawSlot(55, 45, layer); - this.drawOutputSlot(101, 45, layer); + drawSlot(55, 45, layer); + drawOutputSlot(101, 45, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override @@ -54,7 +56,7 @@ public class GuiExtractor extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiFluidReplicator.java b/src/main/java/techreborn/client/gui/GuiFluidReplicator.java index 92cebbd40..7ef13ad7f 100644 --- a/src/main/java/techreborn/client/gui/GuiFluidReplicator.java +++ b/src/main/java/techreborn/client/gui/GuiFluidReplicator.java @@ -29,13 +29,15 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; +import reborncore.ClientProxy; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockSet; -import techreborn.client.gui.widget.GuiButtonHologram; import techreborn.init.TRContent; -import techreborn.proxies.ClientProxy; import techreborn.tiles.machine.multiblock.TileFluidReplicator; +import reborncore.client.gui.builder.widget.GuiButtonHologram; import java.io.IOException; @@ -86,7 +88,7 @@ public class GuiFluidReplicator extends GuiBase { // Liquid output slot drawSlot(124, 55, layer); // JEI button - builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override diff --git a/src/main/java/techreborn/client/gui/GuiFusionReactor.java b/src/main/java/techreborn/client/gui/GuiFusionReactor.java index a636bea12..c71e791ba 100644 --- a/src/main/java/techreborn/client/gui/GuiFusionReactor.java +++ b/src/main/java/techreborn/client/gui/GuiFusionReactor.java @@ -29,17 +29,19 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.BlockPos; import org.apache.commons.lang3.tuple.Pair; +import reborncore.ClientProxy; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockSet; import reborncore.common.network.NetworkManager; import reborncore.common.powerSystem.PowerSystem; import reborncore.common.util.Torus; -import techreborn.client.gui.widget.GuiButtonHologram; -import techreborn.client.gui.widget.GuiButtonUpDown; +import reborncore.client.gui.builder.widget.GuiButtonHologram; +import reborncore.client.gui.builder.widget.GuiButtonUpDown; import techreborn.init.TRContent; import techreborn.packets.PacketFusionControlSize; -import techreborn.proxies.ClientProxy; import techreborn.tiles.fusionReactor.TileFusionControlComputer; import java.awt.*; @@ -60,11 +62,11 @@ public class GuiFusionReactor extends GuiBase { super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - this.drawSlot(34, 47, layer); - this.drawSlot(126, 47, layer); - this.drawOutputSlot(80, 47, layer); + drawSlot(34, 47, layer); + drawSlot(126, 47, layer); + drawOutputSlot(80, 47, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @@ -73,8 +75,8 @@ public class GuiFusionReactor extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, TRBuilder.ProgressDirection.LEFT, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, TRBuilder.ProgressDirection.LEFT, layer); if (tile.getCoilStatus() > 0) { addHologramButton(6, 4, 212, layer); builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); @@ -97,7 +99,7 @@ public class GuiFusionReactor extends GuiBase { } } - this.builder.drawUpDownButtons(this, 121, 79, layer); + builder.drawUpDownButtons(this, 121, 79, layer); drawString("Size: " + tile.size, 83, 81, 0xFFFFFF, layer); drawString("" + tile.getPowerMultiplier() + "x", 10, 81, 0xFFFFFF, layer); @@ -106,7 +108,7 @@ public class GuiFusionReactor extends GuiBase { buttonList.add(new GuiButtonUpDown(302, 121 + 24, 79, this, GuiBase.Layer.FOREGROUND)); buttonList.add(new GuiButtonUpDown(303, 121 + 36, 79, this, GuiBase.Layer.FOREGROUND)); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); } public void addHologramButton(int x, int y, int id, Layer layer) { @@ -157,9 +159,9 @@ public class GuiFusionReactor extends GuiBase { final MultiblockSet set = new MultiblockSet(multiblock); ClientProxy.multiblockRenderEvent.setMultiblock(set); - ClientProxy.multiblockRenderEvent.parent = this.tile.getPos(); - MultiblockRenderEvent.anchor = new BlockPos(this.tile.getPos().getX(), this.tile.getPos().getY() - 1, - this.tile.getPos().getZ()); + ClientProxy.multiblockRenderEvent.parent = tile.getPos(); + MultiblockRenderEvent.anchor = new BlockPos(tile.getPos().getX(), tile.getPos().getY() - 1, + tile.getPos().getZ()); } public void addComponent(final int x, final int y, final int z, final IBlockState blockState, final Multiblock multiblock) { diff --git a/src/main/java/techreborn/client/gui/GuiGasTurbine.java b/src/main/java/techreborn/client/gui/GuiGasTurbine.java index d9908849c..3c82fe339 100644 --- a/src/main/java/techreborn/client/gui/GuiGasTurbine.java +++ b/src/main/java/techreborn/client/gui/GuiGasTurbine.java @@ -26,6 +26,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; import techreborn.tiles.generator.advanced.TileGasTurbine; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; public class GuiGasTurbine extends GuiBase { @@ -42,7 +44,7 @@ public class GuiGasTurbine extends GuiBase { final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; drawSlot(25, 35, layer); drawSlot(25, 55, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @@ -51,9 +53,9 @@ public class GuiGasTurbine extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 130, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); - this.builder.drawTank(this, 44, 25, mouseX, mouseY, this.tile.tank.getFluid(), this.tile.tank.getCapacity(), this.tile.tank.isEmpty(), layer); + builder.drawProgressBar(this, tile.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 130, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawTank(this, 44, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiGenerator.java b/src/main/java/techreborn/client/gui/GuiGenerator.java index b426eac1d..24b3a88da 100644 --- a/src/main/java/techreborn/client/gui/GuiGenerator.java +++ b/src/main/java/techreborn/client/gui/GuiGenerator.java @@ -26,6 +26,7 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; import techreborn.tiles.generator.basic.TileSolidFuelGenerator; +import reborncore.client.gui.builder.GuiBase; public class GuiGenerator extends GuiBase { @@ -41,11 +42,11 @@ public class GuiGenerator extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); - this.drawSlot(80, 54, layer); + drawSlot(80, 54, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override @@ -53,7 +54,7 @@ public class GuiGenerator extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - this.builder.drawBurnBar(this, this.tile.getScaledBurnTime(100), 100, 81, 38, mouseX, mouseY, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawBurnBar(this, tile.getScaledBurnTime(100), 100, 81, 38, mouseX, mouseY, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiGrinder.java b/src/main/java/techreborn/client/gui/GuiGrinder.java index da03f8321..20da07235 100644 --- a/src/main/java/techreborn/client/gui/GuiGrinder.java +++ b/src/main/java/techreborn/client/gui/GuiGrinder.java @@ -25,6 +25,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import techreborn.tiles.machine.tier1.TileGrinder; public class GuiGrinder extends GuiBase { @@ -41,12 +43,12 @@ public class GuiGrinder extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); - this.drawSlot(55, 45, layer); - this.drawOutputSlot(101, 45, layer); + drawSlot(55, 45, layer); + drawOutputSlot(101, 45, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override @@ -54,7 +56,7 @@ public class GuiGrinder extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiIDSU.java b/src/main/java/techreborn/client/gui/GuiIDSU.java index 8418ab743..ba5f04743 100644 --- a/src/main/java/techreborn/client/gui/GuiIDSU.java +++ b/src/main/java/techreborn/client/gui/GuiIDSU.java @@ -26,6 +26,7 @@ package techreborn.client.gui; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; +import reborncore.client.gui.builder.GuiBase; import reborncore.common.powerSystem.PowerSystem; import techreborn.tiles.storage.idsu.TileInterdimensionalSU; @@ -43,9 +44,9 @@ public class GuiIDSU extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - this.drawSlot(62, 45, layer); - this.drawSlot(98, 45, layer); - this.drawArmourSlots(8, 18, layer); + drawSlot(62, 45, layer); + drawSlot(98, 45, layer); + drawArmourSlots(8, 18, layer); } @Override @@ -55,10 +56,10 @@ public class GuiIDSU extends GuiBase { GlStateManager.pushMatrix(); GlStateManager.scale(0.6, 0.6, 1); - this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.idsu.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.idsu.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); + drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) idsu.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) idsu.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); GlStateManager.popMatrix(); - this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.idsu.getEnergy(), (int) this.idsu.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(this, 81, 28, (int) idsu.getEnergy(), (int) idsu.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java b/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java index 1ed80245b..b6dd9946f 100644 --- a/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java +++ b/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java @@ -29,13 +29,16 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.BlockPos; +import reborncore.ClientProxy; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockSet; -import techreborn.client.gui.widget.GuiButtonHologram; import techreborn.init.TRContent; -import techreborn.proxies.ClientProxy; import techreborn.tiles.machine.multiblock.TileImplosionCompressor; +import techreborn.blocks.BlockMachineCasing; +import reborncore.client.gui.builder.widget.GuiButtonHologram; import java.io.IOException; @@ -61,7 +64,7 @@ public class GuiImplosionCompressor extends GuiBase { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); final GuiBase.Layer layer = Layer.BACKGROUND; - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); drawSlot(50, 27, layer); drawSlot(50, 47, layer); @@ -72,7 +75,7 @@ public class GuiImplosionCompressor extends GuiBase { builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); } - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override @@ -80,8 +83,8 @@ public class GuiImplosionCompressor extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); if (tile.getMutliBlock()) { addHologramButton(6, 4, 212, layer); } else { @@ -121,9 +124,8 @@ public class GuiImplosionCompressor extends GuiBase { final MultiblockSet set = new MultiblockSet(multiblock); ClientProxy.multiblockRenderEvent.setMultiblock(set); - ClientProxy.multiblockRenderEvent.parent = this.tile.getPos(); - //new Location(this.tile.getPos().getX(), this.tile.getPos().getY(), this.tile.getPos().getZ(), this.tile.getWorld()); - MultiblockRenderEvent.anchor = new BlockPos(this.tile.getPos().getX(), this.tile.getPos().getY(), this.tile.getPos().getZ()); + ClientProxy.multiblockRenderEvent.parent = tile.getPos(); + MultiblockRenderEvent.anchor = new BlockPos(tile.getPos().getX(), tile.getPos().getY(), tile.getPos().getZ()); } } else { ClientProxy.multiblockRenderEvent.setMultiblock(null); diff --git a/src/main/java/techreborn/client/gui/GuiIndustrialElectrolyzer.java b/src/main/java/techreborn/client/gui/GuiIndustrialElectrolyzer.java index 1f17fc255..5d1d7c9ce 100644 --- a/src/main/java/techreborn/client/gui/GuiIndustrialElectrolyzer.java +++ b/src/main/java/techreborn/client/gui/GuiIndustrialElectrolyzer.java @@ -26,6 +26,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; import techreborn.tiles.machine.tier1.TileIndustrialElectrolyzer; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; public class GuiIndustrialElectrolyzer extends GuiBase { @@ -42,13 +44,13 @@ public class GuiIndustrialElectrolyzer extends GuiBase { final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; //Battery slot - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); //Input slots - this.drawSlot(47, 72, layer); - this.drawSlot(81, 72, layer); + drawSlot(47, 72, layer); + drawSlot(81, 72, layer); //Output slots - this.drawOutputSlotBar(50, 23, 4, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + drawOutputSlotBar(50, 23, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override @@ -56,8 +58,8 @@ public class GuiIndustrialElectrolyzer extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 84, 52, mouseX, mouseY, TRBuilder.ProgressDirection.UP, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 84, 52, mouseX, mouseY, TRBuilder.ProgressDirection.UP, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); } diff --git a/src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java b/src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java index 81fb85983..9a8d5bb37 100644 --- a/src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java +++ b/src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java @@ -30,12 +30,15 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; +import reborncore.ClientProxy; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockSet; -import techreborn.client.gui.widget.GuiButtonHologram; +import techreborn.blocks.BlockMachineCasing; +import reborncore.client.gui.builder.widget.GuiButtonHologram; import techreborn.init.TRContent; -import techreborn.proxies.ClientProxy; import techreborn.tiles.machine.multiblock.TileIndustrialGrinder; import java.io.IOException; @@ -61,20 +64,20 @@ public class GuiIndustrialGrinder extends GuiBase { final Layer layer = Layer.BACKGROUND; // Battery slot - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); // Liquid input slot - this.drawSlot(34, 35, layer); + drawSlot(34, 35, layer); // Liquid output slot - this.drawSlot(34, 55, layer); + drawSlot(34, 55, layer); // Solid material input slot - this.drawSlot(84, 43, layer); + drawSlot(84, 43, layer); // Output slots - this.drawSlot(126, 18, layer); - this.drawSlot(126, 36, layer); - this.drawSlot(126, 54, layer); - this.drawSlot(126, 72, layer); + drawSlot(126, 18, layer); + drawSlot(126, 36, layer); + drawSlot(126, 54, layer); + drawSlot(126, 72, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override @@ -82,9 +85,9 @@ public class GuiIndustrialGrinder extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawTank(this, 53, 25, mouseX, mouseY, this.tile.tank.getFluid(), this.tile.tank.getCapacity(), this.tile.tank.isEmpty(), layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawTank(this, 53, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); if (tile.getMutliBlock()) { addHologramButton(6, 4, 212, layer); builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); @@ -116,40 +119,40 @@ public class GuiIndustrialGrinder extends GuiBase { IBlockState standardCasing = TRContent.MachineBlocks.BASIC.getCasing().getDefaultState(); IBlockState reinforcedCasing = TRContent.MachineBlocks.ADVANCED.getCasing().getDefaultState(); - this.addComponent(0, -1, 0, standardCasing, multiblock); - this.addComponent(1, -1, 0, standardCasing, multiblock); - this.addComponent(0, -1, 1, standardCasing, multiblock); - this.addComponent(-1, -1, 0, standardCasing, multiblock); - this.addComponent(0, -1, -1, standardCasing, multiblock); - this.addComponent(-1, -1, -1, standardCasing, multiblock); - this.addComponent(-1, -1, 1, standardCasing, multiblock); - this.addComponent(1, -1, -1, standardCasing, multiblock); - this.addComponent(1, -1, 1, standardCasing, multiblock); + addComponent(0, -1, 0, standardCasing, multiblock); + addComponent(1, -1, 0, standardCasing, multiblock); + addComponent(0, -1, 1, standardCasing, multiblock); + addComponent(-1, -1, 0, standardCasing, multiblock); + addComponent(0, -1, -1, standardCasing, multiblock); + addComponent(-1, -1, -1, standardCasing, multiblock); + addComponent(-1, -1, 1, standardCasing, multiblock); + addComponent(1, -1, -1, standardCasing, multiblock); + addComponent(1, -1, 1, standardCasing, multiblock); - this.addComponent(0, 0, 0, Blocks.WATER.getDefaultState(), multiblock); - this.addComponent(1, 0, 0, reinforcedCasing, multiblock); - this.addComponent(0, 0, 1, reinforcedCasing, multiblock); - this.addComponent(-1, 0, 0, reinforcedCasing, multiblock); - this.addComponent(0, 0, -1, reinforcedCasing, multiblock); - this.addComponent(-1, 0, -1, reinforcedCasing, multiblock); - this.addComponent(-1, 0, 1, reinforcedCasing, multiblock); - this.addComponent(1, 0, -1, reinforcedCasing, multiblock); - this.addComponent(1, 0, 1, reinforcedCasing, multiblock); + addComponent(0, 0, 0, Blocks.WATER.getDefaultState(), multiblock); + addComponent(1, 0, 0, reinforcedCasing, multiblock); + addComponent(0, 0, 1, reinforcedCasing, multiblock); + addComponent(-1, 0, 0, reinforcedCasing, multiblock); + addComponent(0, 0, -1, reinforcedCasing, multiblock); + addComponent(-1, 0, -1, reinforcedCasing, multiblock); + addComponent(-1, 0, 1, reinforcedCasing, multiblock); + addComponent(1, 0, -1, reinforcedCasing, multiblock); + addComponent(1, 0, 1, reinforcedCasing, multiblock); - this.addComponent(0, 1, 0, standardCasing, multiblock); - this.addComponent(0, 1, 0, standardCasing, multiblock); - this.addComponent(1, 1, 0, standardCasing, multiblock); - this.addComponent(0, 1, 1, standardCasing, multiblock); - this.addComponent(-1, 1, 0, standardCasing, multiblock); - this.addComponent(0, 1, -1, standardCasing, multiblock); - this.addComponent(-1, 1, -1, standardCasing, multiblock); - this.addComponent(-1, 1, 1, standardCasing, multiblock); - this.addComponent(1, 1, -1, standardCasing, multiblock); - this.addComponent(1, 1, 1, standardCasing, multiblock); + addComponent(0, 1, 0, standardCasing, multiblock); + addComponent(0, 1, 0, standardCasing, multiblock); + addComponent(1, 1, 0, standardCasing, multiblock); + addComponent(0, 1, 1, standardCasing, multiblock); + addComponent(-1, 1, 0, standardCasing, multiblock); + addComponent(0, 1, -1, standardCasing, multiblock); + addComponent(-1, 1, -1, standardCasing, multiblock); + addComponent(-1, 1, 1, standardCasing, multiblock); + addComponent(1, 1, -1, standardCasing, multiblock); + addComponent(1, 1, 1, standardCasing, multiblock); final MultiblockSet set = new MultiblockSet(multiblock); ClientProxy.multiblockRenderEvent.setMultiblock(set); - ClientProxy.multiblockRenderEvent.parent = this.tile.getPos(); + ClientProxy.multiblockRenderEvent.parent = tile.getPos(); MultiblockRenderEvent.anchor = new BlockPos( this.tile.getPos().getX() - EnumFacing.byIndex(this.tile.getFacingInt()).getXOffset() * 2, diff --git a/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java b/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java index a150488eb..3dc662926 100644 --- a/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java +++ b/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java @@ -30,12 +30,15 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; +import reborncore.ClientProxy; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockSet; -import techreborn.client.gui.widget.GuiButtonHologram; +import techreborn.blocks.BlockMachineCasing; +import reborncore.client.gui.builder.widget.GuiButtonHologram; import techreborn.init.TRContent; -import techreborn.proxies.ClientProxy; import techreborn.tiles.machine.multiblock.TileIndustrialSawmill; import java.io.IOException; @@ -61,19 +64,19 @@ public class GuiIndustrialSawmill extends GuiBase { final Layer layer = Layer.BACKGROUND; // Battery slot - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); // Liquid input slot - this.drawSlot(34, 35, layer); + drawSlot(34, 35, layer); // Liquid output slot - this.drawSlot(34, 55, layer); + drawSlot(34, 55, layer); // Solid material input slot - this.drawSlot(84, 43, layer); + drawSlot(84, 43, layer); // Output slots - this.drawSlot(126, 25, layer); - this.drawSlot(126, 43, layer); - this.drawSlot(126, 61, layer); + drawSlot(126, 25, layer); + drawSlot(126, 43, layer); + drawSlot(126, 61, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override @@ -81,9 +84,9 @@ public class GuiIndustrialSawmill extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawTank(this, 53, 25, mouseX, mouseY, this.tile.tank.getFluid(), this.tile.tank.getCapacity(), this.tile.tank.isEmpty(), layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawTank(this, 53, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); if (tile.getMutliBlock()) { addHologramButton(6, 4, 212, layer); builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); @@ -115,40 +118,40 @@ public class GuiIndustrialSawmill extends GuiBase { IBlockState standardCasing = TRContent.MachineBlocks.BASIC.getCasing().getDefaultState(); IBlockState reinforcedCasing = TRContent.MachineBlocks.ADVANCED.getCasing().getDefaultState(); - this.addComponent(0, -1, 0, standardCasing, multiblock); - this.addComponent(1, -1, 0, standardCasing, multiblock); - this.addComponent(0, -1, 1, standardCasing, multiblock); - this.addComponent(-1, -1, 0, standardCasing, multiblock); - this.addComponent(0, -1, -1, standardCasing, multiblock); - this.addComponent(-1, -1, -1, standardCasing, multiblock); - this.addComponent(-1, -1, 1, standardCasing, multiblock); - this.addComponent(1, -1, -1, standardCasing, multiblock); - this.addComponent(1, -1, 1, standardCasing, multiblock); + addComponent(0, -1, 0, standardCasing, multiblock); + addComponent(1, -1, 0, standardCasing, multiblock); + addComponent(0, -1, 1, standardCasing, multiblock); + addComponent(-1, -1, 0, standardCasing, multiblock); + addComponent(0, -1, -1, standardCasing, multiblock); + addComponent(-1, -1, -1, standardCasing, multiblock); + addComponent(-1, -1, 1, standardCasing, multiblock); + addComponent(1, -1, -1, standardCasing, multiblock); + addComponent(1, -1, 1, standardCasing, multiblock); - this.addComponent(0, 0, 0, Blocks.WATER.getDefaultState(), multiblock); - this.addComponent(1, 0, 0, reinforcedCasing, multiblock); - this.addComponent(0, 0, 1, reinforcedCasing, multiblock); - this.addComponent(-1, 0, 0, reinforcedCasing, multiblock); - this.addComponent(0, 0, -1, reinforcedCasing, multiblock); - this.addComponent(-1, 0, -1, reinforcedCasing, multiblock); - this.addComponent(-1, 0, 1, reinforcedCasing, multiblock); - this.addComponent(1, 0, -1, reinforcedCasing, multiblock); - this.addComponent(1, 0, 1, reinforcedCasing, multiblock); + addComponent(0, 0, 0, Blocks.WATER.getDefaultState(), multiblock); + addComponent(1, 0, 0, reinforcedCasing, multiblock); + addComponent(0, 0, 1, reinforcedCasing, multiblock); + addComponent(-1, 0, 0, reinforcedCasing, multiblock); + addComponent(0, 0, -1, reinforcedCasing, multiblock); + addComponent(-1, 0, -1, reinforcedCasing, multiblock); + addComponent(-1, 0, 1, reinforcedCasing, multiblock); + addComponent(1, 0, -1, reinforcedCasing, multiblock); + addComponent(1, 0, 1, reinforcedCasing, multiblock); - this.addComponent(0, 1, 0, standardCasing, multiblock); - this.addComponent(0, 1, 0, standardCasing, multiblock); - this.addComponent(1, 1, 0, standardCasing, multiblock); - this.addComponent(0, 1, 1, standardCasing, multiblock); - this.addComponent(-1, 1, 0, standardCasing, multiblock); - this.addComponent(0, 1, -1, standardCasing, multiblock); - this.addComponent(-1, 1, -1, standardCasing, multiblock); - this.addComponent(-1, 1, 1, standardCasing, multiblock); - this.addComponent(1, 1, -1, standardCasing, multiblock); - this.addComponent(1, 1, 1, standardCasing, multiblock); + addComponent(0, 1, 0, standardCasing, multiblock); + addComponent(0, 1, 0, standardCasing, multiblock); + addComponent(1, 1, 0, standardCasing, multiblock); + addComponent(0, 1, 1, standardCasing, multiblock); + addComponent(-1, 1, 0, standardCasing, multiblock); + addComponent(0, 1, -1, standardCasing, multiblock); + addComponent(-1, 1, -1, standardCasing, multiblock); + addComponent(-1, 1, 1, standardCasing, multiblock); + addComponent(1, 1, -1, standardCasing, multiblock); + addComponent(1, 1, 1, standardCasing, multiblock); final MultiblockSet set = new MultiblockSet(multiblock); ClientProxy.multiblockRenderEvent.setMultiblock(set); - ClientProxy.multiblockRenderEvent.parent = this.tile.getPos(); + ClientProxy.multiblockRenderEvent.parent = tile.getPos(); MultiblockRenderEvent.anchor = new BlockPos( this.tile.getPos().getX() - EnumFacing.byIndex(this.tile.getFacingInt()).getYOffset() * 2, diff --git a/src/main/java/techreborn/client/gui/GuiIronFurnace.java b/src/main/java/techreborn/client/gui/GuiIronFurnace.java index 77cd13248..f5c99ea71 100644 --- a/src/main/java/techreborn/client/gui/GuiIronFurnace.java +++ b/src/main/java/techreborn/client/gui/GuiIronFurnace.java @@ -31,6 +31,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import techreborn.init.TRContent; import techreborn.tiles.machine.iron.TileIronFurnace; +import reborncore.client.gui.builder.GuiBase; public class GuiIronFurnace extends GuiBase { @@ -48,7 +49,7 @@ public class GuiIronFurnace extends GuiBase { @Override protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) { - this.drawDefaultBackground(); + drawDefaultBackground(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); builder.drawSlotTab(this, guiLeft, guiTop, p_146976_2_, p_146976_3_, upgrades, new ItemStack(TRContent.WRENCH)); this.mc.getTextureManager().bindTexture(GuiIronFurnace.texture); @@ -58,24 +59,22 @@ public class GuiIronFurnace extends GuiBase { int j = 0; - j = this.furnace.gaugeProgressScaled(24); + j = furnace.gaugeProgressScaled(24); if (j > 0) { - this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16); + drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16); } - j = this.furnace.gaugeFuelScaled(12); + j = furnace.gaugeFuelScaled(12); if (j > 0) { - this.drawTexturedModalRect(k + 57, l + 36 + 12 - j, 176, 12 - j, 14, j + 2); + drawTexturedModalRect(k + 57, l + 36 + 12 - j, 176, 12 - j, 14, j + 2); } } @Override protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) { - final String name = I18n.format("tile.techreborn:iron_furnace.name"); - this.fontRenderer.drawString(name, this.xSize / 2 - this.fontRenderer.getStringWidth(name) / 2, 6, - 4210752); - this.fontRenderer.drawString(I18n.format("container.inventory", new Object[0]), 8, - this.ySize - 96 + 2, 4210752); + final String name = I18n.format("tile.techreborn.iron_furnace.name"); + fontRenderer.drawString(name, xSize / 2 - fontRenderer.getStringWidth(name) / 2, 6, 4210752); + fontRenderer.drawString(I18n.format("container.inventory", new Object[0]), 8, ySize - 96 + 2, 4210752); super.drawGuiContainerForegroundLayer(p_146979_1_, p_146979_2_); } @@ -83,7 +82,7 @@ public class GuiIronFurnace extends GuiBase { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { super.drawScreen(mouseX, mouseY, partialTicks); - this.renderHoveredToolTip(mouseX, mouseY); + renderHoveredToolTip(mouseX, mouseY); } } diff --git a/src/main/java/techreborn/client/gui/GuiLESU.java b/src/main/java/techreborn/client/gui/GuiLESU.java index c9585922e..1b37fd646 100644 --- a/src/main/java/techreborn/client/gui/GuiLESU.java +++ b/src/main/java/techreborn/client/gui/GuiLESU.java @@ -26,6 +26,7 @@ package techreborn.client.gui; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; +import reborncore.client.gui.builder.GuiBase; import reborncore.common.powerSystem.PowerSystem; import techreborn.tiles.storage.lesu.TileLapotronicSU; @@ -43,9 +44,9 @@ public class GuiLESU extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - this.drawSlot(62, 45, layer); - this.drawSlot(98, 45, layer); - this.drawArmourSlots(8, 18, layer); + drawSlot(62, 45, layer); + drawSlot(98, 45, layer); + drawArmourSlots(8, 18, layer); } @Override @@ -55,12 +56,11 @@ public class GuiLESU extends GuiBase { GlStateManager.pushMatrix(); GlStateManager.scale(0.6, 0.6, 1); - this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getEnergy()) + "/" - + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getMaxPower()) + " " + drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) tile.getEnergy()) + "/" + + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) 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); + builder.drawMultiEnergyBar(this, 81, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiMFE.java b/src/main/java/techreborn/client/gui/GuiMFE.java index edccae446..391999b43 100644 --- a/src/main/java/techreborn/client/gui/GuiMFE.java +++ b/src/main/java/techreborn/client/gui/GuiMFE.java @@ -26,6 +26,7 @@ package techreborn.client.gui; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; +import reborncore.client.gui.builder.GuiBase; import reborncore.common.powerSystem.PowerSystem; import techreborn.tiles.storage.TileMediumVoltageSU; @@ -43,9 +44,9 @@ public class GuiMFE extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - this.drawSlot(62, 45, layer); - this.drawSlot(98, 45, layer); - this.drawArmourSlots(8, 18, layer); + drawSlot(62, 45, layer); + drawSlot(98, 45, layer); + drawArmourSlots(8, 18, layer); } @Override @@ -56,10 +57,10 @@ public class GuiMFE extends GuiBase { if(GuiBase.slotConfigType == SlotConfigType.NONE){ 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); + drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfe.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) 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); + builder.drawMultiEnergyBar(this, 81, 28, (int) mfe.getEnergy(), (int) mfe.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiMFSU.java b/src/main/java/techreborn/client/gui/GuiMFSU.java index f2ef35c18..b6aed932e 100644 --- a/src/main/java/techreborn/client/gui/GuiMFSU.java +++ b/src/main/java/techreborn/client/gui/GuiMFSU.java @@ -26,6 +26,7 @@ package techreborn.client.gui; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; +import reborncore.client.gui.builder.GuiBase; import reborncore.common.powerSystem.PowerSystem; import techreborn.tiles.storage.TileHighVoltageSU; @@ -43,9 +44,9 @@ public class GuiMFSU extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - this.drawSlot(62, 45, layer); - this.drawSlot(98, 45, layer); - this.drawArmourSlots(8, 18, layer); + drawSlot(62, 45, layer); + drawSlot(98, 45, layer); + drawArmourSlots(8, 18, layer); } @Override @@ -55,9 +56,9 @@ public class GuiMFSU extends GuiBase { GlStateManager.pushMatrix(); GlStateManager.scale(0.6, 0.6, 1); - this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfsu.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfsu.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); + drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfsu.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfsu.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer); GlStateManager.popMatrix(); - this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.mfsu.getEnergy(), (int) this.mfsu.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawMultiEnergyBar(this, 81, 28, (int) mfsu.getEnergy(), (int) mfsu.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiManual.java b/src/main/java/techreborn/client/gui/GuiManual.java index 9f8363f55..c434b6ac8 100644 --- a/src/main/java/techreborn/client/gui/GuiManual.java +++ b/src/main/java/techreborn/client/gui/GuiManual.java @@ -57,19 +57,19 @@ public class GuiManual extends GuiScreen { @Override public void initGui() { - this.buttonList.add(new GuiButton(1, (width / 2 - 30), (height / 2 - (guiHeight / 4)) + 17, 60, 20, I18n.format("techreborn.manual.wikibtn"))); - this.buttonList.add(new GuiButton(2, (width / 2 - 30), (height / 2) + 22, 60, 20, I18n.format("techreborn.manual.discordbtn"))); + buttonList.add(new GuiButton(1, (width / 2 - 30), (height / 2 - (guiHeight / 4)) + 17, 60, 20, I18n.format("techreborn.manual.wikibtn"))); + buttonList.add(new GuiButton(2, (width / 2 - 30), (height / 2) + 22, 60, 20, I18n.format("techreborn.manual.discordbtn"))); } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - this.drawDefaultBackground(); - this.mc.getTextureManager().bindTexture(GuiManual.texture); + drawDefaultBackground(); + mc.getTextureManager().bindTexture(GuiManual.texture); int centerX = (width / 2) - guiWidth / 2; int centerY = (height / 2) - guiHeight / 2; drawTexturedModalRect(centerX, centerY, 0, 0, guiWidth, guiHeight); - this.fontRenderer.drawString(text1, ((width / 2) - this.fontRenderer.getStringWidth(text1) / 2), height / 2 - (guiHeight / 4), 4210752); - this.fontRenderer.drawString(text2, ((width / 2) - this.fontRenderer.getStringWidth(text2) / 2), height / 2 + 5, 4210752); + fontRenderer.drawString(text1, ((width / 2) - fontRenderer.getStringWidth(text1) / 2), height / 2 - (guiHeight / 4), 4210752); + fontRenderer.drawString(text2, ((width / 2) - fontRenderer.getStringWidth(text2) / 2), height / 2 + 5, 4210752); super.drawScreen(mouseX, mouseY, partialTicks); } @@ -77,7 +77,7 @@ public class GuiManual extends GuiScreen { protected void actionPerformed(GuiButton button) { switch (button.id) { case 1: - this.mc.displayGuiScreen(new GuiConfirmOpenLink(this, "http://wiki.techreborn.ovh", 1, false)); + mc.displayGuiScreen(new GuiConfirmOpenLink(this, "http://wiki.techreborn.ovh", 1, false)); break; case 2: this.mc.displayGuiScreen(new GuiConfirmOpenLink(this, "https://discord.gg/teamreborn", 2, false)); @@ -96,7 +96,7 @@ public class GuiManual extends GuiScreen { System.err.print(e); } }else { - this.mc.displayGuiScreen(this); + mc.displayGuiScreen(this); } break; case 2: @@ -107,7 +107,7 @@ public class GuiManual extends GuiScreen { System.err.print(e); } }else { - this.mc.displayGuiScreen(this); + mc.displayGuiScreen(this); } break; } diff --git a/src/main/java/techreborn/client/gui/GuiMatterFabricator.java b/src/main/java/techreborn/client/gui/GuiMatterFabricator.java index fb09107db..50865c578 100644 --- a/src/main/java/techreborn/client/gui/GuiMatterFabricator.java +++ b/src/main/java/techreborn/client/gui/GuiMatterFabricator.java @@ -25,6 +25,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import techreborn.tiles.TileMatterFabricator; public class GuiMatterFabricator extends GuiBase { @@ -41,15 +43,15 @@ public class GuiMatterFabricator extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); - this.drawScrapSlot(30, 20, layer); - this.drawScrapSlot(50, 20, layer); - this.drawScrapSlot(70, 20, layer); - this.drawScrapSlot(90, 20, layer); - this.drawScrapSlot(110, 20, layer); - this.drawScrapSlot(130, 20, layer); - this.drawOutputSlotBar(39, 65, 5, layer); + drawSlot(30, 20, layer); + drawSlot(50, 20, layer); + drawSlot(70, 20, layer); + drawSlot(90, 20, layer); + drawSlot(110, 20, layer); + drawSlot(130, 20, layer); + drawOutputSlotBar(39, 65, 5, layer); } @@ -58,7 +60,7 @@ public class GuiMatterFabricator extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final Layer layer = Layer.FOREGROUND; - //this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, TRBuilder.ProgressDirection.DOWN, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 83, 41, mouseX, mouseY, TRBuilder.ProgressDirection.DOWN, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiPlasmaGenerator.java b/src/main/java/techreborn/client/gui/GuiPlasmaGenerator.java index 4173e5a21..a5e510489 100644 --- a/src/main/java/techreborn/client/gui/GuiPlasmaGenerator.java +++ b/src/main/java/techreborn/client/gui/GuiPlasmaGenerator.java @@ -27,6 +27,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import techreborn.tiles.generator.TilePlasmaGenerator; /** @@ -54,7 +56,7 @@ public class GuiPlasmaGenerator extends GuiBase { final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; drawSlot(25, 35, layer); drawSlot(25, 55, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @@ -63,9 +65,9 @@ public class GuiPlasmaGenerator extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 130, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); - this.builder.drawTank(this, 44, 25, mouseX, mouseY, this.tile.tank.getFluid(), this.tile.tank.getCapacity(), this.tile.tank.isEmpty(), layer); + builder.drawProgressBar(this, tile.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 130, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawTank(this, 44, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer); } diff --git a/src/main/java/techreborn/client/gui/GuiQuantumChest.java b/src/main/java/techreborn/client/gui/GuiQuantumChest.java index 5bc10e48f..4bcbf4387 100644 --- a/src/main/java/techreborn/client/gui/GuiQuantumChest.java +++ b/src/main/java/techreborn/client/gui/GuiQuantumChest.java @@ -25,6 +25,7 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; +import reborncore.client.gui.builder.GuiBase; import techreborn.tiles.TileQuantumChest; public class GuiQuantumChest extends GuiBase { @@ -41,8 +42,8 @@ public class GuiQuantumChest extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; - this.drawSlot(80, 24, layer); - this.drawSlot(80, 64, layer); + drawSlot(80, 24, layer); + drawSlot(80, 64, layer); } @Override diff --git a/src/main/java/techreborn/client/gui/GuiQuantumTank.java b/src/main/java/techreborn/client/gui/GuiQuantumTank.java index d077377e5..70b9c2583 100644 --- a/src/main/java/techreborn/client/gui/GuiQuantumTank.java +++ b/src/main/java/techreborn/client/gui/GuiQuantumTank.java @@ -26,6 +26,7 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.fluids.FluidStack; +import reborncore.client.gui.builder.GuiBase; import techreborn.tiles.TileQuantumTank; public class GuiQuantumTank extends GuiBase { @@ -42,8 +43,8 @@ public class GuiQuantumTank extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - this.drawSlot(80, 17, layer); - this.drawSlot(80, 53, layer); + drawSlot(80, 17, layer); + drawSlot(80, 53, layer); } @@ -51,13 +52,13 @@ public class GuiQuantumTank extends GuiBase { protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) { super.drawGuiContainerForegroundLayer(mouseX, mouseY); - FluidStack fluid = this.quantumTank.tank.getFluid(); + FluidStack fluid = quantumTank.tank.getFluid(); if(fluid != null){ - this.fontRenderer.drawString( "Fluid Type:", 10, 20, 4210752); - this.fontRenderer.drawString(fluid.getLocalizedName() + "", 10, 30, 4210752); + fontRenderer.drawString( "Fluid Type:", 10, 20, 4210752); + fontRenderer.drawString(fluid.getLocalizedName() + "", 10, 30, 4210752); - this.fontRenderer.drawString("Fluid Amount:", 10, 50, 4210752); - this.fontRenderer.drawString(this.quantumTank.tank.getFluidAmount() + "mb", 10, 60, 4210752); + fontRenderer.drawString("Fluid Amount:", 10, 50, 4210752); + fontRenderer.drawString(quantumTank.tank.getFluidAmount() + "mb", 10, 60, 4210752); } } @@ -65,6 +66,6 @@ public class GuiQuantumTank extends GuiBase { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { super.drawScreen(mouseX, mouseY, partialTicks); - this.renderHoveredToolTip(mouseX, mouseY); + renderHoveredToolTip(mouseX, mouseY); } } diff --git a/src/main/java/techreborn/client/gui/GuiRecycler.java b/src/main/java/techreborn/client/gui/GuiRecycler.java index 94991b2ef..f4e9bdabc 100644 --- a/src/main/java/techreborn/client/gui/GuiRecycler.java +++ b/src/main/java/techreborn/client/gui/GuiRecycler.java @@ -26,6 +26,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; import techreborn.tiles.machine.tier1.TileRecycler; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; public class GuiRecycler extends GuiBase { @@ -41,10 +43,10 @@ public class GuiRecycler extends GuiBase { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); - this.drawSlot(55, 45, layer); - this.drawOutputSlot(101, 45, layer); + drawSlot(55, 45, layer); + drawOutputSlot(101, 45, layer); } @Override @@ -52,7 +54,7 @@ public class GuiRecycler extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.gaugeProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tile.gaugeProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiRollingMachine.java b/src/main/java/techreborn/client/gui/GuiRollingMachine.java index d671ced82..654f15b09 100644 --- a/src/main/java/techreborn/client/gui/GuiRollingMachine.java +++ b/src/main/java/techreborn/client/gui/GuiRollingMachine.java @@ -25,6 +25,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import reborncore.common.network.NetworkManager; import techreborn.packets.PacketRollingMachineLock; import techreborn.tiles.machine.tier1.TileRollingMachine; @@ -46,15 +48,21 @@ public class GuiRollingMachine extends GuiBase { final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; int gridYPos = 22; - this.drawSlot(30, gridYPos, layer); this.drawSlot(48, gridYPos, layer); this.drawSlot(66, gridYPos, layer); - this.drawSlot(30, gridYPos + 18, layer); this.drawSlot(48, gridYPos + 18, layer); this.drawSlot(66, gridYPos + 18, layer); - this.drawSlot(30, gridYPos + 36, layer); this.drawSlot(48, gridYPos + 36, layer); this.drawSlot(66, gridYPos + 36, layer); + drawSlot(30, gridYPos, layer); + drawSlot(48, gridYPos, layer); + drawSlot(66, gridYPos, layer); + drawSlot(30, gridYPos + 18, layer); + drawSlot(48, gridYPos + 18, layer); + drawSlot(66, gridYPos + 18, layer); + drawSlot(30, gridYPos + 36, layer); + drawSlot(48, gridYPos + 36, layer); + drawSlot(66, gridYPos + 36, layer); - this.drawSlot(8, 70, layer); - this.drawOutputSlot(124, gridYPos + 18, layer); + drawSlot(8, 70, layer); + drawOutputSlot(124, gridYPos + 18, layer); - this.builder.drawJEIButton(this, 150, 4, layer); - this.builder.drawLockButton(this, 130, 4, mouseX, mouseY, layer,rollingMachine.locked); + builder.drawJEIButton(this, 158, 5, layer); + builder.drawLockButton(this, 130, 4, mouseX, mouseY, layer,rollingMachine.locked); } @Override @@ -62,13 +70,13 @@ public class GuiRollingMachine extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.rollingMachine.getProgressScaled(100), 100, 92, 43, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 9, 17, (int) this.rollingMachine.getEnergy(), (int) this.rollingMachine.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, rollingMachine.getProgressScaled(100), 100, 92, 43, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 9, 17, (int) rollingMachine.getEnergy(), (int) rollingMachine.getMaxPower(), mouseX, mouseY, 0, layer); } @Override protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { - if(this.builder.isInRect(130 + getGuiLeft(), 4 + getGuiTop(), 20, 12, mouseX, mouseY)){ + if(builder.isInRect(130 + getGuiLeft(), 4 + getGuiTop(), 20, 12, mouseX, mouseY)){ NetworkManager.sendToServer(new PacketRollingMachineLock(rollingMachine, !rollingMachine.locked)); return; } diff --git a/src/main/java/techreborn/client/gui/GuiScrapboxinator.java b/src/main/java/techreborn/client/gui/GuiScrapboxinator.java index dc55820ce..e4baa42cd 100644 --- a/src/main/java/techreborn/client/gui/GuiScrapboxinator.java +++ b/src/main/java/techreborn/client/gui/GuiScrapboxinator.java @@ -25,6 +25,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import techreborn.tiles.machine.tier1.TileScrapboxinator; public class GuiScrapboxinator extends GuiBase { @@ -42,13 +44,13 @@ public class GuiScrapboxinator extends GuiBase { final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; // Battery slot - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); // Scrapboxes input slot - this.drawSlot(55, 45, layer); + drawSlot(55, 45, layer); // Output slot - this.drawOutputSlot(101, 45, layer); + drawOutputSlot(101, 45, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override @@ -56,7 +58,7 @@ public class GuiScrapboxinator extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiSemifluidGenerator.java b/src/main/java/techreborn/client/gui/GuiSemifluidGenerator.java index 4da93ad5e..9ecc06572 100644 --- a/src/main/java/techreborn/client/gui/GuiSemifluidGenerator.java +++ b/src/main/java/techreborn/client/gui/GuiSemifluidGenerator.java @@ -26,6 +26,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; import techreborn.tiles.generator.advanced.TileSemiFluidGenerator; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; public class GuiSemifluidGenerator extends GuiBase { @@ -42,7 +44,7 @@ public class GuiSemifluidGenerator extends GuiBase { final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; drawSlot(25, 35, layer); drawSlot(25, 55, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @@ -51,9 +53,9 @@ public class GuiSemifluidGenerator extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 130, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); - this.builder.drawTank(this, 44, 25, mouseX, mouseY, this.tile.tank.getFluid(), this.tile.tank.getCapacity(), this.tile.tank.isEmpty(), layer); + builder.drawProgressBar(this, tile.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 130, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawTank(this, 44, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiThermalGenerator.java b/src/main/java/techreborn/client/gui/GuiThermalGenerator.java index 203d46067..6e39c1dd8 100644 --- a/src/main/java/techreborn/client/gui/GuiThermalGenerator.java +++ b/src/main/java/techreborn/client/gui/GuiThermalGenerator.java @@ -25,6 +25,8 @@ package techreborn.client.gui; import net.minecraft.entity.player.EntityPlayer; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import techreborn.tiles.generator.advanced.TileThermalGenerator; public class GuiThermalGenerator extends GuiBase { @@ -42,7 +44,7 @@ public class GuiThermalGenerator extends GuiBase { final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; drawSlot(25, 35, layer); drawSlot(25, 55, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @@ -51,9 +53,9 @@ public class GuiThermalGenerator extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 130, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); - this.builder.drawTank(this, 44, 25, mouseX, mouseY, this.tile.tank.getFluid(), this.tile.tank.getCapacity(), this.tile.tank.isEmpty(), layer); + builder.drawProgressBar(this, tile.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 130, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawTank(this, 44, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer); } } diff --git a/src/main/java/techreborn/client/gui/GuiVacuumFreezer.java b/src/main/java/techreborn/client/gui/GuiVacuumFreezer.java index 40433f8b3..1c2b9b907 100644 --- a/src/main/java/techreborn/client/gui/GuiVacuumFreezer.java +++ b/src/main/java/techreborn/client/gui/GuiVacuumFreezer.java @@ -28,12 +28,15 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.BlockPos; +import reborncore.ClientProxy; +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.TRBuilder; import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockSet; -import techreborn.client.gui.widget.GuiButtonHologram; +import techreborn.blocks.BlockMachineCasing; +import reborncore.client.gui.builder.widget.GuiButtonHologram; import techreborn.init.TRContent; -import techreborn.proxies.ClientProxy; import techreborn.tiles.machine.multiblock.TileVacuumFreezer; import java.io.IOException; @@ -59,14 +62,14 @@ public class GuiVacuumFreezer extends GuiBase { final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; // Battery slot - this.drawSlot(8, 72, layer); + drawSlot(8, 72, layer); // Input slots - this.drawSlot(8, 72, layer); - this.drawSlot(55, 45, layer); + drawSlot(8, 72, layer); + drawSlot(55, 45, layer); // Output slot - this.drawOutputSlot(101, 45, layer); + drawOutputSlot(101, 45, layer); - this.builder.drawJEIButton(this, 150, 4, layer); + builder.drawJEIButton(this, 158, 5, layer); } @Override @@ -74,8 +77,8 @@ public class GuiVacuumFreezer extends GuiBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); - this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer); if (tile.getMultiBlock()) { addHologramButton(6, 4, 212, layer); builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); @@ -104,22 +107,22 @@ public class GuiVacuumFreezer extends GuiBase { { // This code here makes a basic multiblock and then sets to the selected one. final Multiblock multiblock = new Multiblock(); - IBlockState reinforcedCasing = TRContent.MachineBlocks.ADVANCED.getCasing().getDefaultState(); + IBlockState reinforcedCasing = TRContent.MachineBlocks.ADVANCED.getCasing().getDefaultState(); - this.addComponent(0, -1, 0, reinforcedCasing, multiblock); - this.addComponent(1, -1, 0, reinforcedCasing, multiblock); - this.addComponent(0, -1, 1, reinforcedCasing, multiblock); - this.addComponent(-1, -1, 0, reinforcedCasing, multiblock); - this.addComponent(0, -1, -1, reinforcedCasing, multiblock); - this.addComponent(-1, -1, -1, reinforcedCasing, multiblock); - this.addComponent(-1, -1, 1, reinforcedCasing, multiblock); - this.addComponent(1, -1, -1, reinforcedCasing, multiblock); - this.addComponent(1, -1, 1, reinforcedCasing, multiblock); + addComponent(0, -1, 0, reinforcedCasing, multiblock); + addComponent(1, -1, 0, reinforcedCasing, multiblock); + addComponent(0, -1, 1, reinforcedCasing, multiblock); + addComponent(-1, -1, 0, reinforcedCasing, multiblock); + addComponent(0, -1, -1, reinforcedCasing, multiblock); + addComponent(-1, -1, -1, reinforcedCasing, multiblock); + addComponent(-1, -1, 1, reinforcedCasing, multiblock); + addComponent(1, -1, -1, reinforcedCasing, multiblock); + addComponent(1, -1, 1, reinforcedCasing, multiblock); final MultiblockSet set = new MultiblockSet(multiblock); ClientProxy.multiblockRenderEvent.setMultiblock(set); - ClientProxy.multiblockRenderEvent.parent = this.tile.getPos(); - MultiblockRenderEvent.anchor = this.tile.getPos().down(); + ClientProxy.multiblockRenderEvent.parent = tile.getPos(); + MultiblockRenderEvent.anchor = tile.getPos().down(); } } else { ClientProxy.multiblockRenderEvent.setMultiblock(null); diff --git a/src/main/java/techreborn/client/gui/TRBuilder.java b/src/main/java/techreborn/client/gui/TRBuilder.java deleted file mode 100644 index 4d6d273c4..000000000 --- a/src/main/java/techreborn/client/gui/TRBuilder.java +++ /dev/null @@ -1,542 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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; - -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.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.common.Loader; -import reborncore.api.tile.IUpgradeable; -import reborncore.client.gui.guibuilder.GuiBuilder; -import reborncore.common.powerSystem.PowerSystem; -import reborncore.common.powerSystem.TilePowerAcceptor; -import techreborn.TechReborn; -import techreborn.init.TRContent; -import techreborn.proxies.ClientProxy; - -import java.util.ArrayList; -import java.util.List; - -import static net.minecraft.item.ItemStack.EMPTY; - -/** - * Created by Prospector - */ -public class TRBuilder extends GuiBuilder { - public static final ResourceLocation GUI_SHEET = new ResourceLocation(TechReborn.MOD_ID.toLowerCase() + ":" + "textures/gui/gui_sheet.png"); - - public TRBuilder() { - super(GUI_SHEET); - } - - public void drawMultiEnergyBar(GuiBase gui, int x, int y, int energyStored, int maxEnergyStored, int mouseX, int mouseY, int buttonID, GuiBase.Layer layer) { - if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){ - return; - } - if (layer == GuiBase.Layer.BACKGROUND) { - x += gui.getGuiLeft(); - y += gui.getGuiTop(); - } - if (layer == GuiBase.Layer.FOREGROUND) { - mouseX -= gui.getGuiLeft(); - mouseY -= gui.getGuiTop(); - } - Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET); - - gui.drawTexturedModalRect(x, y, PowerSystem.getDisplayPower().xBar - 15, PowerSystem.getDisplayPower().yBar - 1, 14, 50); - - int draw = (int) ((double) energyStored / (double) maxEnergyStored * (48)); - if (energyStored > maxEnergyStored) { - draw = (int) ((double) maxEnergyStored / (double) maxEnergyStored * (48)); - } - gui.drawTexturedModalRect(x + 1, y + 49 - draw, PowerSystem.getDisplayPower().xBar, 48 + PowerSystem.getDisplayPower().yBar - draw, 12, draw); - int percentage = percentage(maxEnergyStored, energyStored); - if (isInRect(x + 1, y + 1, 11, 48, mouseX, mouseY)) { - List list = new ArrayList<>(); - TextFormatting powerColour = TextFormatting.GOLD; - list.add(powerColour + PowerSystem.getLocaliszedPowerFormattedNoSuffix(energyStored) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix(maxEnergyStored) + " " + PowerSystem.getDisplayPower().abbreviation); - list.add(getPercentageColour(percentage) + "" + percentage + "%" + TextFormatting.GRAY + " Charged"); - if(gui.tile instanceof TilePowerAcceptor && GuiScreen.isShiftKeyDown()){ - ((TilePowerAcceptor) gui.tile).addInfo(list, true, false); - list.add(""); - list.add(TextFormatting.BLUE + "Click to change display unit"); - } else { - list.add(""); - list.add(TextFormatting.BLUE + "Shift" + TextFormatting.GRAY + " for more info"); - } - 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); - } - gui.addPowerButton(x, y, buttonID, layer); - } - - public void drawProgressBar(GuiBase gui, int progress, int maxProgress, int x, int y, int mouseX, int mouseY, ProgressDirection direction, GuiBase.Layer layer) { - if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){ - return; - } - if (layer == GuiBase.Layer.BACKGROUND) { - x += gui.getGuiLeft(); - y += gui.getGuiTop(); - } - if (layer == GuiBase.Layer.FOREGROUND) { - mouseX -= gui.getGuiLeft(); - mouseY -= gui.getGuiTop(); - } - - gui.mc.getTextureManager().bindTexture(GUI_SHEET); - gui.drawTexturedModalRect(x, y, direction.x, direction.y, direction.width, direction.height); - - if (direction.equals(ProgressDirection.RIGHT)) { - int j = (int) ((double) progress / (double) maxProgress * 16); - if (j < 0) - j = 0; - gui.drawTexturedModalRect(x, y, direction.xActive, direction.yActive, j, 10); - } - - if (direction.equals(ProgressDirection.LEFT)) { - int j = (int) ((double) progress / (double) maxProgress * 16); - if (j < 0) - j = 0; - gui.drawTexturedModalRect(x + 16 - j, y, direction.xActive + 16 - j, direction.yActive, j, 10); - } - - if (direction.equals(ProgressDirection.UP)) { - int j = (int) ((double) progress / (double) maxProgress * 16); - if (j < 0) - j = 0; - gui.drawTexturedModalRect(x, y + 16 - j, direction.xActive, direction.yActive + 16 - j, 10, j); - } - - - if (isInRect(x, y, direction.width, direction.height, mouseX, mouseY)) { - int percentage = percentage(maxProgress, progress); - List list = new ArrayList<>(); - list.add(getPercentageColour(percentage) + "" + percentage + "%"); - 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 drawTank(GuiBase gui, int x, int y, int mouseX, int mouseY, FluidStack fluid, int maxCapacity, boolean isTankEmpty, GuiBase.Layer layer) { - if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){ - return; - } - if (layer == GuiBase.Layer.BACKGROUND) { - x += gui.getGuiLeft(); - y += gui.getGuiTop(); - } - if (layer == GuiBase.Layer.FOREGROUND) { - mouseX -= gui.getGuiLeft(); - mouseY -= gui.getGuiTop(); - } - int percentage = 0; - int amount = 0; - boolean empty = true; - if (!isTankEmpty) { - amount = fluid.amount; - percentage = percentage(maxCapacity, amount); - empty = false; - } - gui.mc.getTextureManager().bindTexture(GUI_SHEET); - gui.drawTexturedModalRect(x, y, 228, 18, 22, 56); - if (!empty) - drawFluid(gui, fluid, x + 4, y + 4, 14, 48, maxCapacity); - gui.drawTexturedModalRect(x + 3, y + 3, 231, 74, 16, 50); - - if (isInRect(x, y, 22, 56, mouseX, mouseY)) { - List list = new ArrayList<>(); - if (empty) - list.add(TextFormatting.GOLD + "Empty Tank"); - else - list.add(TextFormatting.GOLD + "" + amount + "mB/" + maxCapacity + "mB " + fluid.getLocalizedName()); - list.add(getPercentageColour(percentage) + "" + percentage + "%" + TextFormatting.GRAY + " Full"); - 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 drawFluid(GuiBase gui, FluidStack fluid, int x, int y, int width, int height, int maxCapacity) { - gui.mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); - y += height; - final ResourceLocation still = fluid.getFluid().getStill(fluid); - final TextureAtlasSprite sprite = gui.mc.getTextureMapBlocks().getAtlasSprite(still.toString()); - - final int drawHeight = (int) (fluid.amount / (maxCapacity * 1F) * height); - final int iconHeight = sprite.getIconHeight(); - int offsetHeight = drawHeight; - - int iteration = 0; - while (offsetHeight != 0) { - final int curHeight = offsetHeight < iconHeight ? offsetHeight : iconHeight; - gui.drawTexturedModalRect(x, y - offsetHeight, sprite, width, curHeight); - offsetHeight -= curHeight; - iteration++; - if (iteration > 50) - break; - } - gui.mc.getTextureManager().bindTexture(GUI_SHEET); - } - - public void drawJEIButton(GuiBase gui, int x, int y, GuiBase.Layer layer) { - if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){ - return; - } - if (Loader.isModLoaded("jei")) { - if (layer == GuiBase.Layer.BACKGROUND) { - x += gui.getGuiLeft(); - y += gui.getGuiTop(); - } - gui.mc.getTextureManager().bindTexture(GUI_SHEET); - gui.drawTexturedModalRect(x, y, 184, 70, 20, 12); - } - } - - public void drawLockButton(GuiBase gui, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer, boolean locked) { - if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){ - return; - } - if (layer == GuiBase.Layer.BACKGROUND) { - x += gui.getGuiLeft(); - y += gui.getGuiTop(); - } - gui.mc.getTextureManager().bindTexture(GUI_SHEET); - gui.drawTexturedModalRect(x, y, 204, 70 + (locked ? 12 : 0) , 20, 12); - if (isInRect(x, y, 20, 12, mouseX, mouseY)) { - List list = new ArrayList<>(); - if(locked){ - list.add("Unlock items"); - } else { - list.add("Lock Items"); - } - - GlStateManager.pushMatrix(); - net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(list, mouseX, mouseY, gui.width, gui.height, 80, gui.mc.fontRenderer); - GlStateManager.popMatrix(); - } - } - - public void drawHologramButton(GuiBase gui, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer) { - if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){ - return; - } - if (layer == GuiBase.Layer.BACKGROUND) { - x += gui.getGuiLeft(); - y += gui.getGuiTop(); - } - if (layer == GuiBase.Layer.FOREGROUND) { - mouseX -= gui.getGuiLeft(); - mouseY -= gui.getGuiTop(); - } - gui.mc.getTextureManager().bindTexture(GUI_SHEET); - if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { - gui.drawTexturedModalRect(x, y, 184, 94, 20, 12); - } else { - gui.drawTexturedModalRect(x, y, 184, 106, 20, 12); - } - if (isInRect(x, y, 20, 12, mouseX, mouseY)) { - List list = new ArrayList<>(); - list.add("Toggle Multiblock Hologram"); - GlStateManager.pushMatrix(); - net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(list, mouseX, mouseY, gui.width, gui.height, -1, gui.mc.fontRenderer); - GlStateManager.popMatrix(); - } - } - - public void drawUpDownButtons(GuiBase gui, int x, int y, GuiBase.Layer layer){ - if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){ - return; - } - if (layer == GuiBase.Layer.BACKGROUND) { - x += gui.getGuiLeft(); - y += gui.getGuiTop(); - } - gui.mc.getTextureManager().bindTexture(GUI_SHEET); - gui.drawTexturedModalRect(x, y, 150, 70, 12, 12); - gui.drawTexturedModalRect(x + 12, y, 150, 82, 12, 12); - gui.drawTexturedModalRect(x + 24, y, 150, 94, 12, 12); - gui.drawTexturedModalRect(x + 36, y, 150, 106, 12, 12); - } - - public void drawUpDownButtonsSmall(GuiBase gui, int x, int y, GuiBase.Layer layer){ - if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){ - return; - } - if (layer == GuiBase.Layer.BACKGROUND) { - x += gui.getGuiLeft(); - y += gui.getGuiTop(); - } - gui.mc.getTextureManager().bindTexture(GUI_SHEET); - //gui.drawTexturedModalRect(x, y, 150, 70, 12, 12); - gui.drawTexturedModalRect(x + 12, y, 150, 82, 12, 12); - gui.drawTexturedModalRect(x + 24, y, 150, 94, 12, 12); - //gui.drawTexturedModalRect(x + 36, y, 150, 106, 12, 12); - } - - public void drawEnergyOutput(GuiBase gui, int right, int top, int maxOutput, GuiBase.Layer layer){ - if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){ - return; - } - String text = PowerSystem.getLocaliszedPowerFormattedNoSuffix(maxOutput) + " " - + PowerSystem.getDisplayPower().abbreviation + "/t"; - int width = gui.mc.fontRenderer.getStringWidth(text); - gui.drawString(text, right - 17 - width, top + 5, 0, layer); - - if (layer == GuiBase.Layer.BACKGROUND) { - right += gui.getGuiLeft(); - top += gui.getGuiTop(); - } - gui.mc.getTextureManager().bindTexture(GUI_SHEET); - gui.drawTexturedModalRect(right - 16, top, 162, 101, 16, 17); - } - - public void drawBigBlueBar(GuiBase gui, int x, int y, int value, int max, int mouseX, int mouseY, String suffix, GuiBase.Layer layer) { - if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){ - return; - } - if (layer == GuiBase.Layer.BACKGROUND) { - x += gui.getGuiLeft(); - y += gui.getGuiTop(); - } - gui.mc.getTextureManager().bindTexture(GUI_SHEET); - if (!suffix.equals("")) { - suffix = " " + suffix; - } - gui.drawTexturedModalRect(x, y, 0, 218, 114, 18); - int j = (int) ((double) value / (double) max * 106); - if (j < 0) - j = 0; - gui.drawTexturedModalRect(x + 4, y + 4, 0, 236, j, 10); - gui.drawCentredString(value + suffix, y + 5, 0xFFFFFF, layer); - if (isInRect(x, y, 114, 18, mouseX, mouseY)) { - int percentage = percentage(max, value); - List list = new ArrayList<>(); - list.add("" + TextFormatting.GOLD + value + "/" + max + suffix); - list.add(getPercentageColour(percentage) + "" + percentage + "%" + TextFormatting.GRAY + " Full"); - - if (value > max) { - list.add(TextFormatting.GRAY + "Yo this is storing more than it should be able to"); - list.add(TextFormatting.GRAY + "prolly a bug"); - list.add(TextFormatting.GRAY + "pls report and tell how tf you did this"); - } - 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 drawBigHeatBar(GuiBase gui, int x, int y, int value, int max, GuiBase.Layer layer) { - if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){ - return; - } - if (layer == GuiBase.Layer.BACKGROUND) { - x += gui.getGuiLeft(); - y += gui.getGuiTop(); - } - gui.mc.getTextureManager().bindTexture(GUI_SHEET); - gui.drawTexturedModalRect(x, y, 0, 218, 114, 18); - if (value != 0) { - int j = (int) ((double) value / (double) max * 106); - if (j < 0) - j = 0; - gui.drawTexturedModalRect(x + 4, y + 4, 0, 246, j, 10); - gui.drawCentredString(value + " Heat", y + 5, 0xFFFFFF, layer); - - } - } - - public void drawMultiblockMissingBar(GuiBase gui, GuiBase.Layer layer) { - if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){ - return; - } - int x = 0; - int y = 4; - if (layer == GuiBase.Layer.BACKGROUND) { - x += gui.getGuiLeft(); - y += gui.getGuiTop(); - } - gui.mc.getTextureManager().bindTexture(GUI_SHEET); - GlStateManager.disableLighting(); - GlStateManager.disableDepth(); - GlStateManager.colorMask(true, true, true, false); - GuiUtils.drawGradientRect(0, x, y, x + 176, y + 20, 0x000000, 0xC0000000); - GuiUtils.drawGradientRect(0, x, y + 20, x + 176, y + 20 + 48, 0xC0000000, 0xC0000000); - GuiUtils.drawGradientRect(0, x, y + 68, x + 176, y + 70 + 20, 0xC0000000, 0x00000000); - GlStateManager.colorMask(true, true, true, true); - GlStateManager.enableDepth(); - gui.drawCentredString(I18n.format("techreborn.message.missingmultiblock"), 43, 0xFFFFFF, layer); - } - - public void drawBigBlueBar(GuiBase gui, int x, int y, int value, int max, int mouseX, int mouseY, GuiBase.Layer layer) { - drawBigBlueBar(gui, x, y, value, max, mouseX, mouseY, "", layer); - } - - public void drawSelectedStack(GuiBase gui, int x, int y) { - Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET); - gui.drawTexturedModalRect(x - 4, y - 4, 202, 44, 24, 24); - } - - public void drawBurnBar(GuiBase gui, int progress, int maxProgress, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer) { - if (layer == GuiBase.Layer.BACKGROUND) { - x += gui.getGuiLeft(); - y += gui.getGuiTop(); - } - if (layer == GuiBase.Layer.FOREGROUND) { - mouseX -= gui.getGuiLeft(); - mouseY -= gui.getGuiTop(); - } - - gui.mc.getTextureManager().bindTexture(GUI_SHEET); - gui.drawTexturedModalRect(x, y, 171, 84, 13, 13); - int j = 13 - (int) ((double) progress / (double) maxProgress * 13); - if (j > 0) { - gui.drawTexturedModalRect(x, y + j, 171, 70 + j, 13, 13 - j); - - } - if (isInRect(x, y, 12, 12, mouseX, mouseY)) { - int percentage = percentage(maxProgress, progress); - List list = new ArrayList<>(); - list.add(getPercentageColour(percentage) + "" + percentage + "%"); - 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); - } - } - - @Override - public void drawSlot(GuiScreen gui, int posX, int posY) { - Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET); - gui.drawTexturedModalRect(posX, posY, 150, 0, 18, 18); - } - - public void drawUpgrades(GuiScreen gui, IUpgradeable upgradeable, int posX, int posY) { - Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET); - 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, ItemStack stack){ - int offset = -1; - if(!upgrades){ - offset = 80; - } - Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET); - gui.drawTexturedModalRect(posX - 26, posY + 84 - offset, 157, 148, 30, 30); - renderItemStack(new ItemStack(TRContent.WRENCH), posX - 19, posY + 92 - offset); - } - - public void renderItemStack(ItemStack stack, int x, int y) { - if (stack != EMPTY) { - GlStateManager.enableBlend(); - GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); - RenderHelper.enableGUIStandardItemLighting(); - - RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem(); - itemRenderer.renderItemAndEffectIntoGUI(stack, x, y); - - GlStateManager.disableLighting(); - } - } - - public void drawScrapSlot(GuiScreen gui, int posX, int posY) { - Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET); - gui.drawTexturedModalRect(posX, posY, 150, 0, 18, 18); - } - - public void drawOutputSlotBar(GuiScreen gui, int posX, int posY, int count) { - Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET); - for (int i = 1; i <= count; i++) { - if (i == 1) { - gui.drawTexturedModalRect(posX, posY, 125 + 39, 218, 22, 26); - posX += 22; - if (1 == count) { - gui.drawTexturedModalRect(posX, posY, 147 + 39, 218, 4, 26); - } - } else if (i != 1 && i != count) { - gui.drawTexturedModalRect(posX, posY, 127 + 39, 218, 20, 26); - posX += 20; - } else if (i == count) { - gui.drawTexturedModalRect(posX, posY, 127 + 39, 218, 24, 26); - posX += 24; - } - } - } - - @Override - public void drawOutputSlot(GuiScreen gui, int posX, int posY) { - Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET); - gui.drawTexturedModalRect(posX, posY, 150, 18, 26, 26); - } - - 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 percentage(int MaxValue, int CurrentValue) { - if (CurrentValue == 0) - return 0; - return (int) ((CurrentValue * 100.0f) / MaxValue); - } - - public enum ProgressDirection { - RIGHT(84, 151, 100, 151, 16, 10), LEFT(100, 161, 84, 161, 16, 10), DOWN(104, 171, 114, 171, 10, 16), UP(84, 171, 94, 171, 10, 16); - public int x; - public int y; - public int xActive; - public int yActive; - public int width; - public int height; - - ProgressDirection(int x, int y, int xActive, int yActive, int width, int height) { - this.x = x; - this.y = y; - this.xActive = xActive; - this.yActive = yActive; - this.width = width; - this.height = height; - } - } -} diff --git a/src/main/java/techreborn/client/gui/slot/GuiFluidConfiguration.java b/src/main/java/techreborn/client/gui/slot/GuiFluidConfiguration.java deleted file mode 100644 index 3c9bab45f..000000000 --- a/src/main/java/techreborn/client/gui/slot/GuiFluidConfiguration.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.Minecraft; -import net.minecraftforge.client.event.GuiScreenEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import org.lwjgl.input.Keyboard; -import reborncore.common.tile.TileMachineBase; -import techreborn.client.gui.GuiBase; -import techreborn.client.gui.slot.elements.ConfigFluidElement; -import techreborn.client.gui.slot.elements.ElementBase; -import techreborn.client.gui.slot.elements.SlotType; - -import javax.annotation.Nullable; -import java.io.IOException; -import java.util.Collections; -import java.util.List; - -public class GuiFluidConfiguration { - - static ConfigFluidElement fluidConfigElement; - - public static void init(GuiBase guiBase) { - fluidConfigElement = new ConfigFluidElement(guiBase.getMachine().getTank(), SlotType.NORMAL, 35 - guiBase.guiLeft + 50, 35 - guiBase.guiTop - 25, guiBase); - } - - public static void draw(GuiBase guiBase, int mouseX, int mouseY) { - fluidConfigElement.draw(guiBase); - } - - @SubscribeEvent - public static void keyboardEvent(GuiScreenEvent.KeyboardInputEvent event) { - if (GuiBase.slotConfigType == GuiBase.SlotConfigType.FLUIDS && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { - GuiBase.slotConfigType = GuiBase.SlotConfigType.NONE; - event.setCanceled(true); - } - } - - public static List getVisibleElements() { - return Collections.singletonList(fluidConfigElement); - } - - public static boolean mouseClicked(int mouseX, int mouseY, int mouseButton, GuiBase guiBase) throws IOException { - if (mouseButton == 0) { - for (ConfigFluidElement configFluidElement : getVisibleElements()) { - for (ElementBase element : configFluidElement.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; - } - } - } - } - return !getVisibleElements().isEmpty(); - } - - public static void mouseClickMove(int mouseX, int mouseY, int mouseButton, long timeSinceLastClick, GuiBase guiBase) { - if (mouseButton == 0) { - for (ConfigFluidElement configFluidElement : getVisibleElements()) { - for (ElementBase element : configFluidElement.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 (ConfigFluidElement configFluidElement : getVisibleElements()) { - if (configFluidElement.isInRect(guiBase, configFluidElement.x, configFluidElement.y, configFluidElement.getWidth(guiBase.getMachine()), configFluidElement.getHeight(guiBase.getMachine()), mouseX, mouseY)) { - clicked = true; - } - for (ElementBase element : Lists.reverse(configFluidElement.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; - } - - @Nullable - private static TileMachineBase getMachine() { - if (!(Minecraft.getMinecraft().currentScreen instanceof GuiBase)) { - return null; - } - GuiBase base = (GuiBase) Minecraft.getMinecraft().currentScreen; - if (!(base.tile instanceof TileMachineBase)) { - return null; - } - TileMachineBase machineBase = (TileMachineBase) base.tile; - return machineBase; - } - -} diff --git a/src/main/java/techreborn/client/gui/slot/GuiSlotConfiguration.java b/src/main/java/techreborn/client/gui/slot/GuiSlotConfiguration.java deleted file mode 100644 index 284a0f60a..000000000 --- a/src/main/java/techreborn/client/gui/slot/GuiSlotConfiguration.java +++ /dev/null @@ -1,271 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.inventory.Slot; -import net.minecraft.util.text.TextComponentString; -import net.minecraftforge.client.event.GuiScreenEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.SlotItemHandler; -import org.lwjgl.input.Keyboard; -import reborncore.client.gui.GuiUtil; -import reborncore.common.network.NetworkManager; -import reborncore.common.network.packet.PacketConfigSave; -import reborncore.common.tile.TileMachineBase; -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 javax.annotation.Nullable; -import java.awt.*; -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(); - IItemHandler itemHandler = getMachine().getInventoryForTile().orElseGet(null); - if(itemHandler == null){ - return; - } - - BuiltContainer container = guiBase.container; - for (Slot slot : container.inventorySlots) { - if(!(slot instanceof SlotItemHandler)){ - continue; - } else if (((SlotItemHandler) slot).getItemHandler() != itemHandler){ - continue; - } - ConfigSlotElement slotElement = new ConfigSlotElement(guiBase.getMachine().getInventoryForTile().get(), 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) { - IItemHandler itemHandler = getMachine().getInventoryForTile().orElseGet(null); - if(itemHandler == null){ - return; - } - BuiltContainer container = guiBase.container; - for (Slot slot : container.inventorySlots) { - if(!(slot instanceof SlotItemHandler)){ - continue; - } else if (((SlotItemHandler) slot).getItemHandler() != itemHandler){ - 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 void copyToClipboard(){ - TileMachineBase machine = getMachine(); - if(machine == null || machine.slotConfiguration == null){ - return; - } - String json = machine.slotConfiguration.toJson(machine.getClass().getCanonicalName()); - GuiScreen.setClipboardString(json); - Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Slot configuration copyied to clipboard")); - } - - public static void pasteFromClipboard(){ - TileMachineBase machine = getMachine(); - if(machine == null || machine.slotConfiguration == null){ - return; - } - String json = GuiScreen.getClipboardString(); - try { - machine.slotConfiguration.readJson(json, machine.getClass().getCanonicalName()); - NetworkManager.sendToServer(new PacketConfigSave(machine.getPos(), machine.slotConfiguration)); - Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Slot configuration loaded from clipboard")); - } catch (UnsupportedOperationException e) { - Minecraft.getMinecraft().player.sendMessage(new TextComponentString(e.getMessage())); - } - } - - @Nullable - private static TileMachineBase getMachine(){ - if(!(Minecraft.getMinecraft().currentScreen instanceof GuiBase)){ - return null; - } - GuiBase base = (GuiBase) Minecraft.getMinecraft().currentScreen; - if(!(base.tile instanceof TileMachineBase)){ - return null; - } - TileMachineBase machineBase = (TileMachineBase) base.tile; - return machineBase; - } - - public static boolean mouseClicked(int mouseX, int mouseY, int mouseButton, 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.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()) { - IItemHandler itemHandler = getMachine().getInventoryForTile().orElseGet(null); - for (Slot slot : container.inventorySlots) { - if(!(slot instanceof SlotItemHandler)){ - continue; - } else if (((SlotItemHandler) slot).getItemHandler() != itemHandler){ - 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.slotConfigType != GuiBase.SlotConfigType.ITEMS || slectedSlot == -1){ - return Collections.emptyList(); - } - List list = new ArrayList<>(); - ConfigSlotElement slotElement = slotElementMap.get(slectedSlot); - - if(slotElement == null || guiBase == null){ - return Collections.emptyList(); - } - - //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 deleted file mode 100644 index 11f515f05..000000000 --- a/src/main/java/techreborn/client/gui/slot/elements/ButtonElement.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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 { - @SuppressWarnings("unused") - 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 deleted file mode 100644 index 3fc3e96c1..000000000 --- a/src/main/java/techreborn/client/gui/slot/elements/CheckBoxElement.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.TileMachineBase; -import techreborn.client.gui.GuiBase; - -import java.util.function.Predicate; - -public class CheckBoxElement extends ElementBase { - public String label, type; - public int labelColor, slotID; - public TileMachineBase machineBase; - Predicate ticked; - - private Sprite.CheckBox checkBoxSprite; - - public CheckBoxElement(String label, int labelColor, int x, int y, String type, int slotID, Sprite.CheckBox checkBoxSprite, TileMachineBase machineBase, Predicate ticked) { - super(x, y, checkBoxSprite.getNormal()); - this.checkBoxSprite = checkBoxSprite; - this.type = type; - this.slotID = slotID; - this.machineBase = machineBase; - this.label = label; - this.labelColor = labelColor; - this.ticked = ticked; - if (ticked.test(this)) { - container.setSprite(0, checkBoxSprite.getTicked()); - } else { - container.setSprite(0, checkBoxSprite.getNormal()); - } - this.addPressAction((element, gui, provider, mouseX, mouseY) -> { - if (ticked.test(this)) { - 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(ticked.test(this)){ - 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); - } - -} diff --git a/src/main/java/techreborn/client/gui/slot/elements/ConfigFluidElement.java b/src/main/java/techreborn/client/gui/slot/elements/ConfigFluidElement.java deleted file mode 100644 index ef1716b20..000000000 --- a/src/main/java/techreborn/client/gui/slot/elements/ConfigFluidElement.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.util.Tank; -import techreborn.client.gui.GuiBase; - -import java.util.ArrayList; -import java.util.List; - -public class ConfigFluidElement extends ElementBase { - SlotType type; - Tank tank; - public List elements = new ArrayList<>(); - boolean filter = false; - - public ConfigFluidElement(Tank tank, SlotType type, int x, int y, GuiBase gui) { - super(x, y, type.getButtonSprite()); - this.type = type; - this.tank = tank; - - FluidConfigPopupElement popupElement; - - elements.add(popupElement = new FluidConfigPopupElement(x - 22, y - 22, this)); - elements.add(new ButtonElement(x + 37, y - 25, Sprite.EXIT_BUTTON).addReleaseAction((element, gui1, provider, mouseX, mouseY) -> { - GuiBase.slotConfigType = GuiBase.SlotConfigType.NONE; - return true; - })); - - elements.add(new CheckBoxElement("Pull In", 0xFFFFFFFF, x - 26, y + 42, "input", 0, Sprite.LIGHT_CHECK_BOX, gui.getMachine(), - checkBoxElement -> checkBoxElement.machineBase.fluidConfiguration.autoInput()).addPressAction((element, gui12, provider, mouseX, mouseY) -> { - popupElement.updateCheckBox((CheckBoxElement) element, "input", gui12); - return true; - })); - elements.add(new CheckBoxElement("Pump Out", 0xFFFFFFFF, x - 26, y + 57, "output", 0, Sprite.LIGHT_CHECK_BOX, gui.getMachine(), - checkBoxElement -> checkBoxElement.machineBase.fluidConfiguration.autoOutput()).addPressAction((element, gui13, provider, mouseX, mouseY) -> { - popupElement.updateCheckBox((CheckBoxElement) element, "output", gui13); - return true; - })); - - setWidth(85); - setHeight(105 + (filter ? 15 : 0)); - } - - @Override - public void draw(GuiBase gui) { - super.draw(gui); - if (isHovering) { - drawSprite(gui, type.getButtonHoverOverlay(), x, y); - } - elements.forEach(elementBase -> elementBase.draw(gui)); - } - - public SlotType getType() { - return type; - } -} \ No newline at end of file diff --git a/src/main/java/techreborn/client/gui/slot/elements/ConfigSlotElement.java b/src/main/java/techreborn/client/gui/slot/elements/ConfigSlotElement.java deleted file mode 100644 index cdd18f109..000000000 --- a/src/main/java/techreborn/client/gui/slot/elements/ConfigSlotElement.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.item.ItemStack; -import net.minecraftforge.items.IItemHandler; -import reborncore.api.recipe.IRecipeCrafterProvider; -import reborncore.common.recipes.RecipeCrafter; -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; - IItemHandler inventory; - int id; - public List elements = new ArrayList<>(); - boolean filter = false; - - - public ConfigSlotElement(IItemHandler 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; - GuiBase.slotConfigType = GuiBase.SlotConfigType.NONE; - return true; - })); - - elements.add(new CheckBoxElement("Auto Input", 0xFFFFFFFF, x - 26, y + 42, "input", slotId, Sprite.LIGHT_CHECK_BOX, gui.getMachine(), - checkBoxElement -> checkBoxElement.machineBase.slotConfiguration.getSlotDetails(checkBoxElement.slotID).autoInput()).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(), - checkBoxElement -> checkBoxElement.machineBase.slotConfiguration.getSlotDetails(checkBoxElement.slotID).autoOutput()).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(), - checkBoxElement -> checkBoxElement.machineBase.slotConfiguration.getSlotDetails(checkBoxElement.slotID).filter()).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 deleted file mode 100644 index e1b68fa57..000000000 --- a/src/main/java/techreborn/client/gui/slot/elements/ElementBase.java +++ /dev/null @@ -1,395 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.gui.guibuilder.GuiBuilder; -import reborncore.common.tile.TileMachineBase; -import techreborn.TechReborn; -import techreborn.client.gui.GuiBase; - -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(TechReborn.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(TileMachineBase 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(TileMachineBase provider) { - adjustDimensions(provider); - return width; - } - - public int getHeight(TileMachineBase 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(TileMachineBase 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(TileMachineBase 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(TileMachineBase 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(TileMachineBase 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, TileMachineBase 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/FluidConfigPopupElement.java b/src/main/java/techreborn/client/gui/slot/elements/FluidConfigPopupElement.java deleted file mode 100644 index d85081905..000000000 --- a/src/main/java/techreborn/client/gui/slot/elements/FluidConfigPopupElement.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.PacketFluidConfigSave; -import reborncore.common.network.packet.PacketFluidIOSave; -import reborncore.common.tile.FluidConfiguration; -import reborncore.common.tile.TileMachineBase; -import reborncore.common.util.MachineFacing; -import techreborn.client.gui.GuiBase; - -import java.awt.*; - -public class FluidConfigPopupElement extends ElementBase { - public boolean filter = false; - - ConfigFluidElement fluidElement; - int lastMousex, lastMousey; - - public FluidConfigPopupElement(int x, int y, ConfigFluidElement fluidElement) { - super(x, y, Sprite.SLOT_CONFIG_POPUP); - this.fluidElement = fluidElement; - } - - @Override - public void draw(GuiBase gui) { - drawDefaultBackground(gui, adjustX(gui, getX() - 8), adjustY(gui, getY() - 7), 84, 105 + (filter ? 15 : 0)); - super.draw(gui); - - TileMachineBase machine = ((TileMachineBase) 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 - - drawSateColor(gui.getMachine(), MachineFacing.UP.getFacing(machine), 22, -1, gui); - drawSateColor(gui.getMachine(), MachineFacing.FRONT.getFacing(machine), 22, 18, gui); - drawSateColor(gui.getMachine(), MachineFacing.DOWN.getFacing(machine), 22, 37, gui); - drawSateColor(gui.getMachine(), MachineFacing.RIGHT.getFacing(machine), 41, 18, gui); - drawSateColor(gui.getMachine(), MachineFacing.BACK.getFacing(machine), 41, 37, gui); - drawSateColor(gui.getMachine(), MachineFacing.LEFT.getFacing(machine), 3, 18, gui); - } - - @Override - public boolean onRelease(TileMachineBase provider, GuiBase gui, int mouseX, int mouseY) { - if (isInBox(23, 4, 16, 16, mouseX, mouseY, gui)) { - cyleConfig(MachineFacing.UP.getFacing(provider), gui); - } else if (isInBox(23, 23, 16, 16, mouseX, mouseY, gui)) { - cyleConfig(MachineFacing.FRONT.getFacing(provider), gui); - } else if (isInBox(42, 23, 16, 16, mouseX, mouseY, gui)) { - cyleConfig(MachineFacing.RIGHT.getFacing(provider), gui); - } else if (isInBox(4, 23, 16, 16, mouseX, mouseY, gui)) { - cyleConfig(MachineFacing.LEFT.getFacing(provider), gui); - } else if (isInBox(23, 42, 16, 16, mouseX, mouseY, gui)) { - cyleConfig(MachineFacing.DOWN.getFacing(provider), gui); - } else if (isInBox(42, 42, 16, 16, mouseX, mouseY, gui)) { - cyleConfig(MachineFacing.BACK.getFacing(provider), gui); - } else { - return false; - } - return true; - } - - public void cyleConfig(EnumFacing side, GuiBase guiBase) { - FluidConfiguration.FluidConfig config = guiBase.getMachine().fluidConfiguration.getSideDetail(side); - - FluidConfiguration.ExtractConfig fluidIO = config.getIoConfig().getNext(); - FluidConfiguration.FluidConfig newConfig = new FluidConfiguration.FluidConfig(side, fluidIO); - - PacketFluidConfigSave packetSave = new PacketFluidConfigSave(guiBase.tile.getPos(), newConfig); - NetworkManager.sendToServer(packetSave); - } - - public void updateCheckBox(CheckBoxElement checkBoxElement, String type, GuiBase guiBase) { - FluidConfiguration configHolder = guiBase.getMachine().fluidConfiguration; - boolean input = configHolder.autoInput(); - boolean output = configHolder.autoOutput(); - if (type.equalsIgnoreCase("input")) { - input = !configHolder.autoInput(); - } - if (type.equalsIgnoreCase("output")) { - output = !configHolder.autoOutput(); - } - - PacketFluidIOSave packetFluidIOSave = new PacketFluidIOSave(guiBase.tile.getPos(), input, output); - NetworkManager.sendToServer(packetFluidIOSave); - } - - @Override - public boolean onHover(TileMachineBase provider, GuiBase gui, int mouseX, int mouseY) { - lastMousex = mouseX; - lastMousey = mouseY; - return super.onHover(provider, gui, mouseX, mouseY); - } - - private void drawSateColor(TileMachineBase machineBase, EnumFacing side, int inx, int iny, GuiBase gui) { - iny += 4; - int sx = inx + getX() + gui.guiLeft; - int sy = iny + getY() + gui.guiTop; - FluidConfiguration fluidConfiguration = machineBase.fluidConfiguration; - if (fluidConfiguration == null) { - RebornCore.LOGGER.debug("Humm, this isnt suppoed to happen"); - return; - } - FluidConfiguration.FluidConfig fluidConfig = fluidConfiguration.getSideDetail(side); - Color color; - switch (fluidConfig.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; - case ALL: - color = new Color(52, 255, 30, 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(); - 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/ISprite.java b/src/main/java/techreborn/client/gui/slot/elements/ISprite.java deleted file mode 100644 index a84d05a97..000000000 --- a/src/main/java/techreborn/client/gui/slot/elements/ISprite.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.TileMachineBase; - -public interface ISprite { - Sprite getSprite(TileMachineBase provider); -} diff --git a/src/main/java/techreborn/client/gui/slot/elements/LICENSE b/src/main/java/techreborn/client/gui/slot/elements/LICENSE deleted file mode 100644 index 9318f0db6..000000000 --- a/src/main/java/techreborn/client/gui/slot/elements/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index eedeb5335..000000000 --- a/src/main/java/techreborn/client/gui/slot/elements/OffsetSprite.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.TileMachineBase; - -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, TileMachineBase provider) { - this.sprite = sprite; - } - - public ISprite getSprite() { - return sprite; - } - - public int getOffsetX(TileMachineBase provider) { - return offsetX + sprite.getSprite(provider).offsetX; - } - - public OffsetSprite setOffsetX(int offsetX) { - this.offsetX = offsetX; - return this; - } - - public int getOffsetY(TileMachineBase 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 deleted file mode 100644 index b79269833..000000000 --- a/src/main/java/techreborn/client/gui/slot/elements/README.md +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 8ad4badba..000000000 --- a/src/main/java/techreborn/client/gui/slot/elements/SlotConfigPopupElement.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.TileMachineBase; -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); - - TileMachineBase machine = ((TileMachineBase) 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(TileMachineBase 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(TileMachineBase 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.LOGGER.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(); - 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 deleted file mode 100644 index 70646853d..000000000 --- a/src/main/java/techreborn/client/gui/slot/elements/SlotElement.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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 deleted file mode 100644 index 6d921d0b7..000000000 --- a/src/main/java/techreborn/client/gui/slot/elements/SlotType.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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 deleted file mode 100644 index dc27f054b..000000000 --- a/src/main/java/techreborn/client/gui/slot/elements/Sprite.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.TileMachineBase; - -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(TileMachineBase 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 deleted file mode 100644 index 09ff103dc..000000000 --- a/src/main/java/techreborn/client/gui/slot/elements/SpriteContainer.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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/client/gui/widget/GuiButtonHologram.java b/src/main/java/techreborn/client/gui/widget/GuiButtonHologram.java deleted file mode 100644 index 0bc8c993e..000000000 --- a/src/main/java/techreborn/client/gui/widget/GuiButtonHologram.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.widget; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.util.math.BlockPos; -import reborncore.client.multiblock.Multiblock; -import techreborn.client.gui.GuiBase; - -/** - * Created by Prospector - */ -public class GuiButtonHologram extends GuiButton { - - GuiBase.Layer layer; - GuiBase gui; - - public GuiButtonHologram(int buttonId, int x, int y, GuiBase gui, GuiBase.Layer layer) { - super(buttonId, x, y, 20, 12, ""); - this.layer = layer; - this.gui = gui; - } - - @Override - public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) { - - if (layer == GuiBase.Layer.FOREGROUND) { - mouseX -= gui.getGuiLeft(); - mouseY -= gui.getGuiTop(); - } - - if (this.enabled && this.visible && mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height) { - return true; - } - return false; - } - - public void addComponent(final int x, final int y, final int z, final IBlockState blockState, final Multiblock multiblock) { - multiblock.addComponent(new BlockPos(x, y, z), blockState); - } - - @Override - public void drawButtonForegroundLayer(int mouseX, int mouseY) { - - } - - @Override - public void drawButton(Minecraft p_191745_1_, int p_191745_2_, int p_191745_3_, float p_191745_4_) { - - } -} diff --git a/src/main/java/techreborn/client/gui/widget/GuiButtonPowerBar.java b/src/main/java/techreborn/client/gui/widget/GuiButtonPowerBar.java deleted file mode 100644 index 5025f2e4c..000000000 --- a/src/main/java/techreborn/client/gui/widget/GuiButtonPowerBar.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.widget; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import reborncore.common.powerSystem.PowerSystem; -import techreborn.client.gui.GuiBase; - -/** - * Created by Prospector - */ -public class GuiButtonPowerBar extends GuiButton { - - GuiBase.Layer layer; - GuiBase gui; - - public GuiButtonPowerBar(int buttonId, int x, int y, GuiBase gui, GuiBase.Layer layer) { - super(buttonId, x, y, 12, 48, ""); - this.layer = layer; - this.gui = gui; - } - - @Override - public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) { - - if (layer == GuiBase.Layer.FOREGROUND) { - mouseX -= gui.getGuiLeft(); - mouseY -= gui.getGuiTop(); - } - - if (this.enabled && this.visible && mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height) { - PowerSystem.bumpPowerConfig(); - return true; - } - return false; - } - - @Override - public void drawButtonForegroundLayer(int mouseX, int mouseY) { - - } - - @Override - public void drawButton(Minecraft p_191745_1_, int p_191745_2_, int p_191745_3_, float p_191745_4_) { - - } -} diff --git a/src/main/java/techreborn/client/gui/widget/GuiButtonUpDown.java b/src/main/java/techreborn/client/gui/widget/GuiButtonUpDown.java deleted file mode 100644 index 9b8f5ce7f..000000000 --- a/src/main/java/techreborn/client/gui/widget/GuiButtonUpDown.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.widget; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import techreborn.client.gui.GuiBase; - -/** - * @author drcrazy - * - */ -public class GuiButtonUpDown extends GuiButton { - - GuiBase.Layer layer; - GuiBase gui; - - public GuiButtonUpDown(int buttonId, int x, int y, GuiBase gui, GuiBase.Layer layer) { - super(buttonId, x, y, 12, 12, ""); - this.layer = layer; - this.gui = gui; - } - - @Override - public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) { - if (layer == GuiBase.Layer.FOREGROUND) { - mouseX -= gui.getGuiLeft(); - mouseY -= gui.getGuiTop(); - } - if (this.enabled && this.visible && mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height) { - return true; - } - return false; - } - - - @Override - public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) { - // We already have texture drawn - } - -} diff --git a/src/main/java/techreborn/client/gui/widget/GuiWidget.java b/src/main/java/techreborn/client/gui/widget/GuiWidget.java deleted file mode 100644 index e554c65e7..000000000 --- a/src/main/java/techreborn/client/gui/widget/GuiWidget.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.widget; - -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.inventory.Container; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.translation.LanguageMap; -import net.minecraftforge.fml.common.ObfuscationReflectionHelper; - -import java.util.ArrayList; - -public abstract class GuiWidget extends GuiContainer { - - public static final LanguageMap translate = ObfuscationReflectionHelper.getPrivateValue(LanguageMap.class, null, 2); - - private final ArrayList widgets = new ArrayList<>(); - private final ResourceLocation background; - - public GuiWidget(T inventorySlotsIn, ResourceLocation background, int xSize, int ySize) { - super(inventorySlotsIn); - this.xSize = xSize; - this.ySize = ySize; - this.background = background; - } - - @SuppressWarnings("unchecked") - public T getContainer() { - return (T) inventorySlots; - } - - @Override - public void initGui() { - super.initGui(); - widgets.clear(); - initWidgets(); - } - - public void addWidget(Widget widget) { - widgets.add(widget); - } - - public void removeWidget(Widget widget) { - widgets.remove(widget); - } - - public abstract void initWidgets(); - - @Override - protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.getTextureManager().bindTexture(background); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - - @Override - protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - String name = translate.translateKey("tile.techreborn.industrialgrinder.name"); - - fontRenderer.drawString(name, xSize / 2 - fontRenderer.getStringWidth(name) / 2, 6, 4210752); - fontRenderer.drawString(translate.translateKey("container.inventory"), 8, ySize - 94, 4210752); - - for (Widget widget : widgets) - widget.drawWidget(this, x, y, mouseX, mouseY); - } - - public FontRenderer getFontRenderer() { - return fontRenderer; - } - -} diff --git a/src/main/java/techreborn/client/gui/widget/Widget.java b/src/main/java/techreborn/client/gui/widget/Widget.java deleted file mode 100644 index 6a77a31f2..000000000 --- a/src/main/java/techreborn/client/gui/widget/Widget.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.widget; - -import net.minecraft.client.gui.GuiScreen; -import techreborn.client.gui.widget.tooltip.ToolTip; - -public abstract class Widget { - - private final int x, y; - protected final int width, height; - - private ToolTip toolTip; - - public Widget(int x, int y, int width, int height) { - this.x = x; - this.y = y; - this.width = width; - this.height = height; - } - - public int getWidth() { - return width; - } - - public int getHeight() { - return height; - } - - public ToolTip getToolTip() { - return toolTip; - } - - public void setToolTip(ToolTip toolTip) { - this.toolTip = toolTip; - } - - public final void drawWidget(GuiWidget gui, int cornerX, int cornerY, int mouseX, int mouseY) { - int drawX = cornerX + x; - int drawY = cornerY + y; - if (toolTip != null && drawX > mouseX && drawY > mouseY && - drawX + width < mouseX && drawY + height < mouseY) { - toolTip.draw(gui.getFontRenderer(), mouseX, mouseY); - } - draw(gui, drawX, drawY); - } - - protected abstract void draw(GuiScreen guiScreen, int x, int y); - - protected abstract void mouseClick(GuiWidget guiWidget, int mouseX, int mouseY); - -} diff --git a/src/main/java/techreborn/client/gui/widget/tooltip/ToolTip.java b/src/main/java/techreborn/client/gui/widget/tooltip/ToolTip.java deleted file mode 100644 index 543d9f260..000000000 --- a/src/main/java/techreborn/client/gui/widget/tooltip/ToolTip.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.widget.tooltip; - -import net.minecraft.client.gui.FontRenderer; -import reborncore.client.gui.GuiUtil; - -import java.util.ArrayList; -import java.util.Collections; - -public class ToolTip { - - protected ArrayList lines = new ArrayList<>(); - - public ToolTip(String... textLines) { - for (String text : textLines) - lines.add(new ToolTipLine(text)); - } - - public ToolTip(ToolTipLine... toolTipLines) { - Collections.addAll(lines, toolTipLines); - } - - public ToolTip(int linesSize) { - for (int i = 0; i < linesSize; i++) - lines.add(new ToolTipLine()); - } - - public void addLine(ToolTipLine toolTipLine) { - lines.add(toolTipLine); - } - - public void removeLine(int index) { - lines.remove(index); - } - - public ToolTipLine getLine(int index) { - return lines.get(index); - } - - public ArrayList getLines() { - return lines; - } - - protected void refresh() {} - - public void draw(FontRenderer font, int mouseX, int mouseY) { - refresh(); - int maxLineLength = 0; - int textX = mouseX + 3; - int textY = mouseY + 3; - for (ToolTipLine toolTipLine : lines) { - toolTipLine.draw(font, textX, textY); - textY += (font.FONT_HEIGHT + 3); - int lineWidth = toolTipLine.getWidth(font); - if (lineWidth > maxLineLength) - maxLineLength = lineWidth; - } - GuiUtil.drawTooltipBox(mouseX, mouseY, maxLineLength, textY + 3); - } - -} diff --git a/src/main/java/techreborn/client/gui/widget/tooltip/ToolTipLine.java b/src/main/java/techreborn/client/gui/widget/tooltip/ToolTipLine.java deleted file mode 100644 index 316b48523..000000000 --- a/src/main/java/techreborn/client/gui/widget/tooltip/ToolTipLine.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.widget.tooltip; - -import net.minecraft.client.gui.FontRenderer; - -public class ToolTipLine { - - private String line; - private int color; - private boolean shadowed; - - public ToolTipLine(String line, int color, boolean shadowed) { - this.line = line; - this.color = color; - this.shadowed = shadowed; - } - - public ToolTipLine(String line, int color) { - this(line, color, false); - } - - public ToolTipLine(String line, boolean shadowed) { - this(line, 0xFFFFFF, shadowed); - } - - public ToolTipLine(String line) { - this(line, 0xFFFFFF, false); - } - - public ToolTipLine() { - this(""); - } - - public String getLine() { - return line; - } - - public void setLine(String line) { - this.line = line; - } - - public int getColor() { - return color; - } - - public void setColor(int color) { - this.color = color; - } - - public boolean isShadowed() { - return shadowed; - } - - public void setShadowed(boolean shadowed) { - this.shadowed = shadowed; - } - - public int getWidth(FontRenderer fontRenderer) { - return fontRenderer.getStringWidth(getLine()); - } - - public void draw(FontRenderer fontRenderer, int x, int y) { - fontRenderer.drawString(getLine(), x, y, color, isShadowed()); - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - ToolTipLine that = (ToolTipLine) o; - return color == that.color && - shadowed == that.shadowed && - line.equals(that.line); - - } - - @Override - public int hashCode() { - int result = line.hashCode(); - result = 31 * result + color; - result = 31 * result + (shadowed ? 1 : 0); - return result; - } - -} diff --git a/src/main/java/techreborn/config/ConfigTechReborn.java b/src/main/java/techreborn/config/ConfigTechReborn.java index e697f380e..dbb4ffaa8 100644 --- a/src/main/java/techreborn/config/ConfigTechReborn.java +++ b/src/main/java/techreborn/config/ConfigTechReborn.java @@ -131,4 +131,8 @@ public class ConfigTechReborn { @ConfigRegistry(config = "world", category = "loot", key = "enableEndLoot", comment = "When true TechReborn will add ingots, machine frames and circuits to The End loot chests.") public static boolean enableEndLoot = true; + + @ConfigRegistry(config = "world", category = "village", key = "enableRubberTreePlantation", comment = "When true TechReborn will add Rubber tree farm to villages.") + public static boolean enableRubberTreePlantation = true; + } diff --git a/src/main/java/techreborn/events/StackToolTipEvent.java b/src/main/java/techreborn/events/StackToolTipEvent.java index 8f2537f25..eb6e62f08 100644 --- a/src/main/java/techreborn/events/StackToolTipEvent.java +++ b/src/main/java/techreborn/events/StackToolTipEvent.java @@ -86,7 +86,7 @@ public class StackToolTipEvent { Block block = Block.getBlockFromItem(item); if (block != null && (block instanceof BlockContainer || block instanceof ITileEntityProvider) && block.getRegistryName().getNamespace().contains("techreborn")) { - TileEntity tile = block.createTileEntity(Minecraft.getMinecraft().world, + TileEntity tile = block.createTileEntity(Minecraft.getMinecraft().world, block.getStateFromMeta(event.getItemStack().getItemDamage())); boolean hasData = false; if(event.getItemStack().hasTagCompound() && event.getItemStack().getTagCompound().hasKey("tile_data")){ diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index ace261515..4088fb99a 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -43,6 +43,11 @@ import techreborn.api.recipe.machines.VacuumFreezerRecipe; import techreborn.config.ConfigTechReborn; import techreborn.init.recipes.*; import techreborn.items.*; +import techreborn.items.ingredients.ItemDusts; +import techreborn.items.ingredients.ItemDustsSmall; +import techreborn.items.ingredients.ItemIngots; +import techreborn.items.ingredients.ItemPlates; +import techreborn.lib.ModInfo; import java.util.Iterator; import java.util.Map; @@ -125,7 +130,7 @@ public class ModRecipes { // ItemPlates.getPlateByName("RedGarnet", 9), 300, 4)); // RecipeHandler.addRecipe(Reference.COMPRESSOR_RECIPE, new CompressorRecipe(OreUtil.getStackFromName("ingotRefinedIron", 1), // ItemPlates.getPlateByName("RefinedIron"), 300, 4)); -// +// // ItemStack plate; // for (String ore : OreUtil.oreNames) { // if (ore.equals("iridium")) { @@ -138,7 +143,7 @@ public class ModRecipes { // plate = OreUtil.getStackFromName("plate" + OreUtil.capitalizeFirstLetter(ore), 1); // } // if (plate.isEmpty()) { -// continue; +// continue; // } // if (OreUtil.hasIngot(ore)) { // RecipeHandler.addRecipe(Reference.COMPRESSOR_RECIPE, new CompressorRecipe( @@ -202,7 +207,7 @@ public class ModRecipes { // new ItemStack(Blocks.NETHERRACK), // ItemDusts.getDustByName("netherrack"), // 300, 27)); -// +// // RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( // new ItemStack(Blocks.END_STONE), // ItemDusts.getDustByName("endstone"), @@ -237,14 +242,14 @@ public class ModRecipes { // ItemStack marbleStack = getOre("stoneMarble"); // marbleStack.setCount(1); // RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( -// marbleStack, ItemDusts.getDustByName("marble"), +// marbleStack, ItemDusts.getDustByName("marble"), // 120, 10)); } if (OreUtil.doesOreExistAndValid("stoneBasalt")) { // ItemStack marbleStack = getOre("stoneBasalt"); // marbleStack.setCount(1); // RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( -// marbleStack, ItemDusts.getDustByName("basalt"), +// marbleStack, ItemDusts.getDustByName("basalt"), // 120, 10)); } diff --git a/src/main/java/techreborn/init/OreDict.java b/src/main/java/techreborn/init/OreDict.java index 5572cd1f6..41ffe37f7 100644 --- a/src/main/java/techreborn/init/OreDict.java +++ b/src/main/java/techreborn/init/OreDict.java @@ -31,6 +31,7 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import reborncore.common.util.OreUtil; import reborncore.common.util.StringUtils; +import techreborn.api.TechRebornAPI; import techreborn.init.TRContent.Dusts; import techreborn.init.TRContent.Ores; @@ -46,6 +47,9 @@ public class OreDict { * Register blocks and items */ public static void init() { + if(TechRebornAPI.ic2Helper != null){ + TechRebornAPI.ic2Helper.initDuplicates(); + } // Blocks OreUtil.registerOre("fenceIron", TRContent.REFINED_IRON_FENCE); OreUtil.registerOre("woodRubber", TRContent.RUBBER_LOG); @@ -100,17 +104,17 @@ public class OreDict { //OreUtil.registerOre("uran235", nothing); //OreUtil.registerOre("uran238", nothing); //OreUtil.registerOre("smallUran235", nothing); - + for (Ores ore : TRContent.Ores.values()) { OreUtil.registerOre("ore" + StringUtils.toFirstCapital(ore.name), new ItemStack(ore.block)); } - + for (Dusts dust : TRContent.Dusts.values()) { OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "dust_" + dust.name), dust.getStack()); } - - + + // OreUtil.registerOre("blockSilver", BlockStorage.getStorageBlockByName("silver")); // OreUtil.registerOre("blockAluminum", BlockStorage.getStorageBlockByName("aluminum")); // OreUtil.registerOre("blockAluminium", BlockStorage.getStorageBlockByName("aluminum")); diff --git a/src/main/java/techreborn/init/SubItemRetriever.java b/src/main/java/techreborn/init/SubItemRetriever.java index bd8587658..37389b99d 100644 --- a/src/main/java/techreborn/init/SubItemRetriever.java +++ b/src/main/java/techreborn/init/SubItemRetriever.java @@ -27,6 +27,13 @@ package techreborn.init; import net.minecraft.item.ItemStack; import techreborn.api.ISubItemRetriever; import techreborn.items.*; +import techreborn.items.ingredients.ItemDusts; +import techreborn.items.ingredients.ItemDustsSmall; +import techreborn.items.ingredients.ItemGems; +import techreborn.items.ingredients.ItemIngots; +import techreborn.items.ingredients.ItemNuggets; +import techreborn.items.ingredients.ItemParts; +import techreborn.items.ingredients.ItemPlates; /** * Created by Mark on 03/04/2016. diff --git a/src/main/java/techreborn/init/recipes/AlloySmelterRecipes.java b/src/main/java/techreborn/init/recipes/AlloySmelterRecipes.java index 9a3bddb89..e3bdc3f69 100644 --- a/src/main/java/techreborn/init/recipes/AlloySmelterRecipes.java +++ b/src/main/java/techreborn/init/recipes/AlloySmelterRecipes.java @@ -28,6 +28,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import reborncore.api.recipe.RecipeHandler; +import reborncore.common.recipes.OreRecipeInput; import reborncore.common.util.OreUtil; import techreborn.api.Reference; import techreborn.api.recipe.machines.AlloySmelterRecipe; @@ -39,64 +40,68 @@ import techreborn.api.recipe.machines.AlloySmelterRecipe; public class AlloySmelterRecipes extends RecipeMethods { public static void init() { - // Bronze -// TODO: Fix Recipe -// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, -// new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemIngots.getIngotByName("tin", 1), -// ItemIngots.getIngotByName("bronze", 4), 200, 16)); -// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, -// new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemDusts.getDustByName("tin", 1), -// ItemIngots.getIngotByName("bronze", 4), 200, 16)); -// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, -// new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemIngots.getIngotByName("tin", 1), -// ItemIngots.getIngotByName("bronze", 4), 200, 16)); -// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, -// new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemDusts.getDustByName("tin", 1), -// ItemIngots.getIngotByName("bronze", 4), 200, 16)); - // Electrum -// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, -// new AlloySmelterRecipe(new ItemStack(Items.GOLD_INGOT, 1), ItemIngots.getIngotByName("silver", 1), -// ItemIngots.getIngotByName("electrum", 2), 200, 16)); -// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, -// new AlloySmelterRecipe(new ItemStack(Items.GOLD_INGOT, 1), ItemDusts.getDustByName("silver", 1), -// ItemIngots.getIngotByName("electrum", 2), 200, 16)); -// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, -// new AlloySmelterRecipe(ItemDusts.getDustByName("gold", 1), ItemIngots.getIngotByName("silver", 1), -// ItemIngots.getIngotByName("electrum", 2), 200, 16)); -// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, -// new AlloySmelterRecipe(ItemDusts.getDustByName("gold", 1), ItemDusts.getDustByName("silver", 1), -// ItemIngots.getIngotByName("electrum", 2), 200, 16)); + OreRecipeInput ingotCopper3 = new OreRecipeInput("ingotCopper", 3); + OreRecipeInput dustCopper3 = new OreRecipeInput("dustCopper", 3); - // Invar -// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, -// new AlloySmelterRecipe(new ItemStack(Items.IRON_INGOT, 2), ItemIngots.getIngotByName("nickel", 1), +// // Bronze +//// TODO: Fix Recipe +// RecipeHandler.addRecipe( +// new AlloySmelterRecipe(ingotCopper3, "ingotTin", +// ItemIngots.getIngotByName("bronze", 4), 200, 16)); +// RecipeHandler.addRecipe( +// new AlloySmelterRecipe(ingotCopper3, "dustTin", +// ItemIngots.getIngotByName("bronze", 4), 200, 16)); +// RecipeHandler.addRecipe( +// new AlloySmelterRecipe(dustCopper3, "ingotTin", +// ItemIngots.getIngotByName("bronze", 4), 200, 16)); +// RecipeHandler.addRecipe( +// new AlloySmelterRecipe(dustCopper3, "dustTin", +// ItemIngots.getIngotByName("bronze", 4), 200, 16)); +// +// // Electrum +// RecipeHandler.addRecipe( +// new AlloySmelterRecipe(new ItemStack(Items.GOLD_INGOT, 1), "ingotSilver", +// ItemIngots.getIngotByName("electrum", 2), 200, 16)); +// RecipeHandler.addRecipe( +// new AlloySmelterRecipe(new ItemStack(Items.GOLD_INGOT, 1), "dustSilver", +// ItemIngots.getIngotByName("electrum", 2), 200, 16)); +// RecipeHandler.addRecipe( +// new AlloySmelterRecipe("dustGold", "ingotSilver", +// ItemIngots.getIngotByName("electrum", 2), 200, 16)); +// RecipeHandler.addRecipe( +// new AlloySmelterRecipe("dustGold", "dustSilver", +// ItemIngots.getIngotByName("electrum", 2), 200, 16)); +// +// // Invar +// RecipeHandler.addRecipe( +// new AlloySmelterRecipe(new ItemStack(Items.IRON_INGOT, 2), "ingotNickel", // ItemIngots.getIngotByName("invar", 3), 200, 16)); -// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, -// new AlloySmelterRecipe(new ItemStack(Items.IRON_INGOT, 2), ItemDusts.getDustByName("nickel", 1), +// RecipeHandler.addRecipe( +// new AlloySmelterRecipe(new ItemStack(Items.IRON_INGOT, 2), "dustNickel", // ItemIngots.getIngotByName("invar", 3), 200, 16)); -// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, -// new AlloySmelterRecipe(ItemDusts.getDustByName("iron", 2), ItemIngots.getIngotByName("nickel", 1), +// RecipeHandler.addRecipe( +// new AlloySmelterRecipe(new OreRecipeInput("dustIron", 2), "ingotNickel", // ItemIngots.getIngotByName("invar", 3), 200, 16)); -// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, -// new AlloySmelterRecipe(ItemDusts.getDustByName("iron", 2), ItemDusts.getDustByName("nickel", 1), +// RecipeHandler.addRecipe( +// new AlloySmelterRecipe(new OreRecipeInput("dustIron", 2), "dustNickel", // ItemIngots.getIngotByName("invar", 3), 200, 16)); - - // Brass +// +// // Brass // if (OreUtil.doesOreExistAndValid("ingotBrass")) { // ItemStack brassStack = getOre("ingotBrass"); // brassStack.setCount(4); -// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, -// new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemIngots.getIngotByName("zinc", 1), +// RecipeHandler.addRecipe( +// new AlloySmelterRecipe(ingotCopper3, "ingotZinc", // brassStack, 200, 16)); -// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, -// new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemDusts.getDustByName("zinc", 1), +// RecipeHandler.addRecipe( +// new AlloySmelterRecipe(ingotCopper3, "dustZinc", // brassStack, 200, 16)); -// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, -// new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemIngots.getIngotByName("zinc", 1), +// RecipeHandler.addRecipe( +// new AlloySmelterRecipe(dustCopper3, "ingotZinc", // brassStack, 200, 16)); -// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, -// new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemDusts.getDustByName("zinc", 1), +// RecipeHandler.addRecipe( +// new AlloySmelterRecipe(dustCopper3, "dustZinc", // brassStack, 200, 16)); // } @@ -164,7 +169,7 @@ public class AlloySmelterRecipes extends RecipeMethods { if (OreUtil.doesOreExistAndValid("ingotConductiveIron")) { ItemStack conductiveIronStack = getOre("ingotConductiveIron"); conductiveIronStack.setCount(1); - RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, + RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE, new AlloySmelterRecipe(new ItemStack(Items.REDSTONE, 1), new ItemStack(Items.IRON_INGOT, 1), conductiveIronStack, 200, 16)); } diff --git a/src/main/java/techreborn/init/recipes/ChemicalReactorRecipes.java b/src/main/java/techreborn/init/recipes/ChemicalReactorRecipes.java index 49695c97e..049169d3b 100644 --- a/src/main/java/techreborn/init/recipes/ChemicalReactorRecipes.java +++ b/src/main/java/techreborn/init/recipes/ChemicalReactorRecipes.java @@ -57,13 +57,14 @@ public class ChemicalReactorRecipes extends RecipeMethods { register(getMaterial("compressedair", Type.CELL), getMaterial("hydrogen", 2, Type.CELL), getMaterial("water", Type.CELL), 400); register(getMaterial("compressedair", 2, Type.CELL), getMaterial("nitrogen", Type.CELL), getMaterial("nitrogenDioxide", Type.CELL), 400); register(getMaterial("oil", Type.CELL), getMaterial("nitrogen", Type.CELL), getMaterial("nitrofuel", 2, Type.CELL), 800); + } - static void register(ItemStack in1, ItemStack in2, ItemStack out, int tickTime, int euPerTick){ + public static void register(ItemStack in1, ItemStack in2, ItemStack out, int tickTime, int euPerTick){ RecipeHandler.addRecipe(Reference.CHEMICAL_REACTOR_RECIPE, new ChemicalReactorRecipe(in1, in2, out, tickTime, euPerTick)); } - - static void register (ItemStack in1, ItemStack in2, ItemStack out, int tickTime){ + + public static void register (ItemStack in1, ItemStack in2, ItemStack out, int tickTime){ register(in1, in2, out, tickTime, 30); } diff --git a/src/main/java/techreborn/init/recipes/IndustrialCentrifugeRecipes.java b/src/main/java/techreborn/init/recipes/IndustrialCentrifugeRecipes.java index a750ca31b..191a005bf 100644 --- a/src/main/java/techreborn/init/recipes/IndustrialCentrifugeRecipes.java +++ b/src/main/java/techreborn/init/recipes/IndustrialCentrifugeRecipes.java @@ -45,7 +45,7 @@ public class IndustrialCentrifugeRecipes extends RecipeMethods { register(getStack(Blocks.MYCELIUM, 8), 1640, getStack(Blocks.SAND, 4), getStack(Items.CLAY_BALL), getStack(Blocks.BROWN_MUSHROOM, 2), getStack(Blocks.RED_MUSHROOM, 2)); register(getStack(Items.GOLDEN_APPLE), 5000, getStack(Items.GOLD_INGOT, 6), getMaterial("methane", Type.CELL)); register(getStack(Items.GOLDEN_APPLE, 1, 1), 5000, getStack(Items.GOLD_INGOT, 64), getMaterial("methane", Type.CELL)); -// TODO: Fix recipe +// TODO: Fix recipe // register(getStack(Items.GOLDEN_CARROT), 5000, getStack(Items.GOLD_NUGGET, 6), getMaterial("methane", Type.CELL)); // register(getStack(Items.SPECKLED_MELON, 8), 5000, getStack(Items.GOLD_NUGGET, 6), getMaterial("methane", Type.CELL)); register(getStack(Items.APPLE, 32), 5000, getMaterial("methane", Type.CELL)); @@ -79,7 +79,7 @@ public class IndustrialCentrifugeRecipes extends RecipeMethods { register(getStack(Blocks.RED_MUSHROOM, 32), 5000, getMaterial("methane", Type.CELL)); register(getStack(Items.NETHER_WART, 32), 5000, getMaterial("methane", Type.CELL)); // register(getMaterial("sap", 4, Type.PART), 1300, getMaterial("rubber", 14, Type.PART)); -// register(getStack(ModBlocks.RUBBER_LOG, 16), 5000, false, getMaterial("sap", 8, Type.PART), getMaterial("methane", Type.CELL), getMaterial("carbon", 4, Type.CELL)); +// register(getStack(ModBlocks.RUBBER_LOG, 16), 5000, false, getMaterial("sap", 8, Type.PART), getMaterial("methane", Type.CELL), getMaterial("carbon", 4, Type.CELL)); // register(getStack(Blocks.SOUL_SAND, 16), 2500, getStack(Blocks.SAND, 10), getMaterial("saltpeter", 4, Type.DUST), getMaterial("coal", Type.DUST), getMaterial("oil", Type.CELL)); // register(getOre("dustBronze"), 1500, getMaterial("copper", 6, Type.SMALL_DUST), getMaterial("tin", 2, Type.SMALL_DUST)); // register(getOre("dustIron", 2), 1500, getMaterial("tin", Type.SMALL_DUST), getMaterial("nickel", Type.SMALL_DUST)); diff --git a/src/main/java/techreborn/init/recipes/IndustrialSawmillRecipes.java b/src/main/java/techreborn/init/recipes/IndustrialSawmillRecipes.java index 75ae8d162..8d8ae724c 100644 --- a/src/main/java/techreborn/init/recipes/IndustrialSawmillRecipes.java +++ b/src/main/java/techreborn/init/recipes/IndustrialSawmillRecipes.java @@ -1,134 +1,134 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 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.init.recipes; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; -import reborncore.api.recipe.RecipeHandler; -import reborncore.common.registration.RebornRegister; -import reborncore.common.registration.impl.ConfigRegistry; -import reborncore.common.util.ItemUtils; -import techreborn.TechReborn; -import techreborn.api.Reference; -import techreborn.api.recipe.machines.IndustrialSawmillRecipe; -import techreborn.init.TRContent; - -import javax.annotation.Nonnull; -import java.security.InvalidParameterException; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -@RebornRegister(modID = TechReborn.MOD_ID) -public class IndustrialSawmillRecipes extends RecipeMethods { - static FluidStack WATER = new FluidStack(FluidRegistry.WATER, 1000); - - @ConfigRegistry(config = "recipes", category = "sawmill", key = "plankCount", comment = "Number of planks the saw mill will ouput") - public static int plankCount = 4; - - @ConfigRegistry(config = "recipes", category = "sawmill", key = "disableRecipes", comment = "Set to true to disable sawmill recipes from loading.") - public static boolean disableRecipes = false; - - public static void init() { - if(disableRecipes){ - return; - } - InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() { - @Override - public boolean canInteractWith(EntityPlayer playerIn) { - return false; - } - }, 1, 1); - inventoryCrafting.setInventorySlotContents(0, ItemStack.EMPTY); - - List logs = OreDictionary.getOres("logWood").stream() - .filter(Objects::nonNull) - .map(ItemStack::copy) - .collect(Collectors.toList()); - - for (ItemStack logStack : logs) { - if (logStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && logStack.getHasSubtypes()) { - for (int i = 0; i < 16; i++) { - ItemStack newStack = logStack.copy(); - newStack.setItemDamage(i); - inventoryCrafting.setInventorySlotContents(0, newStack); - ItemStack output = findMatchingRecipe(inventoryCrafting); - if (!output.isEmpty()) { - if (ItemUtils.isInputEqual("plankWood", output, false, false, false)) { - addRecipe(newStack.copy(), output.copy()); - } - } - } - } else { - logStack.setItemDamage(0); //Done to remove the wildcard value if the item doesnt have subtypes - inventoryCrafting.setInventorySlotContents(0, logStack.copy()); - ItemStack output = findMatchingRecipe(inventoryCrafting); - if (!output.isEmpty()) { - if (ItemUtils.isInputEqual("plankWood", output, false, false, false)) { - addRecipe(logStack.copy(), output.copy()); - } - } - } - } - - } - - @Nonnull - public static ItemStack findMatchingRecipe(InventoryCrafting inv) { - for (IRecipe recipe : CraftingManager.REGISTRY) { - if (recipe.canFit(1, 1) && recipe.matches(inv, null)) { - return recipe.getCraftingResult(inv); - } - } - return ItemStack.EMPTY; - - } - - public static void addRecipe(ItemStack log, ItemStack plank) { - plank.setCount(plankCount); - register(log, WATER, 100, 128, plank, TRContent.Dusts.SAW.getStack(3), getStack(Items.PAPER, 1)); - } - - static void register(ItemStack input1, FluidStack fluid, int ticks, int euPerTick, ItemStack... outputs) { - if (outputs.length == 3) { - RecipeHandler.addRecipe(Reference.INDUSTRIAL_SAWMILL_RECIPE, new IndustrialSawmillRecipe(input1, fluid, outputs[0], outputs[1], outputs[2], ticks, euPerTick, false)); - } else if (outputs.length == 2) { - RecipeHandler.addRecipe(Reference.INDUSTRIAL_SAWMILL_RECIPE, new IndustrialSawmillRecipe(input1, fluid, outputs[0], outputs[1], null, ticks, euPerTick, false)); - } else if (outputs.length == 1) { - RecipeHandler.addRecipe(Reference.INDUSTRIAL_SAWMILL_RECIPE, new IndustrialSawmillRecipe(input1, fluid, outputs[0], null, null, ticks, euPerTick, false)); - } else { - throw new InvalidParameterException("Invalid industrial sawmill outputs: " + outputs); - } - } - -} +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2018 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.init.recipes; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.IRecipe; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; +import reborncore.api.recipe.RecipeHandler; +import reborncore.common.registration.RebornRegister; +import reborncore.common.registration.impl.ConfigRegistry; +import reborncore.common.util.ItemUtils; +import techreborn.TechReborn; +import techreborn.api.Reference; +import techreborn.api.recipe.machines.IndustrialSawmillRecipe; +import techreborn.init.TRContent; + +import javax.annotation.Nonnull; +import java.security.InvalidParameterException; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +@RebornRegister(modID = TechReborn.MOD_ID) +public class IndustrialSawmillRecipes extends RecipeMethods { + static FluidStack WATER = new FluidStack(FluidRegistry.WATER, 1000); + + @ConfigRegistry(config = "recipes", category = "sawmill", key = "plankCount", comment = "Number of planks the saw mill will ouput") + public static int plankCount = 4; + + @ConfigRegistry(config = "recipes", category = "sawmill", key = "disableRecipes", comment = "Set to true to disable sawmill recipes from loading.") + public static boolean disableRecipes = false; + + public static void init() { + if(disableRecipes){ + return; + } + InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() { + @Override + public boolean canInteractWith(EntityPlayer playerIn) { + return false; + } + }, 1, 1); + inventoryCrafting.setInventorySlotContents(0, ItemStack.EMPTY); + + List logs = OreDictionary.getOres("logWood").stream() + .filter(Objects::nonNull) + .map(ItemStack::copy) + .collect(Collectors.toList()); + + for (ItemStack logStack : logs) { + if (logStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && logStack.getHasSubtypes()) { + for (int i = 0; i < 16; i++) { + ItemStack newStack = logStack.copy(); + newStack.setItemDamage(i); + inventoryCrafting.setInventorySlotContents(0, newStack); + ItemStack output = findMatchingRecipe(inventoryCrafting); + if (!output.isEmpty()) { + if (ItemUtils.isInputEqual("plankWood", output, false, false, false)) { + addRecipe(newStack.copy(), output.copy()); + } + } + } + } else { + logStack.setItemDamage(0); //Done to remove the wildcard value if the item doesnt have subtypes + inventoryCrafting.setInventorySlotContents(0, logStack.copy()); + ItemStack output = findMatchingRecipe(inventoryCrafting); + if (!output.isEmpty()) { + if (ItemUtils.isInputEqual("plankWood", output, false, false, false)) { + addRecipe(logStack.copy(), output.copy()); + } + } + } + } + + } + + @Nonnull + public static ItemStack findMatchingRecipe(InventoryCrafting inv) { + for (IRecipe recipe : CraftingManager.REGISTRY) { + if (recipe.canFit(1, 1) && recipe.matches(inv, null)) { + return recipe.getCraftingResult(inv); + } + } + return ItemStack.EMPTY; + + } + + public static void addRecipe(ItemStack log, ItemStack plank) { + plank.setCount(plankCount); + register(log, WATER, 100, 128, plank, TRContent.Dusts.SAW.getStack(3), getStack(Items.PAPER, 1)); + } + + static void register(ItemStack input1, FluidStack fluid, int ticks, int euPerTick, ItemStack... outputs) { + if (outputs.length == 3) { + RecipeHandler.addRecipe(Reference.INDUSTRIAL_SAWMILL_RECIPE, new IndustrialSawmillRecipe(input1, fluid, outputs[0], outputs[1], outputs[2], ticks, euPerTick, false)); + } else if (outputs.length == 2) { + RecipeHandler.addRecipe(Reference.INDUSTRIAL_SAWMILL_RECIPE, new IndustrialSawmillRecipe(input1, fluid, outputs[0], outputs[1], null, ticks, euPerTick, false)); + } else if (outputs.length == 1) { + RecipeHandler.addRecipe(Reference.INDUSTRIAL_SAWMILL_RECIPE, new IndustrialSawmillRecipe(input1, fluid, outputs[0], null, null, ticks, euPerTick, false)); + } else { + throw new InvalidParameterException("Invalid industrial sawmill outputs: " + outputs); + } + } + +} diff --git a/src/main/java/techreborn/init/recipes/RecipeMethods.java b/src/main/java/techreborn/init/recipes/RecipeMethods.java index 3ecb3f8ce..61de8aad7 100644 --- a/src/main/java/techreborn/init/recipes/RecipeMethods.java +++ b/src/main/java/techreborn/init/recipes/RecipeMethods.java @@ -32,6 +32,13 @@ import net.minecraftforge.oredict.OreDictionary; import reborncore.common.util.OreUtil; import reborncore.common.util.StringUtils; import techreborn.items.*; +import techreborn.items.ingredients.ItemDusts; +import techreborn.items.ingredients.ItemDustsSmall; +import techreborn.items.ingredients.ItemGems; +import techreborn.items.ingredients.ItemIngots; +import techreborn.items.ingredients.ItemNuggets; +import techreborn.items.ingredients.ItemParts; +import techreborn.items.ingredients.ItemPlates; /** * Created by Prospector diff --git a/src/main/java/techreborn/items/tool/ItemDebugTool.java b/src/main/java/techreborn/items/tool/ItemDebugTool.java index 03cfa0ea5..e0e1aba7f 100644 --- a/src/main/java/techreborn/items/tool/ItemDebugTool.java +++ b/src/main/java/techreborn/items/tool/ItemDebugTool.java @@ -57,7 +57,7 @@ public class ItemDebugTool extends Item { } else { return EnumActionResult.FAIL; } - + TileEntity tile = worldIn.getTileEntity(pos); if (tile != null) { sendMessage(playerIn, worldIn, new TextComponentString( diff --git a/src/main/java/techreborn/items/tool/basic/ItemElectricTreetap.java b/src/main/java/techreborn/items/tool/basic/ItemElectricTreetap.java index 8fbf22fbb..05598c48c 100644 --- a/src/main/java/techreborn/items/tool/basic/ItemElectricTreetap.java +++ b/src/main/java/techreborn/items/tool/basic/ItemElectricTreetap.java @@ -24,18 +24,29 @@ package techreborn.items.tool.basic; +import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.energy.CapabilityEnergy; +import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import reborncore.api.power.IEnergyItemInfo; import reborncore.common.powerSystem.PowerSystem; import reborncore.common.powerSystem.PoweredItemCapabilityProvider; import reborncore.common.util.ItemUtils; +import techreborn.api.TechRebornAPI; + import javax.annotation.Nullable; /** @@ -50,6 +61,20 @@ public class ItemElectricTreetap extends Item implements IEnergyItemInfo { setMaxStackSize(1); } + // Item + @Override + public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { + IBlockState state = worldIn.getBlockState(pos); + IEnergyStorage capEnergy = playerIn.getHeldItem(hand).getCapability(CapabilityEnergy.ENERGY, null); + if(TechRebornAPI.ic2Helper != null && capEnergy.getEnergyStored() >= cost){ + if(TechRebornAPI.ic2Helper.extractSap(playerIn, worldIn, pos, side, state, null) && !worldIn.isRemote){ + capEnergy.extractEnergy(cost, false); + return EnumActionResult.SUCCESS; + } + } + return EnumActionResult.PASS; + } + @Override public double getDurabilityForDisplay(ItemStack stack) { return 1 - ItemUtils.getPowerForDurabilityBar(stack); diff --git a/src/main/java/techreborn/proxies/ClientProxy.java b/src/main/java/techreborn/proxies/ClientProxy.java index fdf5f2520..dab1512d6 100644 --- a/src/main/java/techreborn/proxies/ClientProxy.java +++ b/src/main/java/techreborn/proxies/ClientProxy.java @@ -29,6 +29,7 @@ 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.item.ItemStack; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.MinecraftForge; @@ -38,31 +39,33 @@ import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import reborncore.api.tile.IUpgradeable; +import reborncore.client.IconSupplier; import reborncore.client.hud.StackInfoHUD; -import reborncore.client.multiblock.MultiblockRenderEvent; import techreborn.blocks.BlockRubberLeaves; import techreborn.client.ClientEventHandler; -import techreborn.client.IconSupplier; -import techreborn.client.gui.GuiBase; -import techreborn.client.gui.slot.GuiFluidConfiguration; -import techreborn.client.gui.slot.GuiSlotConfiguration; + +import reborncore.client.gui.builder.GuiBase; +import reborncore.client.gui.builder.slot.GuiFluidConfiguration; +import reborncore.client.gui.builder.slot.GuiSlotConfiguration; import techreborn.client.keybindings.KeyBindings; +import techreborn.client.render.ModelDynamicCell; import techreborn.client.render.entitys.RenderNukePrimed; import techreborn.entities.EntityNukePrimed; import techreborn.events.StackToolTipEvent; import techreborn.init.TRContent; +import techreborn.items.DynamicCell; import techreborn.items.ItemFrequencyTransmitter; public class ClientProxy extends CommonProxy { - public static MultiblockRenderEvent multiblockRenderEvent; - @Override public void preInit(FMLPreInitializationEvent event) { super.preInit(event); StackInfoHUD.registerElement(new ItemFrequencyTransmitter.StackInfoFreqTransmitter()); RenderingRegistry.registerEntityRenderingHandler(EntityNukePrimed.class, new RenderManagerNuke()); MinecraftForge.EVENT_BUS.register(new IconSupplier()); + ModelDynamicCell.init(); + MinecraftForge.EVENT_BUS.register(new FluidBlockModelHandler()); MinecraftForge.EVENT_BUS.register(ClientEventHandler.class); } @@ -70,14 +73,14 @@ public class ClientProxy extends CommonProxy { public void init(FMLInitializationEvent event) { super.init(event); MinecraftForge.EVENT_BUS.register(new StackToolTipEvent()); - multiblockRenderEvent = new MultiblockRenderEvent(); MinecraftForge.EVENT_BUS.register(GuiSlotConfiguration.class); MinecraftForge.EVENT_BUS.register(GuiFluidConfiguration.class); - MinecraftForge.EVENT_BUS.register(multiblockRenderEvent); // TODO FIX ME ClientRegistry.registerKeyBinding(KeyBindings.config); StateMap rubberLeavesStateMap = new StateMap.Builder().ignore(BlockRubberLeaves.CHECK_DECAY, BlockRubberLeaves.DECAYABLE).build(); ModelLoader.setCustomStateMapper(TRContent.RUBBER_LEAVES, rubberLeavesStateMap); + GuiBase.wrenchStack = new ItemStack(ModItems.WRENCH); + GuiBase.fluidCellProvider = DynamicCell::getCellWithFluid; } @Override diff --git a/src/main/java/techreborn/tiles/TileChargeOMat.java b/src/main/java/techreborn/tiles/TileChargeOMat.java index a385d45a6..a19731366 100644 --- a/src/main/java/techreborn/tiles/TileChargeOMat.java +++ b/src/main/java/techreborn/tiles/TileChargeOMat.java @@ -32,15 +32,17 @@ import net.minecraftforge.energy.IEnergyStorage; import reborncore.api.IToolDrop; import reborncore.api.tile.ItemHandlerProvider; import reborncore.common.RebornCoreConfig; +import reborncore.common.powerSystem.ExternalPowerSystems; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.registration.RebornRegister; import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.lib.ModInfo; @RebornRegister(modID = TechReborn.MOD_ID) public class TileChargeOMat extends TilePowerAcceptor @@ -75,6 +77,8 @@ public class TileChargeOMat extends TilePowerAcceptor if (getEnergy() >= 0.0 && maxReceive > 0) { powerItem.receiveEnergy((int) useEnergy(maxUse) * RebornCoreConfig.euPerFU, false); } + } else if (ExternalPowerSystems.isPoweredItem(stack)) { + ExternalPowerSystems.chargeItem(this, stack); } } } diff --git a/src/main/java/techreborn/tiles/TileChunkLoader.java b/src/main/java/techreborn/tiles/TileChunkLoader.java index fbdceca54..f455c5bc3 100644 --- a/src/main/java/techreborn/tiles/TileChunkLoader.java +++ b/src/main/java/techreborn/tiles/TileChunkLoader.java @@ -34,9 +34,9 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; @RebornRegister(modID = TechReborn.MOD_ID) diff --git a/src/main/java/techreborn/tiles/TileDigitalChest.java b/src/main/java/techreborn/tiles/TileDigitalChest.java index 9da0753bc..691486589 100644 --- a/src/main/java/techreborn/tiles/TileDigitalChest.java +++ b/src/main/java/techreborn/tiles/TileDigitalChest.java @@ -28,9 +28,9 @@ import net.minecraft.entity.player.EntityPlayer; import reborncore.common.registration.RebornRegister; import reborncore.common.registration.impl.ConfigRegistry; import techreborn.TechReborn; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; @RebornRegister(modID = TechReborn.MOD_ID) public class TileDigitalChest extends TileTechStorageBase implements IContainerProvider { diff --git a/src/main/java/techreborn/tiles/TileGenericMachine.java b/src/main/java/techreborn/tiles/TileGenericMachine.java index 3385c9f82..9043c7136 100644 --- a/src/main/java/techreborn/tiles/TileGenericMachine.java +++ b/src/main/java/techreborn/tiles/TileGenericMachine.java @@ -67,8 +67,8 @@ public abstract class TileGenericMachine extends TilePowerAcceptor } public int getProgressScaled(final int scale) { - if (getRecipeCrafter() != null && getRecipeCrafter().currentTickTime != 0) { - return getRecipeCrafter().currentTickTime * scale / getRecipeCrafter().currentNeededTicks; + if (crafter != null && crafter.currentTickTime != 0) { + return crafter.currentTickTime * scale / crafter.currentNeededTicks; } return 0; } diff --git a/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java b/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java index d478c0fdd..1f1f52c13 100644 --- a/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java +++ b/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java @@ -33,9 +33,9 @@ import reborncore.common.util.Inventory; import reborncore.common.util.ItemUtils; import techreborn.TechReborn; import techreborn.api.Reference; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; import techreborn.items.DynamicCell; diff --git a/src/main/java/techreborn/tiles/TileMatterFabricator.java b/src/main/java/techreborn/tiles/TileMatterFabricator.java index 9a56206ed..663f332f0 100644 --- a/src/main/java/techreborn/tiles/TileMatterFabricator.java +++ b/src/main/java/techreborn/tiles/TileMatterFabricator.java @@ -35,10 +35,12 @@ import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.Inventory; import reborncore.common.util.ItemUtils; import techreborn.TechReborn; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.items.ingredients.ItemParts; +import techreborn.lib.ModInfo; @RebornRegister(modID = TechReborn.MOD_ID) public class TileMatterFabricator extends TilePowerAcceptor diff --git a/src/main/java/techreborn/tiles/TileQuantumChest.java b/src/main/java/techreborn/tiles/TileQuantumChest.java index 7e1c33bf0..fafcbcd96 100644 --- a/src/main/java/techreborn/tiles/TileQuantumChest.java +++ b/src/main/java/techreborn/tiles/TileQuantumChest.java @@ -28,9 +28,9 @@ import net.minecraft.entity.player.EntityPlayer; import reborncore.common.registration.RebornRegister; import reborncore.common.registration.impl.ConfigRegistry; import techreborn.TechReborn; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; @RebornRegister(modID = TechReborn.MOD_ID) public class TileQuantumChest extends TileTechStorageBase implements IContainerProvider { diff --git a/src/main/java/techreborn/tiles/TileQuantumTank.java b/src/main/java/techreborn/tiles/TileQuantumTank.java index ea9d78288..01d3a4985 100644 --- a/src/main/java/techreborn/tiles/TileQuantumTank.java +++ b/src/main/java/techreborn/tiles/TileQuantumTank.java @@ -39,9 +39,9 @@ import reborncore.common.util.FluidUtils; import reborncore.common.util.Inventory; import reborncore.common.util.Tank; import techreborn.TechReborn; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; import javax.annotation.Nullable; diff --git a/src/main/java/techreborn/tiles/cable/TileCable.java b/src/main/java/techreborn/tiles/cable/TileCable.java index e127d9cc7..ba263dd46 100644 --- a/src/main/java/techreborn/tiles/cable/TileCable.java +++ b/src/main/java/techreborn/tiles/cable/TileCable.java @@ -193,8 +193,9 @@ public class TileCable extends TileEntity } int energyReceived = Math.min(getMaxEnergyStored() - getEnergyStored(), Math.min(transferRate, maxReceive)); - if (!simulate) + if (!simulate) { power += energyReceived; + } return energyReceived; } @@ -205,8 +206,9 @@ public class TileCable extends TileEntity } int energyExtracted = Math.min(getEnergyStored(), Math.min(transferRate, maxExtract)); - if (!simulate) + if (!simulate) { power -= energyExtracted; + } return energyExtracted; } @@ -244,8 +246,7 @@ public class TileCable extends TileEntity + TextFormatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(transferRate / RebornCoreConfig.euPerFU) + "/t"); info.add(TextFormatting.GRAY + StringUtils.t("techreborn.tooltip.tier") + ": " - + TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(this.cableType.tier.toString())); - } + + TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(cableType.tier.toString())); } // IToolDrop diff --git a/src/main/java/techreborn/tiles/fusionReactor/TileFusionControlComputer.java b/src/main/java/techreborn/tiles/fusionReactor/TileFusionControlComputer.java index 7254aef31..9a4e1a8bb 100644 --- a/src/main/java/techreborn/tiles/fusionReactor/TileFusionControlComputer.java +++ b/src/main/java/techreborn/tiles/fusionReactor/TileFusionControlComputer.java @@ -41,9 +41,9 @@ import reborncore.common.util.Torus; import techreborn.TechReborn; import techreborn.api.reactor.FusionReactorRecipe; import techreborn.api.reactor.FusionReactorRecipeHelper; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; import java.util.List; @@ -344,7 +344,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor return tagCompound; } - // TileMachineBase + // TileLegacyMachineBase @Override public void onLoad() { super.onLoad(); diff --git a/src/main/java/techreborn/tiles/generator/TilePlasmaGenerator.java b/src/main/java/techreborn/tiles/generator/TilePlasmaGenerator.java index d49974dea..e9ff72a22 100644 --- a/src/main/java/techreborn/tiles/generator/TilePlasmaGenerator.java +++ b/src/main/java/techreborn/tiles/generator/TilePlasmaGenerator.java @@ -30,10 +30,11 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.impl.ConfigRegistry; import techreborn.TechReborn; import techreborn.api.generator.EFluidGenerator; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.lib.ModInfo; @RebornRegister(modID = TechReborn.MOD_ID) public class TilePlasmaGenerator extends TileBaseFluidGenerator implements IContainerProvider { diff --git a/src/main/java/techreborn/tiles/generator/advanced/TileDieselGenerator.java b/src/main/java/techreborn/tiles/generator/advanced/TileDieselGenerator.java index f59cfb756..06ab96102 100644 --- a/src/main/java/techreborn/tiles/generator/advanced/TileDieselGenerator.java +++ b/src/main/java/techreborn/tiles/generator/advanced/TileDieselGenerator.java @@ -30,11 +30,11 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.impl.ConfigRegistry; import techreborn.TechReborn; import techreborn.api.generator.EFluidGenerator; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; import techreborn.tiles.generator.TileBaseFluidGenerator; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; @RebornRegister(modID = TechReborn.MOD_ID) public class TileDieselGenerator extends TileBaseFluidGenerator implements IContainerProvider { diff --git a/src/main/java/techreborn/tiles/generator/advanced/TileGasTurbine.java b/src/main/java/techreborn/tiles/generator/advanced/TileGasTurbine.java index bf81cf233..8091352eb 100644 --- a/src/main/java/techreborn/tiles/generator/advanced/TileGasTurbine.java +++ b/src/main/java/techreborn/tiles/generator/advanced/TileGasTurbine.java @@ -30,11 +30,12 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.impl.ConfigRegistry; import techreborn.TechReborn; import techreborn.api.generator.EFluidGenerator; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; import techreborn.tiles.generator.TileBaseFluidGenerator; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.lib.ModInfo; @RebornRegister(modID = TechReborn.MOD_ID) public class TileGasTurbine extends TileBaseFluidGenerator implements IContainerProvider { diff --git a/src/main/java/techreborn/tiles/generator/advanced/TileSemiFluidGenerator.java b/src/main/java/techreborn/tiles/generator/advanced/TileSemiFluidGenerator.java index 55b3270b2..cfa237895 100644 --- a/src/main/java/techreborn/tiles/generator/advanced/TileSemiFluidGenerator.java +++ b/src/main/java/techreborn/tiles/generator/advanced/TileSemiFluidGenerator.java @@ -30,11 +30,12 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.impl.ConfigRegistry; import techreborn.TechReborn; import techreborn.api.generator.EFluidGenerator; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; import techreborn.tiles.generator.TileBaseFluidGenerator; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.lib.ModInfo; @RebornRegister(modID = TechReborn.MOD_ID) public class TileSemiFluidGenerator extends TileBaseFluidGenerator implements IContainerProvider { diff --git a/src/main/java/techreborn/tiles/generator/advanced/TileThermalGenerator.java b/src/main/java/techreborn/tiles/generator/advanced/TileThermalGenerator.java index 295a66111..ca6d74fee 100644 --- a/src/main/java/techreborn/tiles/generator/advanced/TileThermalGenerator.java +++ b/src/main/java/techreborn/tiles/generator/advanced/TileThermalGenerator.java @@ -30,11 +30,12 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.impl.ConfigRegistry; import techreborn.TechReborn; import techreborn.api.generator.EFluidGenerator; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; import techreborn.tiles.generator.TileBaseFluidGenerator; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.lib.ModInfo; @RebornRegister(modID = TechReborn.MOD_ID) public class TileThermalGenerator extends TileBaseFluidGenerator implements IContainerProvider { diff --git a/src/main/java/techreborn/tiles/generator/basic/TileSolidFuelGenerator.java b/src/main/java/techreborn/tiles/generator/basic/TileSolidFuelGenerator.java index 9cd7e8169..a9224f449 100644 --- a/src/main/java/techreborn/tiles/generator/basic/TileSolidFuelGenerator.java +++ b/src/main/java/techreborn/tiles/generator/basic/TileSolidFuelGenerator.java @@ -39,9 +39,9 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; @RebornRegister(modID = TechReborn.MOD_ID) diff --git a/src/main/java/techreborn/tiles/machine/iron/TileIronAlloyFurnace.java b/src/main/java/techreborn/tiles/machine/iron/TileIronAlloyFurnace.java index bd719447c..2e602c4cf 100644 --- a/src/main/java/techreborn/tiles/machine/iron/TileIronAlloyFurnace.java +++ b/src/main/java/techreborn/tiles/machine/iron/TileIronAlloyFurnace.java @@ -43,10 +43,11 @@ import reborncore.common.util.ItemUtils; import techreborn.TechReborn; import techreborn.api.Reference; import techreborn.api.recipe.machines.AlloySmelterRecipe; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.lib.ModInfo; @RebornRegister(modID = TechReborn.MOD_ID) public class TileIronAlloyFurnace extends TileMachineBase diff --git a/src/main/java/techreborn/tiles/machine/iron/TileIronFurnace.java b/src/main/java/techreborn/tiles/machine/iron/TileIronFurnace.java index d8437a1b3..69d89ad51 100644 --- a/src/main/java/techreborn/tiles/machine/iron/TileIronFurnace.java +++ b/src/main/java/techreborn/tiles/machine/iron/TileIronFurnace.java @@ -35,9 +35,9 @@ import reborncore.common.tile.TileMachineBase; import reborncore.common.util.IInventoryAccess; import reborncore.common.util.Inventory; import reborncore.common.util.ItemUtils; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; public class TileIronFurnace extends TileMachineBase implements ItemHandlerProvider, IContainerProvider { diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileDistillationTower.java b/src/main/java/techreborn/tiles/machine/multiblock/TileDistillationTower.java index 3f6382bc3..9db30fd64 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileDistillationTower.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileDistillationTower.java @@ -33,10 +33,11 @@ import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; import techreborn.api.Reference; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.lib.ModInfo; import techreborn.tiles.TileGenericMachine; @RebornRegister(modID = TechReborn.MOD_ID) diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileFluidReplicator.java b/src/main/java/techreborn/tiles/machine/multiblock/TileFluidReplicator.java index cd4ce60e5..8033ff097 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileFluidReplicator.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileFluidReplicator.java @@ -36,10 +36,11 @@ import reborncore.common.util.Inventory; import reborncore.common.util.Tank; import techreborn.TechReborn; import techreborn.api.fluidreplicator.FluidReplicatorRecipeCrafter; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.lib.ModInfo; import techreborn.tiles.TileGenericMachine; import javax.annotation.Nullable; @@ -130,7 +131,7 @@ public class TileFluidReplicator extends TileGenericMachine implements IContaine return true; }; } - + // TileMachineBase @Nullable @Override diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileImplosionCompressor.java b/src/main/java/techreborn/tiles/machine/multiblock/TileImplosionCompressor.java index 3e719ded6..ca261c0cb 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileImplosionCompressor.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileImplosionCompressor.java @@ -32,10 +32,11 @@ import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; import techreborn.api.Reference; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.lib.ModInfo; import techreborn.tiles.TileGenericMachine; @RebornRegister(modID = TechReborn.MOD_ID) diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialBlastFurnace.java b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialBlastFurnace.java index e3cff2a66..bd6042606 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialBlastFurnace.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialBlastFurnace.java @@ -41,10 +41,11 @@ import techreborn.api.Reference; import techreborn.api.recipe.ITileRecipeHandler; import techreborn.api.recipe.machines.BlastFurnaceRecipe; import techreborn.blocks.BlockMachineCasing; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.lib.ModInfo; import techreborn.multiblocks.MultiBlockCasing; import techreborn.tiles.TileGenericMachine; import techreborn.tiles.TileMachineCasing; @@ -61,7 +62,7 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC private int cachedHeat; public TileIndustrialBlastFurnace() { - super("IndustrialBlastFurnace", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_BLAST_FURNACE.block, 4); + super("IndustrialBlastFurnace", maxInput, maxEnergy, ModBlocks.INDUSTRIAL_BLAST_FURNACE, 4); final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] { 2, 3 }; this.inventory = new Inventory<>(5, "TileIndustrialBlastFurnace", 64, this).withConfiguredAccess(); diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialGrinder.java b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialGrinder.java index 29ee9aefd..239bedca7 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialGrinder.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialGrinder.java @@ -45,10 +45,11 @@ import techreborn.TechReborn; import techreborn.api.Reference; import techreborn.api.recipe.ITileRecipeHandler; import techreborn.api.recipe.machines.IndustrialGrinderRecipe; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.lib.ModInfo; import techreborn.tiles.TileGenericMachine; import javax.annotation.Nullable; @@ -98,7 +99,7 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai return true; }; } - + // TilePowerAcceptor @Override public void update() { @@ -136,7 +137,7 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai tank.writeToNBT(tagCompound); return tagCompound; } - + // TileMachineBase @Nullable @Override diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialSawmill.java b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialSawmill.java index 6b379b440..135a7dc57 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialSawmill.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialSawmill.java @@ -45,10 +45,11 @@ import techreborn.TechReborn; import techreborn.api.Reference; import techreborn.api.recipe.ITileRecipeHandler; import techreborn.api.recipe.machines.IndustrialSawmillRecipe; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.lib.ModInfo; import techreborn.tiles.TileGenericMachine; import javax.annotation.Nullable; @@ -127,7 +128,7 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai tank.writeToNBT(tagCompound); return tagCompound; } - + // TileMachineBase @Nullable @Override diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileVacuumFreezer.java b/src/main/java/techreborn/tiles/machine/multiblock/TileVacuumFreezer.java index e5483db03..235c52b78 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileVacuumFreezer.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileVacuumFreezer.java @@ -31,10 +31,11 @@ import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; import techreborn.api.Reference; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.lib.ModInfo; import techreborn.tiles.TileGenericMachine; @RebornRegister(modID = TechReborn.MOD_ID) diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileAlloySmelter.java b/src/main/java/techreborn/tiles/machine/tier1/TileAlloySmelter.java index e73f0e36e..b1e775740 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileAlloySmelter.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileAlloySmelter.java @@ -34,9 +34,9 @@ import reborncore.common.util.ItemUtils; import techreborn.TechReborn; import techreborn.api.Reference; import techreborn.api.recipe.machines.AlloySmelterRecipe; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; import techreborn.tiles.TileGenericMachine; diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileAssemblingMachine.java b/src/main/java/techreborn/tiles/machine/tier1/TileAssemblingMachine.java index b179adb4d..298fa0749 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileAssemblingMachine.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileAssemblingMachine.java @@ -31,9 +31,9 @@ import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; import techreborn.api.Reference; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; import techreborn.tiles.TileGenericMachine; diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileAutoCraftingTable.java b/src/main/java/techreborn/tiles/machine/tier1/TileAutoCraftingTable.java index 5a87c7a3f..c467614f2 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileAutoCraftingTable.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileAutoCraftingTable.java @@ -45,9 +45,9 @@ import reborncore.common.util.IInventoryAccess; import reborncore.common.util.Inventory; import reborncore.common.util.ItemUtils; import techreborn.TechReborn; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.ModSounds; import techreborn.init.TRContent; diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileChemicalReactor.java b/src/main/java/techreborn/tiles/machine/tier1/TileChemicalReactor.java index 10d236c29..d3602adb5 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileChemicalReactor.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileChemicalReactor.java @@ -31,10 +31,11 @@ import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; import techreborn.api.Reference; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.lib.ModInfo; import techreborn.tiles.TileGenericMachine; @RebornRegister(modID = TechReborn.MOD_ID) diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileCompressor.java b/src/main/java/techreborn/tiles/machine/tier1/TileCompressor.java index 02814085f..98daa8356 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileCompressor.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileCompressor.java @@ -31,9 +31,9 @@ import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; import techreborn.api.Reference; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; import techreborn.tiles.TileGenericMachine; diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileElectricFurnace.java b/src/main/java/techreborn/tiles/machine/tier1/TileElectricFurnace.java index 74ea26411..19bb259fe 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileElectricFurnace.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileElectricFurnace.java @@ -37,9 +37,9 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; @RebornRegister(modID = TechReborn.MOD_ID) @@ -64,7 +64,7 @@ public class TileElectricFurnace extends TilePowerAcceptor } public int gaugeProgressScaled(int scale) { - return progress * scale / fuelScale; + return progress * scale / (int) (fuelScale * (1.0 - getSpeedMultiplier())); } public void cookItems() { diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileExtractor.java b/src/main/java/techreborn/tiles/machine/tier1/TileExtractor.java index a55849ca4..0a8eb46ca 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileExtractor.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileExtractor.java @@ -31,9 +31,9 @@ import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; import techreborn.api.Reference; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; import techreborn.tiles.TileGenericMachine; diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileGrinder.java b/src/main/java/techreborn/tiles/machine/tier1/TileGrinder.java index 518bfd163..a988bbbb6 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileGrinder.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileGrinder.java @@ -31,9 +31,9 @@ import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; import techreborn.api.Reference; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; import techreborn.tiles.TileGenericMachine; diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileIndustrialElectrolyzer.java b/src/main/java/techreborn/tiles/machine/tier1/TileIndustrialElectrolyzer.java index 80a91ed6b..37278823f 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileIndustrialElectrolyzer.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileIndustrialElectrolyzer.java @@ -32,9 +32,9 @@ import reborncore.common.util.Inventory; import reborncore.common.util.ItemUtils; import techreborn.TechReborn; import techreborn.api.Reference; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; import techreborn.items.DynamicCell; import techreborn.tiles.TileGenericMachine; diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileRecycler.java b/src/main/java/techreborn/tiles/machine/tier1/TileRecycler.java index 5ae1b954a..6ebfc4aa8 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileRecycler.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileRecycler.java @@ -36,10 +36,12 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.items.ingredients.ItemParts; +import techreborn.lib.ModInfo; @RebornRegister(modID = TechReborn.MOD_ID) public class TileRecycler extends TilePowerAcceptor diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileRollingMachine.java b/src/main/java/techreborn/tiles/machine/tier1/TileRollingMachine.java index 053ee181c..81594b5b1 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileRollingMachine.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileRollingMachine.java @@ -42,9 +42,9 @@ import reborncore.common.util.Inventory; import reborncore.common.util.ItemUtils; import techreborn.TechReborn; import techreborn.api.RollingMachineRecipe; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; import javax.annotation.Nonnull; diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileScrapboxinator.java b/src/main/java/techreborn/tiles/machine/tier1/TileScrapboxinator.java index 6731c5fe1..383fab2ca 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileScrapboxinator.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileScrapboxinator.java @@ -30,9 +30,9 @@ import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; import techreborn.api.recipe.ScrapboxRecipeCrafter; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; import techreborn.tiles.TileGenericMachine; diff --git a/src/main/java/techreborn/tiles/storage/TileAdjustableSU.java b/src/main/java/techreborn/tiles/storage/TileAdjustableSU.java index c1c7adcbd..e8642559a 100644 --- a/src/main/java/techreborn/tiles/storage/TileAdjustableSU.java +++ b/src/main/java/techreborn/tiles/storage/TileAdjustableSU.java @@ -32,9 +32,9 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; @RebornRegister(modID = TechReborn.MOD_ID) diff --git a/src/main/java/techreborn/tiles/storage/TileEnergyStorage.java b/src/main/java/techreborn/tiles/storage/TileEnergyStorage.java index f83a926dd..f9425d345 100644 --- a/src/main/java/techreborn/tiles/storage/TileEnergyStorage.java +++ b/src/main/java/techreborn/tiles/storage/TileEnergyStorage.java @@ -34,6 +34,7 @@ import reborncore.api.IToolDrop; import reborncore.api.power.EnumPowerTier; import reborncore.api.tile.ItemHandlerProvider; import reborncore.common.RebornCoreConfig; +import reborncore.common.powerSystem.ExternalPowerSystems; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.util.Inventory; import techreborn.blocks.storage.BlockEnergyStorage; @@ -76,6 +77,8 @@ public class TileEnergyStorage extends TilePowerAcceptor if (getEnergy() >= 0.0 && maxReceive > 0) { powerItem.receiveEnergy((int) useEnergy(maxUse) * RebornCoreConfig.euPerFU, false); } + } else if (ExternalPowerSystems.isPoweredItem(stack)) { + ExternalPowerSystems.chargeItem(this, stack); } } if (!inventory.getStackInSlot(1).isEmpty()) { diff --git a/src/main/java/techreborn/tiles/storage/TileHighVoltageSU.java b/src/main/java/techreborn/tiles/storage/TileHighVoltageSU.java index 9464efa73..de0a7822e 100644 --- a/src/main/java/techreborn/tiles/storage/TileHighVoltageSU.java +++ b/src/main/java/techreborn/tiles/storage/TileHighVoltageSU.java @@ -26,9 +26,9 @@ package techreborn.tiles.storage; import net.minecraft.entity.player.EntityPlayer; import reborncore.api.power.EnumPowerTier; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; /** diff --git a/src/main/java/techreborn/tiles/storage/TileLowVoltageSU.java b/src/main/java/techreborn/tiles/storage/TileLowVoltageSU.java index 3bcc11a93..2b386052c 100644 --- a/src/main/java/techreborn/tiles/storage/TileLowVoltageSU.java +++ b/src/main/java/techreborn/tiles/storage/TileLowVoltageSU.java @@ -26,9 +26,9 @@ package techreborn.tiles.storage; import net.minecraft.entity.player.EntityPlayer; import reborncore.api.power.EnumPowerTier; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; /** diff --git a/src/main/java/techreborn/tiles/storage/TileMediumVoltageSU.java b/src/main/java/techreborn/tiles/storage/TileMediumVoltageSU.java index 3e93e42d9..1843998a8 100644 --- a/src/main/java/techreborn/tiles/storage/TileMediumVoltageSU.java +++ b/src/main/java/techreborn/tiles/storage/TileMediumVoltageSU.java @@ -26,9 +26,9 @@ package techreborn.tiles.storage; import net.minecraft.entity.player.EntityPlayer; import reborncore.api.power.EnumPowerTier; -import techreborn.client.container.IContainerProvider; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.container.builder.ContainerBuilder; +import reborncore.client.containerBuilder.IContainerProvider; +import reborncore.client.containerBuilder.builder.BuiltContainer; +import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; /** diff --git a/src/main/java/techreborn/tiles/storage/lesu/TileLapotronicSU.java b/src/main/java/techreborn/tiles/storage/lesu/TileLapotronicSU.java index 7e66cba49..3f71bcb07 100644 --- a/src/main/java/techreborn/tiles/storage/lesu/TileLapotronicSU.java +++ b/src/main/java/techreborn/tiles/storage/lesu/TileLapotronicSU.java @@ -35,11 +35,11 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.impl.ConfigRegistry; import techreborn.TechReborn; import techreborn.blocks.storage.BlockLapotronicSU; -import techreborn.client.container.IContainerProvider; import techreborn.client.container.builder.BuiltContainer; import techreborn.client.container.builder.ContainerBuilder; import techreborn.init.TRContent; import techreborn.tiles.storage.TileEnergyStorage; +import reborncore.client.containerBuilder.IContainerProvider; import java.util.ArrayList; diff --git a/src/main/java/techreborn/utils/StackWIPHandler.java b/src/main/java/techreborn/utils/StackWIPHandler.java index 27334b854..41e74d6d4 100644 --- a/src/main/java/techreborn/utils/StackWIPHandler.java +++ b/src/main/java/techreborn/utils/StackWIPHandler.java @@ -35,6 +35,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import techreborn.init.TRContent; +import reborncore.common.util.StringUtils; import java.util.ArrayList; @@ -68,7 +69,7 @@ public class StackWIPHandler { public void toolTip(ItemTooltipEvent event) { Block block = Block.getBlockFromItem(event.getItemStack().getItem()); if (block != null && wipBlocks.contains(block)) { - event.getToolTip().add(TextFormatting.RED + "WIP Coming Soon"); + event.getToolTip().add(TextFormatting.RED + StringUtils.t("techreborn.tooltip.wip")); } if (devHeads.contains(event.getItemStack())) { diff --git a/src/main/java/techreborn/world/TechRebornRetroGen.java b/src/main/java/techreborn/world/TechRebornRetroGen.java index 9ce310390..e8a151bfc 100644 --- a/src/main/java/techreborn/world/TechRebornRetroGen.java +++ b/src/main/java/techreborn/world/TechRebornRetroGen.java @@ -74,7 +74,7 @@ public class TechRebornRetroGen { final long zSeed = rng.nextLong() >> 2 + 1L; final long chunkSeed = (xSeed * coord.getX() + zSeed * coord.getZ()) * seed; rng.setSeed(chunkSeed); - TechReborn.worldGen.generate(rng, coord.getX() << 4, coord.getZ() << 4, world, null, null); + TechReborn.worldGen.generate(rng, coord.getX(), coord.getZ(), world, null, null); } } } diff --git a/src/main/java/techreborn/world/TechRebornWorldGen.java b/src/main/java/techreborn/world/TechRebornWorldGen.java index 9e6516286..37b0aa93c 100644 --- a/src/main/java/techreborn/world/TechRebornWorldGen.java +++ b/src/main/java/techreborn/world/TechRebornWorldGen.java @@ -111,10 +111,11 @@ public class TechRebornWorldGen implements IWorldGenerator { for (OreConfig defaultOre : defaultOres) { boolean hasFoundOre = false; for (OreConfig ore : config) { - if (ore.blockName.equals(defaultOre.blockName) && ore.meta == defaultOre.meta) { + if (ore.blockName.replaceAll(":", ".").equals(defaultOre.blockName.replaceAll(":", ".")) && ore.meta == defaultOre.meta) { hasFoundOre = true; // Should allow for states to be saved/loaded ore.state = defaultOre.state; + break; } } if (!hasFoundOre) { @@ -274,7 +275,7 @@ public class TechRebornWorldGen implements IWorldGenerator { treeGenerator.generate(world, random, new BlockPos(x, 72, z)); } } - retroGen.markChunk(ChunkCoord.of(chunkX, chunkZ)); } + retroGen.markChunk(ChunkCoord.of(chunkX, chunkZ)); } } diff --git a/src/main/java/techreborn/world/config/OreConfig.java b/src/main/java/techreborn/world/config/OreConfig.java index 9edf80fba..9419a3442 100644 --- a/src/main/java/techreborn/world/config/OreConfig.java +++ b/src/main/java/techreborn/world/config/OreConfig.java @@ -64,4 +64,7 @@ public class OreConfig { this.minYHeight = minYHeight; this.maxYHeight = maxYHeight; } + + public OreConfig() { + } } diff --git a/src/main/resources/assets/techreborn/lang/en_us.lang b/src/main/resources/assets/techreborn/lang/en_us.lang index 40bfacecf..524277a2c 100644 --- a/src/main/resources/assets/techreborn/lang/en_us.lang +++ b/src/main/resources/assets/techreborn/lang/en_us.lang @@ -1,6 +1,4 @@ -item.missingRecipe.name=Missing Recipe Placeholder - itemGroup.techreborn=Tech Reborn #Machines @@ -488,43 +486,49 @@ item.techreborn.part.coolant_triple.name=30k Coolant Cell item.techreborn.part.coolant_six.name=60k Coolant Cell item.techreborn.part.carbon_mesh.name=Carbon Mesh item.techreborn.part.carbon_fiber.name=Carbon Fiber +item.techreborn.part.uuMatter.name=UU-Matter -#Tools -item.techreborn.rockcutter.name=Rockcutter -item.techreborn.lithiumbatpack.name=Lithium Batpack -item.techreborn.lapotronpack.name=Lapotronic Orbpack -item.techreborn.omniTool.name=Omni-Tool -item.techreborn.ironDrill.name=Steel Drill -item.techreborn.diamondDrill.name=Diamond Drill -item.techreborn.advancedDrill.name=Advanced Drill -item.techreborn.ironChainsaw.name=Steel Chainsaw -item.techreborn.diamondChainsaw.name=Diamond Chainsaw -item.techreborn.advancedChainsaw.name=Advanced Chainsaw -item.techreborn.lapotronicorb.name=Lapotronic Energy Orb +#Items-Armor item.techreborn.cloakingdevice.name=Cloaking Device -item.techreborn.steelJackhammer.name=Steel Jackhammer -item.techreborn.diamondJackhammer.name=Diamond Jackhammer -item.techreborn.advancedJackhammer.name=Advanced Jackhammer -item.techreborn.frequencyTransmitter.name=Frequency Transmitter -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.lapotronpack.name=Lapotronic Orbpack +item.techreborn.lithiumbatpack.name=Lithium Batpack + +#Items-Battery item.techreborn.energyCrystal.name=Energy Crystal item.techreborn.lapotronCrystal.name=Lapotron Crystal -item.techreborn.treetap.name=Treetap +item.techreborn.lapotronicorb.name=Lapotronic Energy Orb +item.techreborn.lithiumBattery.name=Lithium Battery +item.techreborn.rebattery.name=Battery + +#Items-Tools +item.techreborn.advancedChainsaw.name=Advanced Chainsaw +item.techreborn.advancedDrill.name=Advanced Drill +item.techreborn.advancedJackhammer.name=Advanced Jackhammer +item.techreborn.debug.name=Debug Tool +item.techreborn.diamondChainsaw.name=Diamond Chainsaw +item.techreborn.diamondDrill.name=Diamond Drill +item.techreborn.diamondJackhammer.name=Diamond Jackhammer +item.techreborn.electric_treetap.name=Electric Treetap item.techreborn.nanosaber.name=Nanosaber +item.techreborn.omniTool.name=Omni-Tool +item.techreborn.rockcutter.name=Rockcutter +item.techreborn.ironChainsaw.name=Steel Chainsaw +item.techreborn.ironDrill.name=Steel Drill +item.techreborn.steelJackhammer.name=Steel Jackhammer +item.techreborn.treetap.name=Treetap +item.techreborn.wrench.name=Wrench + +#Items-Misc +item.techreborn.cell.name=Empty Cell +item.techreborn.cell.fluid.name=$fluid$ Cell +item.techreborn.frequencyTransmitter.name=Frequency Transmitter +item.techreborn.manual.name=Tech Reborn Manual +item.techreborn.missingRecipe.name=Missing Recipe Placeholder +item.techreborn.scrapbox.name=Scrap Box item.techreborn.upgrade.overclock.name=Overclocker Upgrade item.techreborn.upgrade.transformer.name=Transformer Upgrade item.techreborn.upgrade.energy_storage.name=Energy Storage Upgrade -item.techreborn.upgrade.ejection.name=Ejector Upgrade -item.techreborn.upgrade.injection.name=Importer Upgrade -item.techreborn.electric_treetap.name=Electric Treetap -item.techreborn.uuMatter.name=UU-Matter -item.techreborn.manual.name=Tech Manual -item.techreborn.debug.name=Debug Tool -item.techreborn.wrench.name=Wrench -item.techreborn.scrapbox.name=Scrap Box + item.bronzeSword.name=Bronze Sword item.bronzePickaxe.name=Bronze Pickaxe @@ -585,10 +589,6 @@ techreborn.message.nanosaberInactive=Inactive techreborn.message.nanosaberEnergyErrorTo=Not Enough Energy to techreborn.message.nanosaberEnergyError=Not Enough Energy: -desc.uninsulatedCable=Damages Entities! -desc.transfer=Energy Transfer: -desc.tier=Tier: - keys.techreborn.category=TechReborn Category keys.techreborn.config=Config @@ -597,12 +597,13 @@ techreborn.jei.recipe.start.cost=Start: %s techreborn.jei.recipe.running.cost=%s/t: %s techreborn.jei.recipe.processing.time.1=Time: %s ticks techreborn.jei.recipe.processing.time.2=(%s sec) -jei.techreborn.scrapbox.name=Opening Scrapboxes -techreborn.desc.rubberSap=In order to get sap, you need to find a rubber tree or obtain a rubber tree sapling and proceed to grow it. Once you have obtained a rubber tree, search around for little yellowish spots on the tree. If you don't see any, just wait a bit and eventually these yellow "sap" spots. To harvest the sap, use a treetap and use it on the log. -techreborn.desc.scrapBox=Scrapboxes can be opened by either a simple use in hand, or by dispensers. That's right, just throw your scrapboxes into dispensers and give them a redstone signal, and boom! Random item! -techreborn.desc.scrapBoxNoDispenser=Scrapboxes can be opened by a simple use in hand! + +techreborn.jei.desc.rubberSap=In order to get sap, you need to find a rubber tree or obtain a rubber tree sapling and proceed to grow it. Once you have obtained a rubber tree, search around for little yellowish spots on the tree. If you don't see any, just wait a bit and eventually these yellow "sap" spots. To harvest the sap, use a treetap and use it on the log. +techreborn.jei.desc.scrapBox=Scrapboxes can be opened by either a simple use in hand, or by dispensers. That's right, just throw your scrapboxes into dispensers and give them a redstone signal, and boom! Random item! +techreborn.jei.desc.scrapBoxNoDispenser=Scrapboxes can be opened by a simple use in hand! techreborn.jei.category.alloy.furnace=Alloy Furnace +techreborn.jei.category.scrapbox=Opening Scrapboxes techreborn.jei.category.generator.gas=Gas Generator techreborn.jei.category.generator.semifluid=Semifluid Generator techreborn.jei.category.generator.diesel=Diesel Generator @@ -612,18 +613,15 @@ techreborn.jei.category.generator.plasma=Plasma Generator #Death Messages death.attack.shock=%s was electrocuted - -#Entitys +#Entities entity.nuke.name=Nuke #Tooltips -tooltip.wip=WIP Coming Soon -tooltip.upBroken=Upgrades DO NOT function! -tooltip.ingredient=Currently only a crafting ingredient -techreborn.tooltip.inventory=Inventory -techreborn.tooltip.upgrades=Upgrades techreborn.tooltip.transferRate=Transfer Rate techreborn.tooltip.tier=Tier +techreborn.tooltip.wip=WIP Coming Soon +techreborn.tooltip.inventory=Inventory +techreborn.tooltip.upgrades=Upgrades techreborn.tooltip.alarm=Shift rightclick to change sound #ManualUI @@ -633,7 +631,6 @@ techreborn.manual.wikibtn=Open techreborn.manual.discordbtn=Join #Advancements - advancements.techreborn.root.desc=Now that you have acquired Tech Reborn ore, you might find a tree tap usefull. advancements.techreborn.treetap=TreeTap advancements.techreborn.treetap.desc=Now that you have crafted a tree tap you will want to use it on a sap spot on a rubber tree. diff --git a/src/main/resources/assets/techreborn/textures/gui/elements.png b/src/main/resources/assets/techreborn/textures/gui/elements.png deleted file mode 100644 index 658a48dd7..000000000 Binary files a/src/main/resources/assets/techreborn/textures/gui/elements.png and /dev/null 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 deleted file mode 100644 index e38a415b3..000000000 Binary files a/src/main/resources/assets/techreborn/textures/gui/gui_sheet.png and /dev/null differ diff --git a/src/main/resources/assets/techreborn/textures/items/armor/lithium_batpack.png b/src/main/resources/assets/techreborn/textures/items/armor/lithium_batpack.png index f0a5d704c..37e29d277 100644 Binary files a/src/main/resources/assets/techreborn/textures/items/armor/lithium_batpack.png and b/src/main/resources/assets/techreborn/textures/items/armor/lithium_batpack.png differ