Merge remote-tracking branch 'remotes/origin/1.12' into 1.13-prep
# Conflicts: # build.gradle # src/main/java/techreborn/TechReborn.java # src/main/java/techreborn/blocks/BlockNuke.java # src/main/java/techreborn/blocks/BlockOre.java # src/main/java/techreborn/blocks/BlockRubberLog.java # src/main/java/techreborn/blocks/generator/BlockSolarPanel.java # src/main/java/techreborn/client/RegisterItemJsons.java # src/main/java/techreborn/client/container/builder/BuiltContainer.java # src/main/java/techreborn/client/container/builder/ContainerBuilder.java # src/main/java/techreborn/client/container/builder/ContainerPlayerInventoryBuilder.java # src/main/java/techreborn/client/container/builder/ContainerTileInventoryBuilder.java # src/main/java/techreborn/client/container/builder/slot/FilteredSlot.java # src/main/java/techreborn/client/container/builder/slot/SpriteSlot.java # src/main/java/techreborn/client/container/builder/slot/UpgradeSlot.java # src/main/java/techreborn/client/gui/GuiAESU.java # src/main/java/techreborn/client/gui/GuiAlloySmelter.java # src/main/java/techreborn/client/gui/GuiAssemblingMachine.java # src/main/java/techreborn/client/gui/GuiBase.java # src/main/java/techreborn/client/gui/GuiBlastFurnace.java # src/main/java/techreborn/client/gui/GuiChemicalReactor.java # src/main/java/techreborn/client/gui/GuiCompressor.java # src/main/java/techreborn/client/gui/GuiDieselGenerator.java # src/main/java/techreborn/client/gui/GuiDigitalChest.java # src/main/java/techreborn/client/gui/GuiDistillationTower.java # src/main/java/techreborn/client/gui/GuiElectricFurnace.java # src/main/java/techreborn/client/gui/GuiExtractor.java # src/main/java/techreborn/client/gui/GuiFluidReplicator.java # src/main/java/techreborn/client/gui/GuiFusionReactor.java # src/main/java/techreborn/client/gui/GuiGasTurbine.java # src/main/java/techreborn/client/gui/GuiGenerator.java # src/main/java/techreborn/client/gui/GuiGrinder.java # src/main/java/techreborn/client/gui/GuiImplosionCompressor.java # src/main/java/techreborn/client/gui/GuiIndustrialElectrolyzer.java # src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java # src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java # src/main/java/techreborn/client/gui/GuiIronFurnace.java # src/main/java/techreborn/client/gui/GuiManual.java # src/main/java/techreborn/client/gui/GuiQuantumChest.java # src/main/java/techreborn/client/gui/GuiRecycler.java # src/main/java/techreborn/client/gui/GuiScrapboxinator.java # src/main/java/techreborn/client/gui/GuiSemifluidGenerator.java # src/main/java/techreborn/client/gui/GuiThermalGenerator.java # src/main/java/techreborn/client/gui/GuiVacuumFreezer.java # src/main/java/techreborn/client/gui/TRBuilder.java # src/main/java/techreborn/client/gui/slot/GuiFluidConfiguration.java # src/main/java/techreborn/client/gui/slot/GuiSlotConfiguration.java # src/main/java/techreborn/client/gui/slot/elements/CheckBoxElement.java # src/main/java/techreborn/client/gui/slot/elements/ConfigSlotElement.java # src/main/java/techreborn/client/gui/slot/elements/ElementBase.java # src/main/java/techreborn/client/gui/slot/elements/FluidConfigPopupElement.java # src/main/java/techreborn/client/gui/slot/elements/ISprite.java # src/main/java/techreborn/client/gui/slot/elements/OffsetSprite.java # src/main/java/techreborn/client/gui/slot/elements/SlotConfigPopupElement.java # src/main/java/techreborn/client/gui/slot/elements/Sprite.java # src/main/java/techreborn/compat/CompatManager.java # src/main/java/techreborn/compat/ICompatModule.java # src/main/java/techreborn/compat/jei/BaseRecipeWrapper.java # src/main/java/techreborn/compat/jei/BuiltContainerTransferInfo.java # src/main/java/techreborn/compat/jei/RecipeUtil.java # src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java # src/main/java/techreborn/compat/jei/alloySmelter/AlloySmelterRecipeWrapper.java # src/main/java/techreborn/compat/jei/assemblingMachine/AssemblingMachineRecipeCategory.java # src/main/java/techreborn/compat/jei/assemblingMachine/AssemblingMachineRecipeWrapper.java # src/main/java/techreborn/compat/jei/blastFurnace/BlastFurnaceRecipeWrapper.java # src/main/java/techreborn/compat/jei/centrifuge/CentrifugeRecipeWrapper.java # src/main/java/techreborn/compat/jei/chemicalReactor/ChemicalReactorRecipeWrapper.java # src/main/java/techreborn/compat/jei/compressor/CompressorRecipeWrapper.java # src/main/java/techreborn/compat/jei/distillationTower/DistillationTowerRecipeWrapper.java # src/main/java/techreborn/compat/jei/extractor/ExtractorRecipeWrapper.java # src/main/java/techreborn/compat/jei/fluidReplicator/FluidReplicatorRecipeWrapper.java # src/main/java/techreborn/compat/jei/fusionReactor/FusionReactorRecipeCategory.java # src/main/java/techreborn/compat/jei/fusionReactor/FusionReactorRecipeWrapper.java # src/main/java/techreborn/compat/jei/generators/fluid/FluidGeneratorRecipeWrapper.java # src/main/java/techreborn/compat/jei/grinder/GrinderRecipeWrapper.java # src/main/java/techreborn/compat/jei/implosionCompressor/ImplosionCompressorRecipeWrapper.java # src/main/java/techreborn/compat/jei/industrialGrinder/IndustrialGrinderRecipeWrapper.java # src/main/java/techreborn/compat/jei/industrialSawmill/IndustrialSawmillRecipeWrapper.java # src/main/java/techreborn/compat/jei/rollingMachine/RollingMachineRecipeCategory.java # src/main/java/techreborn/compat/jei/scrapbox/ScrapboxRecipeCategory.java # src/main/java/techreborn/compat/jei/vacuumFreezer/VacuumFreezerRecipeWrapper.java # src/main/java/techreborn/events/BlockBreakHandler.java # src/main/java/techreborn/events/StackToolTipEvent.java # src/main/java/techreborn/init/IC2Duplicates.java # src/main/java/techreborn/init/ModItems.java # src/main/java/techreborn/init/ModRecipes.java # src/main/java/techreborn/init/OreDict.java # src/main/java/techreborn/init/recipes/AlloySmelterRecipes.java # src/main/java/techreborn/init/recipes/ChemicalReactorRecipes.java # src/main/java/techreborn/init/recipes/CraftingTableRecipes.java # src/main/java/techreborn/init/recipes/FusionReactorRecipes.java # src/main/java/techreborn/init/recipes/IndustrialCentrifugeRecipes.java # src/main/java/techreborn/init/recipes/IndustrialSawmillRecipes.java # src/main/java/techreborn/init/recipes/RollingMachineRecipes.java # src/main/java/techreborn/init/recipes/ScrapboxRecipes.java # src/main/java/techreborn/items/ItemDestructopack.java # src/main/java/techreborn/items/ItemFrequencyTransmitter.java # src/main/java/techreborn/items/ItemManual.java # src/main/java/techreborn/items/ItemMissingRecipe.java # src/main/java/techreborn/items/ItemScrapBox.java # src/main/java/techreborn/items/ItemTechManual.java # src/main/java/techreborn/items/ItemUUmatter.java # src/main/java/techreborn/items/ItemUpgrade.java # src/main/java/techreborn/items/ItemUpgrades.java # src/main/java/techreborn/items/armor/ItemCloakingDevice.java # src/main/java/techreborn/items/ingredients/ItemDusts.java # src/main/java/techreborn/items/ingredients/ItemDustsSmall.java # src/main/java/techreborn/items/ingredients/ItemGems.java # src/main/java/techreborn/items/ingredients/ItemIngots.java # src/main/java/techreborn/items/ingredients/ItemNuggets.java # src/main/java/techreborn/items/ingredients/ItemParts.java # src/main/java/techreborn/items/ingredients/ItemPlates.java # src/main/java/techreborn/items/ingredients/ItemUUmatter.java # src/main/java/techreborn/items/tool/ItemDebugTool.java # src/main/java/techreborn/items/tool/ItemTreeTap.java # src/main/java/techreborn/items/tool/basic/ItemElectricTreetap.java # src/main/java/techreborn/items/tools/ItemTechManual.java # src/main/java/techreborn/items/tools/ItemTreeTap.java # src/main/java/techreborn/items/tools/ItemWrench.java # src/main/java/techreborn/lib/ModInfo.java # src/main/java/techreborn/proxies/ClientProxy.java # src/main/java/techreborn/tiles/TileChargeOMat.java # src/main/java/techreborn/tiles/TileChunkLoader.java # src/main/java/techreborn/tiles/TileDigitalChest.java # src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java # src/main/java/techreborn/tiles/TileMatterFabricator.java # src/main/java/techreborn/tiles/TileQuantumChest.java # src/main/java/techreborn/tiles/TileQuantumTank.java # src/main/java/techreborn/tiles/cable/TileCable.java # src/main/java/techreborn/tiles/fusionReactor/TileFusionControlComputer.java # src/main/java/techreborn/tiles/generator/TileCreativeSolarPanel.java # src/main/java/techreborn/tiles/generator/TilePlasmaGenerator.java # src/main/java/techreborn/tiles/generator/advanced/TileDieselGenerator.java # src/main/java/techreborn/tiles/generator/advanced/TileGasTurbine.java # src/main/java/techreborn/tiles/generator/advanced/TileSemiFluidGenerator.java # src/main/java/techreborn/tiles/generator/advanced/TileThermalGenerator.java # src/main/java/techreborn/tiles/generator/basic/TileSolidFuelGenerator.java # src/main/java/techreborn/tiles/machine/iron/TileIronAlloyFurnace.java # src/main/java/techreborn/tiles/machine/multiblock/TileDistillationTower.java # src/main/java/techreborn/tiles/machine/multiblock/TileFluidReplicator.java # src/main/java/techreborn/tiles/machine/multiblock/TileImplosionCompressor.java # src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialBlastFurnace.java # src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialGrinder.java # src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialSawmill.java # src/main/java/techreborn/tiles/machine/multiblock/TileVacuumFreezer.java # src/main/java/techreborn/tiles/machine/tier1/TileAlloySmelter.java # src/main/java/techreborn/tiles/machine/tier1/TileAssemblingMachine.java # src/main/java/techreborn/tiles/machine/tier1/TileAutoCraftingTable.java # src/main/java/techreborn/tiles/machine/tier1/TileChemicalReactor.java # src/main/java/techreborn/tiles/machine/tier1/TileCompressor.java # src/main/java/techreborn/tiles/machine/tier1/TileElectricFurnace.java # src/main/java/techreborn/tiles/machine/tier1/TileExtractor.java # src/main/java/techreborn/tiles/machine/tier1/TileGrinder.java # src/main/java/techreborn/tiles/machine/tier1/TileIndustrialElectrolyzer.java # src/main/java/techreborn/tiles/machine/tier1/TileRecycler.java # src/main/java/techreborn/tiles/machine/tier1/TileRollingMachine.java # src/main/java/techreborn/tiles/machine/tier1/TileScrapboxinator.java # src/main/java/techreborn/tiles/storage/TileAdjustableSU.java # src/main/java/techreborn/tiles/storage/TileEnergyStorage.java # src/main/java/techreborn/tiles/storage/TileHighVoltageSU.java # src/main/java/techreborn/tiles/storage/TileLowVoltageSU.java # src/main/java/techreborn/tiles/storage/TileMediumVoltageSU.java # src/main/java/techreborn/tiles/storage/idsu/TileInterdimensionalSU.java # src/main/java/techreborn/tiles/storage/lesu/TileLapotronicSU.java # src/main/java/techreborn/utils/StackWIPHandler.java # src/main/java/techreborn/world/TechRebornRetroGen.java # src/main/resources/assets/techreborn/textures/items/armor/lithium_batpack.png
This commit is contained in:
commit
4440c2f305
148 changed files with 1016 additions and 5344 deletions
|
@ -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));
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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<String> 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<String> 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
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<ConfigFluidElement> 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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<Integer, ConfigSlotElement> 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<ConfigSlotElement> 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<Rectangle> getExtraSpace(GuiBase guiBase){
|
||||
if(GuiBase.slotConfigType != GuiBase.SlotConfigType.ITEMS || slectedSlot == -1){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<Rectangle> 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -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<CheckBoxElement> 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<CheckBoxElement> 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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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<ElementBase> 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;
|
||||
}
|
||||
}
|
|
@ -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<ElementBase> 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;
|
||||
}
|
||||
}
|
|
@ -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<ElementBase.Action> hoverActions = new ArrayList<>();
|
||||
public List<ElementBase.Action> dragActions = new ArrayList<>();
|
||||
public List<ElementBase.Action> startPressActions = new ArrayList<>();
|
||||
public List<ElementBase.Action> pressActions = new ArrayList<>();
|
||||
public List<ElementBase.Action> releaseActions = new ArrayList<>();
|
||||
public SpriteContainer container;
|
||||
public List<UpdateAction> updateActions = new ArrayList<>();
|
||||
public List<UpdateAction> 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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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.
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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.
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<OffsetSprite> 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;
|
||||
}
|
||||
}
|
|
@ -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_) {
|
||||
|
||||
}
|
||||
}
|
|
@ -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_) {
|
||||
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
||||
|
||||
}
|
|
@ -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<T extends Container> extends GuiContainer {
|
||||
|
||||
public static final LanguageMap translate = ObfuscationReflectionHelper.getPrivateValue(LanguageMap.class, null, 2);
|
||||
|
||||
private final ArrayList<Widget> 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
|
||||
}
|
|
@ -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<ToolTipLine> 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<ToolTipLine> 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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue