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
40
build.gradle
40
build.gradle
|
@ -13,11 +13,16 @@ buildscript {
|
|||
maven {
|
||||
url "https://plugins.gradle.org/m2/"
|
||||
}
|
||||
maven {
|
||||
name = "CB Repo"
|
||||
url = "http://chickenbones.net/maven"
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||
classpath "gradle.plugin.net.minecrell:licenser:0.2.1"
|
||||
classpath 'de.undercouch:gradle-download-task:3.4.3'
|
||||
classpath 'net.covers1624:GradleStuff:1.0-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +31,7 @@ apply plugin: 'maven'
|
|||
apply plugin: 'maven-publish'
|
||||
apply plugin: net.minecrell.gradle.licenser.Licenser
|
||||
apply plugin: 'de.undercouch.download'
|
||||
apply plugin: 'net.covers1624.contained-deps'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
@ -36,17 +42,28 @@ repositories {
|
|||
name = "Modmuss50"
|
||||
url = "http://maven.modmuss50.me/"
|
||||
}
|
||||
maven {
|
||||
// JEI
|
||||
name "JEI"
|
||||
url "http://dvs1.progwml6.com/files/maven"
|
||||
}
|
||||
}
|
||||
|
||||
version = "3.0.0"
|
||||
|
||||
configurations {
|
||||
shade
|
||||
compile.extendsFrom shade
|
||||
}
|
||||
|
||||
|
||||
def ENV = System.getenv()
|
||||
if (ENV.BUILD_NUMBER) {
|
||||
version = version + "." + "${System.getenv().BUILD_NUMBER}"
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = "1.12.2-14.23.4.2757"
|
||||
version = "1.12.2-14.23.5.2768"
|
||||
mappings = "snapshot_20180720"
|
||||
replace "@MODVERSION@", project.version
|
||||
useDepAts = true
|
||||
|
@ -65,6 +82,7 @@ dependencies {
|
|||
deobfCompile('RebornCore:RebornCore-1.12.2:+:universal') {
|
||||
transitive = false
|
||||
}
|
||||
deobfCompile "mezz.jei:jei_1.12.2:+"
|
||||
}
|
||||
|
||||
processResources
|
||||
|
@ -101,16 +119,14 @@ task deobfJar(type: Jar) {
|
|||
}
|
||||
|
||||
|
||||
containedDeps {
|
||||
configuration = "shade"
|
||||
tasks = "jar"
|
||||
}
|
||||
|
||||
jar {
|
||||
exclude "**/*.psd"
|
||||
classifier = 'universal'
|
||||
// configurations.shade.each { dep ->
|
||||
// from(project.zipTree(dep)){
|
||||
// include 'ic2/api/'
|
||||
// include 'forestry/api/fuels/'
|
||||
// exclude 'META-INF', 'META-INF/**', '**/*.java'
|
||||
// }
|
||||
// }
|
||||
manifest {
|
||||
attributes 'FMLAT': 'techreborn_at.cfg'
|
||||
}
|
||||
|
@ -186,12 +202,6 @@ publishing {
|
|||
artifact sourceJar {
|
||||
classifier "sources"
|
||||
}
|
||||
|
||||
|
||||
//Removes all of the dependencies from the maven pom, fixes issues when other projects try to depend on tr
|
||||
pom.withXml {
|
||||
asNode().remove(asNode().get('dependencies'))
|
||||
}
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
|
@ -434,4 +444,4 @@ String humanizeArg(String arg){
|
|||
task copyToLib(type: Copy) {
|
||||
into "$buildDir/output/lib"
|
||||
from configurations.runtime
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,9 @@ import reborncore.common.util.Torus;
|
|||
import techreborn.api.TechRebornAPI;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.command.TechRebornDevCommand;
|
||||
import techreborn.compat.CompatManager;
|
||||
import techreborn.compat.ICompatModule;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.entities.EntityNukePrimed;
|
||||
import techreborn.events.BlockBreakHandler;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
|
@ -125,6 +128,10 @@ public class TechReborn {
|
|||
EntityRegistry.registerModEntity(new ResourceLocation("techreborn", "nuke"), EntityNukePrimed.class, "nuke", 0, INSTANCE, 160, 5, true);
|
||||
|
||||
proxy.preInit(event);
|
||||
|
||||
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
|
||||
compatModule.preInit(event);
|
||||
}
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
|
@ -134,6 +141,11 @@ public class TechReborn {
|
|||
MinecraftForge.EVENT_BUS.register(new ModLoot());
|
||||
// Sounds
|
||||
ModSounds.init();
|
||||
|
||||
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
|
||||
compatModule.init(event);
|
||||
}
|
||||
|
||||
// Client only init, needs to be done before parts system
|
||||
proxy.init(event);
|
||||
// WorldGen
|
||||
|
@ -151,9 +163,12 @@ public class TechReborn {
|
|||
MinecraftForge.EVENT_BUS.register(new TRTickHandler());
|
||||
MinecraftForge.EVENT_BUS.register(worldGen.retroGen);
|
||||
//Village stuff
|
||||
VillagerRegistry.instance().registerVillageCreationHandler(new VillagePlantaionHandler());
|
||||
MapGenStructureIO.registerStructureComponent(VillageComponentRubberPlantaion.class, new ResourceLocation(MOD_ID, "rubberplantation").toString());
|
||||
ModLootTables.CHESTS_RUBBER_PLANTATION.toString(); //Done to make it load, then it will be read from disk
|
||||
if (ConfigTechReborn.enableRubberTreePlantation) {
|
||||
VillagerRegistry.instance().registerVillageCreationHandler(new VillagePlantaionHandler());
|
||||
MapGenStructureIO.registerStructureComponent(VillageComponentRubberPlantaion.class, new ResourceLocation(MOD_ID, "rubberplantation").toString());
|
||||
ModLootTables.CHESTS_RUBBER_PLANTATION.toString(); //Done to make it load, then it will be read from disk
|
||||
}
|
||||
|
||||
// Scrapbox
|
||||
if (BehaviorDispenseScrapbox.dispenseScrapboxes) {
|
||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(TRContent.SCRAP_BOX, new BehaviorDispenseScrapbox());
|
||||
|
|
|
@ -22,15 +22,21 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.container;
|
||||
package techreborn.api;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Created by Mark on 12/04/2017.
|
||||
*/
|
||||
public interface IRightClickHandler {
|
||||
import java.util.List;
|
||||
|
||||
public interface IC2Helper {
|
||||
|
||||
public void initDuplicates();
|
||||
|
||||
public boolean extractSap(EntityPlayer player, World world, BlockPos pos, EnumFacing side, IBlockState state, List<ItemStack> stacks);
|
||||
|
||||
public boolean handleRightClick(int slotID, EntityPlayer player, BuiltContainer container);
|
||||
}
|
|
@ -39,6 +39,8 @@ public final class TechRebornAPI {
|
|||
|
||||
public static ISubItemRetriever subItemRetriever;
|
||||
|
||||
public static IC2Helper ic2Helper;
|
||||
|
||||
public static void addRollingOreMachinceRecipe(ResourceLocation resourceLocation, ItemStack output, Object... components) {
|
||||
RollingMachineRecipe.instance.addShapedOreRecipe(resourceLocation, output, components);
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ public abstract class BaseRecipe implements IBaseRecipeType, Cloneable {
|
|||
throw new InvalidParameterException("input is invalid!");
|
||||
}
|
||||
}
|
||||
if (RecipeTranslator.getStackFromObject(inuput) == null) {
|
||||
if (RecipeTranslator.getStackFromObject(inuput) == null || RecipeTranslator.getStackFromObject(inuput).isEmpty()) {
|
||||
throw new InvalidParameterException("Could not determin recipe input for " + inuput);
|
||||
}
|
||||
inputs.add(inuput);
|
||||
|
|
|
@ -77,7 +77,7 @@ public class BlockOre extends Block {
|
|||
Block ore = state.getBlock();
|
||||
Random random = new Random();
|
||||
|
||||
// Secondary drop, like Yellow Garnet from Sphalerite ore added via event handler.
|
||||
// Secondary drop, like Yellow Garnet from Sphalerite ore added via event handler.
|
||||
if (ore == TRContent.Ores.RUBY.block) {
|
||||
OreDrop ruby = new OreDrop(TRContent.Gems.RUBY.getStack(rubyMinQuatity), rubyMaxQuantity);
|
||||
drops.add(ruby.getDrops(fortune, random));
|
||||
|
|
|
@ -126,7 +126,7 @@ public class BlockCable extends BlockContainer {
|
|||
@Nullable
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TileCable();
|
||||
return new TileCable(getStateFromMeta(meta).getValue(TYPE));
|
||||
}
|
||||
|
||||
// Block
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.network.IGuiHandler;
|
||||
import techreborn.client.container.ContainerDestructoPack;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import techreborn.client.gui.*;
|
||||
import techreborn.client.gui.GuiAutoCrafting;
|
||||
import techreborn.tiles.*;
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class IconSupplier {
|
||||
public static String armour_head_name = "techreborn:gui/slot_sprites/armour_head";
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static TextureAtlasSprite armour_head;
|
||||
|
||||
public static String armour_chest_name = "techreborn:gui/slot_sprites/armour_chest";
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static TextureAtlasSprite armour_chest;
|
||||
|
||||
public static String armour_legs_name = "techreborn:gui/slot_sprites/armour_legs";
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static TextureAtlasSprite armour_legs;
|
||||
|
||||
public static String armour_feet_name = "techreborn:gui/slot_sprites/armour_feet";
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static TextureAtlasSprite armour_feet;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void preTextureStitch(TextureStitchEvent.Pre event) {
|
||||
TextureMap map = event.getMap();
|
||||
armour_head = map.registerSprite(new ResourceLocation(armour_head_name));
|
||||
armour_chest = map.registerSprite(new ResourceLocation(armour_chest_name));
|
||||
armour_legs = map.registerSprite(new ResourceLocation(armour_legs_name));
|
||||
armour_feet = map.registerSprite(new ResourceLocation(armour_feet_name));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
|
||||
public interface IContainerProvider {
|
||||
BuiltContainer createContainer(EntityPlayer player);
|
||||
}
|
|
@ -1,307 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.container.builder;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.apache.commons.lang3.Range;
|
||||
import org.apache.commons.lang3.tuple.MutableTriple;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import reborncore.common.tile.TileMachineBase;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.client.container.IRightClickHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.IntConsumer;
|
||||
import java.util.function.IntSupplier;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class BuiltContainer extends Container {
|
||||
|
||||
private final String name;
|
||||
|
||||
private final Predicate<EntityPlayer> canInteract;
|
||||
private final List<Range<Integer>> playerSlotRanges;
|
||||
private final List<Range<Integer>> tileSlotRanges;
|
||||
|
||||
private final ArrayList<MutableTriple<IntSupplier, IntConsumer, Short>> shortValues;
|
||||
private final ArrayList<MutableTriple<IntSupplier, IntConsumer, Integer>> integerValues;
|
||||
private List<Consumer<InventoryCrafting>> craftEvents;
|
||||
private Integer[] integerParts;
|
||||
|
||||
private final TileMachineBase tile;
|
||||
|
||||
public BuiltContainer(final String name, final Predicate<EntityPlayer> canInteract,
|
||||
final List<Range<Integer>> playerSlotRange,
|
||||
final List<Range<Integer>> tileSlotRange, TileMachineBase tile) {
|
||||
this.name = name;
|
||||
|
||||
this.canInteract = canInteract;
|
||||
|
||||
this.playerSlotRanges = playerSlotRange;
|
||||
this.tileSlotRanges = tileSlotRange;
|
||||
|
||||
this.shortValues = new ArrayList<>();
|
||||
this.integerValues = new ArrayList<>();
|
||||
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
public void addShortSync(final List<Pair<IntSupplier, IntConsumer>> syncables) {
|
||||
|
||||
for (final Pair<IntSupplier, IntConsumer> syncable : syncables)
|
||||
this.shortValues.add(MutableTriple.of(syncable.getLeft(), syncable.getRight(), (short) 0));
|
||||
this.shortValues.trimToSize();
|
||||
}
|
||||
|
||||
public void addIntegerSync(final List<Pair<IntSupplier, IntConsumer>> syncables) {
|
||||
|
||||
for (final Pair<IntSupplier, IntConsumer> syncable : syncables)
|
||||
this.integerValues.add(MutableTriple.of(syncable.getLeft(), syncable.getRight(), 0));
|
||||
this.integerValues.trimToSize();
|
||||
this.integerParts = new Integer[this.integerValues.size()];
|
||||
}
|
||||
|
||||
public void addCraftEvents(final List<Consumer<InventoryCrafting>> craftEvents) {
|
||||
this.craftEvents = craftEvents;
|
||||
}
|
||||
|
||||
public void addSlot(final Slot slot) {
|
||||
this.addSlotToContainer(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(final EntityPlayer playerIn) {
|
||||
if(this.tile != null) {
|
||||
return playerIn.getDistanceSq((double) tile.getPos().getX() + 0.5D, (double) tile.getPos().getY() + 0.5D, (double) tile.getPos().getZ() + 0.5D) <= 64.0D;
|
||||
} else {
|
||||
return this.canInteract.test(playerIn); // <
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onCraftMatrixChanged(final IInventory inv) {
|
||||
if (!this.craftEvents.isEmpty())
|
||||
this.craftEvents.forEach(consumer -> consumer.accept((InventoryCrafting) inv));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
|
||||
if (dragType == 1 && slotId > 0 && slotId < 1000) {
|
||||
Slot slot = this.inventorySlots.get(slotId);
|
||||
if (slot instanceof IRightClickHandler) {
|
||||
if (((IRightClickHandler) slot).handleRightClick(slot.getSlotIndex(), player, this)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
for (final IContainerListener listener : this.listeners) {
|
||||
|
||||
int i = 0;
|
||||
if (!this.shortValues.isEmpty())
|
||||
for (final MutableTriple<IntSupplier, IntConsumer, Short> value : this.shortValues) {
|
||||
final short supplied = (short) value.getLeft().getAsInt();
|
||||
if (supplied != value.getRight()) {
|
||||
|
||||
listener.sendWindowProperty(this, i, supplied);
|
||||
value.setRight(supplied);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if (!this.integerValues.isEmpty())
|
||||
for (final MutableTriple<IntSupplier, IntConsumer, Integer> value : this.integerValues) {
|
||||
final int supplied = value.getLeft().getAsInt();
|
||||
if (supplied != value.getRight()) {
|
||||
|
||||
listener.sendWindowProperty(this, i, supplied >> 16);
|
||||
listener.sendWindowProperty(this, i + 1, (short) (supplied & 0xFFFF));
|
||||
value.setRight(supplied);
|
||||
}
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(final IContainerListener listener) {
|
||||
super.addListener(listener);
|
||||
|
||||
int i = 0;
|
||||
if (!this.shortValues.isEmpty())
|
||||
for (final MutableTriple<IntSupplier, IntConsumer, Short> value : this.shortValues) {
|
||||
final short supplied = (short) value.getLeft().getAsInt();
|
||||
|
||||
listener.sendWindowProperty(this, i, supplied);
|
||||
value.setRight(supplied);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (!this.integerValues.isEmpty())
|
||||
for (final MutableTriple<IntSupplier, IntConsumer, Integer> value : this.integerValues) {
|
||||
final int supplied = value.getLeft().getAsInt();
|
||||
|
||||
listener.sendWindowProperty(this, i, supplied >> 16);
|
||||
listener.sendWindowProperty(this, i + 1, (short) (supplied & 0xFFFF));
|
||||
value.setRight(supplied);
|
||||
i += 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void updateProgressBar(final int id, final int value) {
|
||||
|
||||
if (id < this.shortValues.size()) {
|
||||
this.shortValues.get(id).getMiddle().accept((short) value);
|
||||
this.shortValues.get(id).setRight((short) value);
|
||||
} else if (id - this.shortValues.size() < this.integerValues.size() * 2) {
|
||||
|
||||
if ((id - this.shortValues.size()) % 2 == 0)
|
||||
this.integerParts[(id - this.shortValues.size()) / 2] = value;
|
||||
else {
|
||||
this.integerValues.get((id - this.shortValues.size()) / 2).getMiddle().accept(
|
||||
(this.integerParts[(id - this.shortValues.size()) / 2] & 0xFFFF) << 16 | value & 0xFFFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(final EntityPlayer player, final int index) {
|
||||
|
||||
ItemStack originalStack = ItemStack.EMPTY;
|
||||
|
||||
final Slot slot = this.inventorySlots.get(index);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
|
||||
final ItemStack stackInSlot = slot.getStack();
|
||||
originalStack = stackInSlot.copy();
|
||||
|
||||
boolean shifted = false;
|
||||
|
||||
for (final Range<Integer> range : this.playerSlotRanges)
|
||||
if (range.contains(index)) {
|
||||
|
||||
if (this.shiftToTile(stackInSlot))
|
||||
shifted = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!shifted)
|
||||
for (final Range<Integer> range : this.tileSlotRanges)
|
||||
if (range.contains(index)) {
|
||||
if (this.shiftToPlayer(stackInSlot))
|
||||
shifted = true;
|
||||
break;
|
||||
}
|
||||
|
||||
slot.onSlotChange(stackInSlot, originalStack);
|
||||
if (stackInSlot.getCount() <= 0)
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
else
|
||||
slot.onSlotChanged();
|
||||
if (stackInSlot.getCount() == originalStack.getCount())
|
||||
return ItemStack.EMPTY;
|
||||
slot.onTake(player, stackInSlot);
|
||||
}
|
||||
return originalStack;
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected boolean shiftItemStack(final ItemStack stackToShift, final int start, final int end) {
|
||||
boolean changed = false;
|
||||
if (stackToShift.isStackable()) {
|
||||
for (int slotIndex = start; stackToShift.getCount() > 0 && slotIndex < end; slotIndex++) {
|
||||
final Slot slot = this.inventorySlots.get(slotIndex);
|
||||
final ItemStack stackInSlot = slot.getStack();
|
||||
if (!stackInSlot.isEmpty() && ItemUtils.isItemEqual(stackInSlot, stackToShift, true, true)
|
||||
&& slot.isItemValid(stackToShift)) {
|
||||
final int resultingStackSize = stackInSlot.getCount() + stackToShift.getCount();
|
||||
final int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit());
|
||||
if (resultingStackSize <= max) {
|
||||
stackToShift.setCount(0);
|
||||
stackInSlot.setCount(resultingStackSize);
|
||||
slot.onSlotChanged();
|
||||
changed = true;
|
||||
} else if (stackInSlot.getCount() < max) {
|
||||
stackToShift.shrink(max - stackInSlot.getCount());
|
||||
stackInSlot.setCount(max);
|
||||
slot.onSlotChanged();
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stackToShift.getCount() > 0) {
|
||||
for (int slotIndex = start; stackToShift.getCount() > 0 && slotIndex < end; slotIndex++) {
|
||||
final Slot slot = this.inventorySlots.get(slotIndex);
|
||||
ItemStack stackInSlot = slot.getStack();
|
||||
if (stackInSlot.isEmpty() && slot.isItemValid(stackToShift)) {
|
||||
final int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit());
|
||||
stackInSlot = stackToShift.copy();
|
||||
stackInSlot.setCount(Math.min(stackToShift.getCount(), max));
|
||||
stackToShift.shrink(stackInSlot.getCount());
|
||||
slot.putStack(stackInSlot);
|
||||
slot.onSlotChanged();
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
private boolean shiftToTile(final ItemStack stackToShift) {
|
||||
for (final Range<Integer> range : this.tileSlotRanges)
|
||||
if (this.shiftItemStack(stackToShift, range.getMinimum(), range.getMaximum() + 1))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean shiftToPlayer(final ItemStack stackToShift) {
|
||||
for (final Range<Integer> range : this.playerSlotRanges)
|
||||
if (this.shiftItemStack(stackToShift, range.getMinimum(), range.getMaximum() + 1))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.container.builder;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import org.apache.commons.lang3.Range;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import reborncore.common.tile.TileMachineBase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.IntConsumer;
|
||||
import java.util.function.IntSupplier;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class ContainerBuilder {
|
||||
|
||||
private final String name;
|
||||
|
||||
private Predicate<EntityPlayer> canInteract = player -> true;
|
||||
|
||||
final List<Slot> slots;
|
||||
final List<Range<Integer>> playerInventoryRanges, tileInventoryRanges;
|
||||
|
||||
final List<Pair<IntSupplier, IntConsumer>> shortValues;
|
||||
final List<Pair<IntSupplier, IntConsumer>> integerValues;
|
||||
|
||||
final List<Consumer<InventoryCrafting>> craftEvents;
|
||||
|
||||
public ContainerBuilder(final String name) {
|
||||
|
||||
this.name = name;
|
||||
|
||||
this.slots = new ArrayList<>();
|
||||
this.playerInventoryRanges = new ArrayList<>();
|
||||
this.tileInventoryRanges = new ArrayList<>();
|
||||
|
||||
this.shortValues = new ArrayList<>();
|
||||
this.integerValues = new ArrayList<>();
|
||||
|
||||
this.craftEvents = new ArrayList<>();
|
||||
}
|
||||
|
||||
public ContainerBuilder interact(final Predicate<EntityPlayer> canInteract) {
|
||||
this.canInteract = canInteract;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContainerPlayerInventoryBuilder player(final InventoryPlayer player) {
|
||||
return new ContainerPlayerInventoryBuilder(this, player);
|
||||
}
|
||||
|
||||
public ContainerTileInventoryBuilder tile(final TileMachineBase tile) {
|
||||
return new ContainerTileInventoryBuilder(this, tile);
|
||||
}
|
||||
|
||||
void addPlayerInventoryRange(final Range<Integer> range) {
|
||||
this.playerInventoryRanges.add(range);
|
||||
}
|
||||
|
||||
void addTileInventoryRange(final Range<Integer> range) {
|
||||
this.tileInventoryRanges.add(range);
|
||||
}
|
||||
|
||||
public BuiltContainer create(final TileMachineBase tile) {
|
||||
final BuiltContainer built = new BuiltContainer(this.name, this.canInteract,
|
||||
this.playerInventoryRanges,
|
||||
this.tileInventoryRanges, tile);
|
||||
if (!this.shortValues.isEmpty())
|
||||
built.addShortSync(this.shortValues);
|
||||
if (!this.integerValues.isEmpty())
|
||||
built.addIntegerSync(this.integerValues);
|
||||
if (!this.craftEvents.isEmpty())
|
||||
built.addCraftEvents(this.craftEvents);
|
||||
|
||||
this.slots.forEach(built::addSlot);
|
||||
|
||||
this.slots.clear();
|
||||
return built;
|
||||
}
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.container.builder;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraftforge.items.wrapper.InvWrapper;
|
||||
import org.apache.commons.lang3.Range;
|
||||
import techreborn.client.IconSupplier;
|
||||
import techreborn.client.container.builder.slot.SpriteSlot;
|
||||
|
||||
public final class ContainerPlayerInventoryBuilder {
|
||||
|
||||
private final InventoryPlayer player;
|
||||
private final ContainerBuilder parent;
|
||||
private Range<Integer> main;
|
||||
private Range<Integer> hotbar;
|
||||
private Range<Integer> armor;
|
||||
|
||||
ContainerPlayerInventoryBuilder(final ContainerBuilder parent, final InventoryPlayer player) {
|
||||
this.player = player;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public ContainerPlayerInventoryBuilder inventory(final int xStart, final int yStart) {
|
||||
final int startIndex = this.parent.slots.size();
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int j = 0; j < 9; ++j)
|
||||
this.parent.slots.add(new Slot(this.player, j + i * 9 + 9, xStart + j * 18, yStart + i * 18));
|
||||
this.main = Range.between(startIndex, this.parent.slots.size() - 1);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContainerPlayerInventoryBuilder hotbar(final int xStart, final int yStart) {
|
||||
final int startIndex = this.parent.slots.size();
|
||||
for (int i = 0; i < 9; ++i)
|
||||
this.parent.slots.add(new Slot(this.player, i, xStart + i * 18, yStart));
|
||||
this.hotbar = Range.between(startIndex, this.parent.slots.size() - 1);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContainerPlayerInventoryBuilder inventory() {
|
||||
return this.inventory(8, 94);
|
||||
}
|
||||
|
||||
public ContainerPlayerInventoryBuilder hotbar() {
|
||||
return this.hotbar(8, 152);
|
||||
}
|
||||
|
||||
public ContainerPlayerArmorInventoryBuilder armor() {
|
||||
return new ContainerPlayerArmorInventoryBuilder(this);
|
||||
}
|
||||
|
||||
public ContainerBuilder addInventory() {
|
||||
if (this.hotbar != null)
|
||||
this.parent.addPlayerInventoryRange(this.hotbar);
|
||||
if (this.main != null)
|
||||
this.parent.addPlayerInventoryRange(this.main);
|
||||
if (this.armor != null)
|
||||
this.parent.addTileInventoryRange(this.armor);
|
||||
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public static final class ContainerPlayerArmorInventoryBuilder {
|
||||
private final ContainerPlayerInventoryBuilder parent;
|
||||
private final int startIndex;
|
||||
|
||||
public ContainerPlayerArmorInventoryBuilder(final ContainerPlayerInventoryBuilder parent) {
|
||||
this.parent = parent;
|
||||
this.startIndex = parent.parent.slots.size();
|
||||
}
|
||||
|
||||
private ContainerPlayerArmorInventoryBuilder armor(final int index, final int xStart, final int yStart,
|
||||
final EntityEquipmentSlot slotType, final String sprite) {
|
||||
this.parent.parent.slots.add(new SpriteSlot(new InvWrapper(this.parent.player), index, xStart, yStart, sprite, 1)
|
||||
.setFilter(stack -> stack.getItem().isValidArmor(stack, slotType, this.parent.player.player)));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContainerPlayerArmorInventoryBuilder helmet(final int xStart, final int yStart) {
|
||||
return this.armor(this.parent.player.getSizeInventory() - 2, xStart, yStart, EntityEquipmentSlot.HEAD, IconSupplier.armour_head_name);
|
||||
}
|
||||
|
||||
public ContainerPlayerArmorInventoryBuilder chestplate(final int xStart, final int yStart) {
|
||||
return this.armor(this.parent.player.getSizeInventory() - 3, xStart, yStart, EntityEquipmentSlot.CHEST, IconSupplier.armour_chest_name);
|
||||
}
|
||||
|
||||
public ContainerPlayerArmorInventoryBuilder leggings(final int xStart, final int yStart) {
|
||||
return this.armor(this.parent.player.getSizeInventory() - 4, xStart, yStart, EntityEquipmentSlot.LEGS, IconSupplier.armour_legs_name);
|
||||
}
|
||||
|
||||
public ContainerPlayerArmorInventoryBuilder boots(final int xStart, final int yStart) {
|
||||
return this.armor(this.parent.player.getSizeInventory() - 5, xStart, yStart, EntityEquipmentSlot.FEET, IconSupplier.armour_feet_name);
|
||||
}
|
||||
|
||||
public ContainerPlayerArmorInventoryBuilder complete(final int xStart, final int yStart) {
|
||||
return this.helmet(xStart, yStart).chestplate(xStart, yStart + 18).leggings(xStart, yStart + 18 + 18)
|
||||
.boots(xStart, yStart + 18 + 18 + 18);
|
||||
}
|
||||
|
||||
public ContainerPlayerInventoryBuilder addArmor() {
|
||||
this.parent.armor = Range.between(this.startIndex, this.parent.parent.slots.size() - 1);
|
||||
return this.parent;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,173 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.container.builder;
|
||||
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import org.apache.commons.lang3.Range;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IUpgradeable;
|
||||
import reborncore.client.gui.slots.BaseSlot;
|
||||
import reborncore.client.gui.slots.SlotFake;
|
||||
import reborncore.client.gui.slots.SlotOutput;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.tile.TileMachineBase;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.client.container.builder.slot.FilteredSlot;
|
||||
import techreborn.client.container.builder.slot.FurnaceFuelSlot;
|
||||
import techreborn.client.container.builder.slot.UpgradeSlot;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.IntConsumer;
|
||||
import java.util.function.IntSupplier;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class ContainerTileInventoryBuilder {
|
||||
|
||||
private final TileMachineBase tile;
|
||||
private final ContainerBuilder parent;
|
||||
private final int rangeStart;
|
||||
|
||||
ContainerTileInventoryBuilder(final ContainerBuilder parent, final TileMachineBase tile) {
|
||||
this.tile = tile;
|
||||
this.parent = parent;
|
||||
this.rangeStart = parent.slots.size();
|
||||
//Ensure that the tile has an inv
|
||||
Validate.isTrue(tile.getInventoryForTile().isPresent());
|
||||
if (tile.canBeUpgraded()) {
|
||||
upgradeSlots(tile);
|
||||
}
|
||||
}
|
||||
|
||||
public ContainerTileInventoryBuilder slot(final int index, final int x, final int y) {
|
||||
this.parent.slots.add(new BaseSlot(this.tile.getInventoryForTile().get(), index, x, y));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContainerTileInventoryBuilder outputSlot(final int index, final int x, final int y) {
|
||||
this.parent.slots.add(new SlotOutput(this.tile.getInventoryForTile().get(), index, x, y));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContainerTileInventoryBuilder fakeSlot(final int index, final int x, final int y) {
|
||||
this.parent.slots.add(new SlotFake(this.tile.getInventoryForTile().get(), index, x, y, false, false, Integer.MAX_VALUE));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContainerTileInventoryBuilder filterSlot(final int index, final int x, final int y,
|
||||
final Predicate<ItemStack> filter) {
|
||||
this.parent.slots.add(new FilteredSlot(this.tile.getInventoryForTile().get(), index, x, y).setFilter(filter));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContainerTileInventoryBuilder energySlot(final int index, final int x, final int y) {
|
||||
this.parent.slots.add(new FilteredSlot(this.tile.getInventoryForTile().get(), index, x, y)
|
||||
.setFilter(stack -> stack.hasCapability(CapabilityEnergy.ENERGY, EnumFacing.UP)));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContainerTileInventoryBuilder fluidSlot(final int index, final int x, final int y) {
|
||||
this.parent.slots.add(new FilteredSlot(this.tile.getInventoryForTile().get(), index, x, y).setFilter(
|
||||
stack -> stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, EnumFacing.UP)));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContainerTileInventoryBuilder fuelSlot(final int index, final int x, final int y) {
|
||||
this.parent.slots.add(new FurnaceFuelSlot(this.tile.getInventoryForTile().get(), index, x, y));
|
||||
return this;
|
||||
}
|
||||
|
||||
private ContainerTileInventoryBuilder upgradeSlots(IUpgradeable upgradeable) {
|
||||
if (upgradeable.canBeUpgraded()) {
|
||||
for (int i = 0; i < upgradeable.getUpgradeSlotCount(); i++) {
|
||||
this.parent.slots.add(new UpgradeSlot(upgradeable.getUpgradeInvetory(), i, -19, i * 18 + 12));
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param supplier The supplier must supply a variable holding inside a Short, it
|
||||
* will be truncated by force.
|
||||
* @param setter The setter to call when the variable has been updated.
|
||||
* @return ContainerTileInventoryBuilder Inventory which will do the sync
|
||||
*/
|
||||
public ContainerTileInventoryBuilder syncShortValue(final IntSupplier supplier, final IntConsumer setter) {
|
||||
this.parent.shortValues.add(Pair.of(supplier, setter));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param supplier The supplier it can supply a variable holding in an Integer it
|
||||
* will be split inside multiples shorts.
|
||||
* @param setter The setter to call when the variable has been updated.
|
||||
* @return ContainerTileInventoryBuilder Inventory which will do the sync
|
||||
*/
|
||||
public ContainerTileInventoryBuilder syncIntegerValue(final IntSupplier supplier, final IntConsumer setter) {
|
||||
this.parent.integerValues.add(Pair.of(supplier, setter));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContainerTileInventoryBuilder syncEnergyValue() {
|
||||
if (this.tile instanceof TilePowerAcceptor)
|
||||
return this.syncIntegerValue(() -> (int) ((TilePowerAcceptor) this.tile).getEnergy(),
|
||||
((TilePowerAcceptor) this.tile)::setEnergy)
|
||||
.syncIntegerValue(() -> (int) ((TilePowerAcceptor) this.tile).extraPowerStoage,
|
||||
((TilePowerAcceptor) this.tile)::setExtraPowerStoage)
|
||||
.syncIntegerValue(() -> (int) ((TilePowerAcceptor) this.tile).getPowerChange(),
|
||||
((TilePowerAcceptor) this.tile)::setPowerChange);
|
||||
TechReborn.LOGGER.error(this.tile + " is not an instance of TilePowerAcceptor! Energy cannot be synced.");
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContainerTileInventoryBuilder syncCrafterValue() {
|
||||
if (this.tile instanceof IRecipeCrafterProvider)
|
||||
return this
|
||||
.syncIntegerValue(() -> ((IRecipeCrafterProvider) this.tile).getRecipeCrafter().currentTickTime,
|
||||
(currentTickTime) -> ((IRecipeCrafterProvider) this.tile)
|
||||
.getRecipeCrafter().currentTickTime = currentTickTime)
|
||||
.syncIntegerValue(() -> ((IRecipeCrafterProvider) this.tile).getRecipeCrafter().currentNeededTicks,
|
||||
(currentNeededTicks) -> ((IRecipeCrafterProvider) this.tile)
|
||||
.getRecipeCrafter().currentNeededTicks = currentNeededTicks);
|
||||
TechReborn.LOGGER
|
||||
.error(this.tile + " is not an instance of IRecipeCrafterProvider! Craft progress cannot be synced.");
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContainerTileInventoryBuilder onCraft(final Consumer<InventoryCrafting> onCraft) {
|
||||
this.parent.craftEvents.add(onCraft);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContainerBuilder addInventory() {
|
||||
this.parent.tileInventoryRanges.add(Range.between(this.rangeStart, this.parent.slots.size() - 1));
|
||||
return this.parent;
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.container.builder.slot;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import reborncore.client.gui.slots.BaseSlot;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class FilteredSlot extends BaseSlot {
|
||||
|
||||
private Predicate<ItemStack> filter;
|
||||
private int stackLimit = 64;
|
||||
|
||||
public FilteredSlot(final IItemHandler inventory, final int index, final int xPosition, final int yPosition) {
|
||||
super(inventory, index, xPosition, yPosition);
|
||||
}
|
||||
|
||||
public FilteredSlot(final IItemHandler inventory, final int index, final int xPosition, final int yPosition, int stackLimit) {
|
||||
super(inventory, index, xPosition, yPosition);
|
||||
this.stackLimit = stackLimit;
|
||||
}
|
||||
|
||||
public FilteredSlot setFilter(final Predicate<ItemStack> filter) {
|
||||
this.filter = filter;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(final ItemStack stack) {
|
||||
try {
|
||||
return this.filter.test(stack);
|
||||
} catch (NullPointerException e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit() {
|
||||
return stackLimit;
|
||||
}
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.container.builder.slot;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class SpriteSlot extends FilteredSlot {
|
||||
|
||||
private final String spriteName;
|
||||
int stacksize;
|
||||
|
||||
public SpriteSlot(final IItemHandler inventory, final int index, final int xPosition, final int yPosition, final String sprite, final int stacksize) {
|
||||
super(inventory, index, xPosition, yPosition);
|
||||
this.spriteName = sprite;
|
||||
this.stacksize = stacksize;
|
||||
}
|
||||
|
||||
public SpriteSlot(final IItemHandler inventory, final int index, final int xPosition, final int yPosition, final String sprite) {
|
||||
this(inventory, index, xPosition, yPosition, sprite, 64);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit() {
|
||||
return this.stacksize;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getSlotTexture() {
|
||||
return this.spriteName;
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.container.builder.slot;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import reborncore.api.tile.IUpgrade;
|
||||
import reborncore.client.gui.slots.BaseSlot;
|
||||
|
||||
public class UpgradeSlot extends BaseSlot {
|
||||
|
||||
public UpgradeSlot(final IItemHandler inventory, final int index, final int xPosition, final int yPosition) {
|
||||
super(inventory, index, xPosition, yPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(final ItemStack stack) {
|
||||
return stack.getItem() instanceof IUpgrade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -131,4 +131,8 @@ public class ConfigTechReborn {
|
|||
|
||||
@ConfigRegistry(config = "world", category = "loot", key = "enableEndLoot", comment = "When true TechReborn will add ingots, machine frames and circuits to The End loot chests.")
|
||||
public static boolean enableEndLoot = true;
|
||||
|
||||
@ConfigRegistry(config = "world", category = "village", key = "enableRubberTreePlantation", comment = "When true TechReborn will add Rubber tree farm to villages.")
|
||||
public static boolean enableRubberTreePlantation = true;
|
||||
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public class StackToolTipEvent {
|
|||
Block block = Block.getBlockFromItem(item);
|
||||
if (block != null && (block instanceof BlockContainer || block instanceof ITileEntityProvider)
|
||||
&& block.getRegistryName().getNamespace().contains("techreborn")) {
|
||||
TileEntity tile = block.createTileEntity(Minecraft.getMinecraft().world,
|
||||
TileEntity tile = block.createTileEntity(Minecraft.getMinecraft().world,
|
||||
block.getStateFromMeta(event.getItemStack().getItemDamage()));
|
||||
boolean hasData = false;
|
||||
if(event.getItemStack().hasTagCompound() && event.getItemStack().getTagCompound().hasKey("tile_data")){
|
||||
|
|
|
@ -43,6 +43,11 @@ import techreborn.api.recipe.machines.VacuumFreezerRecipe;
|
|||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.recipes.*;
|
||||
import techreborn.items.*;
|
||||
import techreborn.items.ingredients.ItemDusts;
|
||||
import techreborn.items.ingredients.ItemDustsSmall;
|
||||
import techreborn.items.ingredients.ItemIngots;
|
||||
import techreborn.items.ingredients.ItemPlates;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
@ -125,7 +130,7 @@ public class ModRecipes {
|
|||
// ItemPlates.getPlateByName("RedGarnet", 9), 300, 4));
|
||||
// RecipeHandler.addRecipe(Reference.COMPRESSOR_RECIPE, new CompressorRecipe(OreUtil.getStackFromName("ingotRefinedIron", 1),
|
||||
// ItemPlates.getPlateByName("RefinedIron"), 300, 4));
|
||||
//
|
||||
//
|
||||
// ItemStack plate;
|
||||
// for (String ore : OreUtil.oreNames) {
|
||||
// if (ore.equals("iridium")) {
|
||||
|
@ -138,7 +143,7 @@ public class ModRecipes {
|
|||
// plate = OreUtil.getStackFromName("plate" + OreUtil.capitalizeFirstLetter(ore), 1);
|
||||
// }
|
||||
// if (plate.isEmpty()) {
|
||||
// continue;
|
||||
// continue;
|
||||
// }
|
||||
// if (OreUtil.hasIngot(ore)) {
|
||||
// RecipeHandler.addRecipe(Reference.COMPRESSOR_RECIPE, new CompressorRecipe(
|
||||
|
@ -202,7 +207,7 @@ public class ModRecipes {
|
|||
// new ItemStack(Blocks.NETHERRACK),
|
||||
// ItemDusts.getDustByName("netherrack"),
|
||||
// 300, 27));
|
||||
//
|
||||
//
|
||||
// RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe(
|
||||
// new ItemStack(Blocks.END_STONE),
|
||||
// ItemDusts.getDustByName("endstone"),
|
||||
|
@ -237,14 +242,14 @@ public class ModRecipes {
|
|||
// ItemStack marbleStack = getOre("stoneMarble");
|
||||
// marbleStack.setCount(1);
|
||||
// RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe(
|
||||
// marbleStack, ItemDusts.getDustByName("marble"),
|
||||
// marbleStack, ItemDusts.getDustByName("marble"),
|
||||
// 120, 10));
|
||||
}
|
||||
if (OreUtil.doesOreExistAndValid("stoneBasalt")) {
|
||||
// ItemStack marbleStack = getOre("stoneBasalt");
|
||||
// marbleStack.setCount(1);
|
||||
// RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe(
|
||||
// marbleStack, ItemDusts.getDustByName("basalt"),
|
||||
// marbleStack, ItemDusts.getDustByName("basalt"),
|
||||
// 120, 10));
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraft.init.Items;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.OreUtil;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import techreborn.api.TechRebornAPI;
|
||||
import techreborn.init.TRContent.Dusts;
|
||||
import techreborn.init.TRContent.Ores;
|
||||
|
||||
|
@ -46,6 +47,9 @@ public class OreDict {
|
|||
* Register blocks and items
|
||||
*/
|
||||
public static void init() {
|
||||
if(TechRebornAPI.ic2Helper != null){
|
||||
TechRebornAPI.ic2Helper.initDuplicates();
|
||||
}
|
||||
// Blocks
|
||||
OreUtil.registerOre("fenceIron", TRContent.REFINED_IRON_FENCE);
|
||||
OreUtil.registerOre("woodRubber", TRContent.RUBBER_LOG);
|
||||
|
@ -100,17 +104,17 @@ public class OreDict {
|
|||
//OreUtil.registerOre("uran235", nothing);
|
||||
//OreUtil.registerOre("uran238", nothing);
|
||||
//OreUtil.registerOre("smallUran235", nothing);
|
||||
|
||||
|
||||
for (Ores ore : TRContent.Ores.values()) {
|
||||
OreUtil.registerOre("ore" + StringUtils.toFirstCapital(ore.name), new ItemStack(ore.block));
|
||||
}
|
||||
|
||||
|
||||
for (Dusts dust : TRContent.Dusts.values()) {
|
||||
OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "dust_" + dust.name), dust.getStack());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// OreUtil.registerOre("blockSilver", BlockStorage.getStorageBlockByName("silver"));
|
||||
// OreUtil.registerOre("blockAluminum", BlockStorage.getStorageBlockByName("aluminum"));
|
||||
// OreUtil.registerOre("blockAluminium", BlockStorage.getStorageBlockByName("aluminum"));
|
||||
|
|
|
@ -27,6 +27,13 @@ package techreborn.init;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.ISubItemRetriever;
|
||||
import techreborn.items.*;
|
||||
import techreborn.items.ingredients.ItemDusts;
|
||||
import techreborn.items.ingredients.ItemDustsSmall;
|
||||
import techreborn.items.ingredients.ItemGems;
|
||||
import techreborn.items.ingredients.ItemIngots;
|
||||
import techreborn.items.ingredients.ItemNuggets;
|
||||
import techreborn.items.ingredients.ItemParts;
|
||||
import techreborn.items.ingredients.ItemPlates;
|
||||
|
||||
/**
|
||||
* Created by Mark on 03/04/2016.
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.api.recipe.RecipeHandler;
|
||||
import reborncore.common.recipes.OreRecipeInput;
|
||||
import reborncore.common.util.OreUtil;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.machines.AlloySmelterRecipe;
|
||||
|
@ -39,64 +40,68 @@ import techreborn.api.recipe.machines.AlloySmelterRecipe;
|
|||
public class AlloySmelterRecipes extends RecipeMethods {
|
||||
|
||||
public static void init() {
|
||||
// Bronze
|
||||
// TODO: Fix Recipe
|
||||
// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
// new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemIngots.getIngotByName("tin", 1),
|
||||
// ItemIngots.getIngotByName("bronze", 4), 200, 16));
|
||||
// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
// new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemDusts.getDustByName("tin", 1),
|
||||
// ItemIngots.getIngotByName("bronze", 4), 200, 16));
|
||||
// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
// new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemIngots.getIngotByName("tin", 1),
|
||||
// ItemIngots.getIngotByName("bronze", 4), 200, 16));
|
||||
// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
// new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemDusts.getDustByName("tin", 1),
|
||||
// ItemIngots.getIngotByName("bronze", 4), 200, 16));
|
||||
|
||||
// Electrum
|
||||
// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
// new AlloySmelterRecipe(new ItemStack(Items.GOLD_INGOT, 1), ItemIngots.getIngotByName("silver", 1),
|
||||
// ItemIngots.getIngotByName("electrum", 2), 200, 16));
|
||||
// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
// new AlloySmelterRecipe(new ItemStack(Items.GOLD_INGOT, 1), ItemDusts.getDustByName("silver", 1),
|
||||
// ItemIngots.getIngotByName("electrum", 2), 200, 16));
|
||||
// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
// new AlloySmelterRecipe(ItemDusts.getDustByName("gold", 1), ItemIngots.getIngotByName("silver", 1),
|
||||
// ItemIngots.getIngotByName("electrum", 2), 200, 16));
|
||||
// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
// new AlloySmelterRecipe(ItemDusts.getDustByName("gold", 1), ItemDusts.getDustByName("silver", 1),
|
||||
// ItemIngots.getIngotByName("electrum", 2), 200, 16));
|
||||
OreRecipeInput ingotCopper3 = new OreRecipeInput("ingotCopper", 3);
|
||||
OreRecipeInput dustCopper3 = new OreRecipeInput("dustCopper", 3);
|
||||
|
||||
// Invar
|
||||
// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
// new AlloySmelterRecipe(new ItemStack(Items.IRON_INGOT, 2), ItemIngots.getIngotByName("nickel", 1),
|
||||
// // Bronze
|
||||
//// TODO: Fix Recipe
|
||||
// RecipeHandler.addRecipe(
|
||||
// new AlloySmelterRecipe(ingotCopper3, "ingotTin",
|
||||
// ItemIngots.getIngotByName("bronze", 4), 200, 16));
|
||||
// RecipeHandler.addRecipe(
|
||||
// new AlloySmelterRecipe(ingotCopper3, "dustTin",
|
||||
// ItemIngots.getIngotByName("bronze", 4), 200, 16));
|
||||
// RecipeHandler.addRecipe(
|
||||
// new AlloySmelterRecipe(dustCopper3, "ingotTin",
|
||||
// ItemIngots.getIngotByName("bronze", 4), 200, 16));
|
||||
// RecipeHandler.addRecipe(
|
||||
// new AlloySmelterRecipe(dustCopper3, "dustTin",
|
||||
// ItemIngots.getIngotByName("bronze", 4), 200, 16));
|
||||
//
|
||||
// // Electrum
|
||||
// RecipeHandler.addRecipe(
|
||||
// new AlloySmelterRecipe(new ItemStack(Items.GOLD_INGOT, 1), "ingotSilver",
|
||||
// ItemIngots.getIngotByName("electrum", 2), 200, 16));
|
||||
// RecipeHandler.addRecipe(
|
||||
// new AlloySmelterRecipe(new ItemStack(Items.GOLD_INGOT, 1), "dustSilver",
|
||||
// ItemIngots.getIngotByName("electrum", 2), 200, 16));
|
||||
// RecipeHandler.addRecipe(
|
||||
// new AlloySmelterRecipe("dustGold", "ingotSilver",
|
||||
// ItemIngots.getIngotByName("electrum", 2), 200, 16));
|
||||
// RecipeHandler.addRecipe(
|
||||
// new AlloySmelterRecipe("dustGold", "dustSilver",
|
||||
// ItemIngots.getIngotByName("electrum", 2), 200, 16));
|
||||
//
|
||||
// // Invar
|
||||
// RecipeHandler.addRecipe(
|
||||
// new AlloySmelterRecipe(new ItemStack(Items.IRON_INGOT, 2), "ingotNickel",
|
||||
// ItemIngots.getIngotByName("invar", 3), 200, 16));
|
||||
// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
// new AlloySmelterRecipe(new ItemStack(Items.IRON_INGOT, 2), ItemDusts.getDustByName("nickel", 1),
|
||||
// RecipeHandler.addRecipe(
|
||||
// new AlloySmelterRecipe(new ItemStack(Items.IRON_INGOT, 2), "dustNickel",
|
||||
// ItemIngots.getIngotByName("invar", 3), 200, 16));
|
||||
// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
// new AlloySmelterRecipe(ItemDusts.getDustByName("iron", 2), ItemIngots.getIngotByName("nickel", 1),
|
||||
// RecipeHandler.addRecipe(
|
||||
// new AlloySmelterRecipe(new OreRecipeInput("dustIron", 2), "ingotNickel",
|
||||
// ItemIngots.getIngotByName("invar", 3), 200, 16));
|
||||
// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
// new AlloySmelterRecipe(ItemDusts.getDustByName("iron", 2), ItemDusts.getDustByName("nickel", 1),
|
||||
// RecipeHandler.addRecipe(
|
||||
// new AlloySmelterRecipe(new OreRecipeInput("dustIron", 2), "dustNickel",
|
||||
// ItemIngots.getIngotByName("invar", 3), 200, 16));
|
||||
|
||||
// Brass
|
||||
//
|
||||
// // Brass
|
||||
// if (OreUtil.doesOreExistAndValid("ingotBrass")) {
|
||||
// ItemStack brassStack = getOre("ingotBrass");
|
||||
// brassStack.setCount(4);
|
||||
// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
// new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemIngots.getIngotByName("zinc", 1),
|
||||
// RecipeHandler.addRecipe(
|
||||
// new AlloySmelterRecipe(ingotCopper3, "ingotZinc",
|
||||
// brassStack, 200, 16));
|
||||
// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
// new AlloySmelterRecipe(ItemIngots.getIngotByName("copper", 3), ItemDusts.getDustByName("zinc", 1),
|
||||
// RecipeHandler.addRecipe(
|
||||
// new AlloySmelterRecipe(ingotCopper3, "dustZinc",
|
||||
// brassStack, 200, 16));
|
||||
// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
// new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemIngots.getIngotByName("zinc", 1),
|
||||
// RecipeHandler.addRecipe(
|
||||
// new AlloySmelterRecipe(dustCopper3, "ingotZinc",
|
||||
// brassStack, 200, 16));
|
||||
// RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
// new AlloySmelterRecipe(ItemDusts.getDustByName("copper", 3), ItemDusts.getDustByName("zinc", 1),
|
||||
// RecipeHandler.addRecipe(
|
||||
// new AlloySmelterRecipe(dustCopper3, "dustZinc",
|
||||
// brassStack, 200, 16));
|
||||
// }
|
||||
|
||||
|
@ -164,7 +169,7 @@ public class AlloySmelterRecipes extends RecipeMethods {
|
|||
if (OreUtil.doesOreExistAndValid("ingotConductiveIron")) {
|
||||
ItemStack conductiveIronStack = getOre("ingotConductiveIron");
|
||||
conductiveIronStack.setCount(1);
|
||||
RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
RecipeHandler.addRecipe(Reference.ALLOY_SMELTER_RECIPE,
|
||||
new AlloySmelterRecipe(new ItemStack(Items.REDSTONE, 1), new ItemStack(Items.IRON_INGOT, 1),
|
||||
conductiveIronStack, 200, 16));
|
||||
}
|
||||
|
|
|
@ -57,13 +57,14 @@ public class ChemicalReactorRecipes extends RecipeMethods {
|
|||
register(getMaterial("compressedair", Type.CELL), getMaterial("hydrogen", 2, Type.CELL), getMaterial("water", Type.CELL), 400);
|
||||
register(getMaterial("compressedair", 2, Type.CELL), getMaterial("nitrogen", Type.CELL), getMaterial("nitrogenDioxide", Type.CELL), 400);
|
||||
register(getMaterial("oil", Type.CELL), getMaterial("nitrogen", Type.CELL), getMaterial("nitrofuel", 2, Type.CELL), 800);
|
||||
|
||||
}
|
||||
|
||||
static void register(ItemStack in1, ItemStack in2, ItemStack out, int tickTime, int euPerTick){
|
||||
public static void register(ItemStack in1, ItemStack in2, ItemStack out, int tickTime, int euPerTick){
|
||||
RecipeHandler.addRecipe(Reference.CHEMICAL_REACTOR_RECIPE, new ChemicalReactorRecipe(in1, in2, out, tickTime, euPerTick));
|
||||
}
|
||||
|
||||
static void register (ItemStack in1, ItemStack in2, ItemStack out, int tickTime){
|
||||
|
||||
public static void register (ItemStack in1, ItemStack in2, ItemStack out, int tickTime){
|
||||
register(in1, in2, out, tickTime, 30);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public class IndustrialCentrifugeRecipes extends RecipeMethods {
|
|||
register(getStack(Blocks.MYCELIUM, 8), 1640, getStack(Blocks.SAND, 4), getStack(Items.CLAY_BALL), getStack(Blocks.BROWN_MUSHROOM, 2), getStack(Blocks.RED_MUSHROOM, 2));
|
||||
register(getStack(Items.GOLDEN_APPLE), 5000, getStack(Items.GOLD_INGOT, 6), getMaterial("methane", Type.CELL));
|
||||
register(getStack(Items.GOLDEN_APPLE, 1, 1), 5000, getStack(Items.GOLD_INGOT, 64), getMaterial("methane", Type.CELL));
|
||||
// TODO: Fix recipe
|
||||
// TODO: Fix recipe
|
||||
// register(getStack(Items.GOLDEN_CARROT), 5000, getStack(Items.GOLD_NUGGET, 6), getMaterial("methane", Type.CELL));
|
||||
// register(getStack(Items.SPECKLED_MELON, 8), 5000, getStack(Items.GOLD_NUGGET, 6), getMaterial("methane", Type.CELL));
|
||||
register(getStack(Items.APPLE, 32), 5000, getMaterial("methane", Type.CELL));
|
||||
|
@ -79,7 +79,7 @@ public class IndustrialCentrifugeRecipes extends RecipeMethods {
|
|||
register(getStack(Blocks.RED_MUSHROOM, 32), 5000, getMaterial("methane", Type.CELL));
|
||||
register(getStack(Items.NETHER_WART, 32), 5000, getMaterial("methane", Type.CELL));
|
||||
// register(getMaterial("sap", 4, Type.PART), 1300, getMaterial("rubber", 14, Type.PART));
|
||||
// register(getStack(ModBlocks.RUBBER_LOG, 16), 5000, false, getMaterial("sap", 8, Type.PART), getMaterial("methane", Type.CELL), getMaterial("carbon", 4, Type.CELL));
|
||||
// register(getStack(ModBlocks.RUBBER_LOG, 16), 5000, false, getMaterial("sap", 8, Type.PART), getMaterial("methane", Type.CELL), getMaterial("carbon", 4, Type.CELL));
|
||||
// register(getStack(Blocks.SOUL_SAND, 16), 2500, getStack(Blocks.SAND, 10), getMaterial("saltpeter", 4, Type.DUST), getMaterial("coal", Type.DUST), getMaterial("oil", Type.CELL));
|
||||
// register(getOre("dustBronze"), 1500, getMaterial("copper", 6, Type.SMALL_DUST), getMaterial("tin", 2, Type.SMALL_DUST));
|
||||
// register(getOre("dustIron", 2), 1500, getMaterial("tin", Type.SMALL_DUST), getMaterial("nickel", Type.SMALL_DUST));
|
||||
|
|
|
@ -1,134 +1,134 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.init.recipes;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import reborncore.api.recipe.RecipeHandler;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.machines.IndustrialSawmillRecipe;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RebornRegister(modID = TechReborn.MOD_ID)
|
||||
public class IndustrialSawmillRecipes extends RecipeMethods {
|
||||
static FluidStack WATER = new FluidStack(FluidRegistry.WATER, 1000);
|
||||
|
||||
@ConfigRegistry(config = "recipes", category = "sawmill", key = "plankCount", comment = "Number of planks the saw mill will ouput")
|
||||
public static int plankCount = 4;
|
||||
|
||||
@ConfigRegistry(config = "recipes", category = "sawmill", key = "disableRecipes", comment = "Set to true to disable sawmill recipes from loading.")
|
||||
public static boolean disableRecipes = false;
|
||||
|
||||
public static void init() {
|
||||
if(disableRecipes){
|
||||
return;
|
||||
}
|
||||
InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() {
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer playerIn) {
|
||||
return false;
|
||||
}
|
||||
}, 1, 1);
|
||||
inventoryCrafting.setInventorySlotContents(0, ItemStack.EMPTY);
|
||||
|
||||
List<ItemStack> logs = OreDictionary.getOres("logWood").stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(ItemStack::copy)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (ItemStack logStack : logs) {
|
||||
if (logStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && logStack.getHasSubtypes()) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
ItemStack newStack = logStack.copy();
|
||||
newStack.setItemDamage(i);
|
||||
inventoryCrafting.setInventorySlotContents(0, newStack);
|
||||
ItemStack output = findMatchingRecipe(inventoryCrafting);
|
||||
if (!output.isEmpty()) {
|
||||
if (ItemUtils.isInputEqual("plankWood", output, false, false, false)) {
|
||||
addRecipe(newStack.copy(), output.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logStack.setItemDamage(0); //Done to remove the wildcard value if the item doesnt have subtypes
|
||||
inventoryCrafting.setInventorySlotContents(0, logStack.copy());
|
||||
ItemStack output = findMatchingRecipe(inventoryCrafting);
|
||||
if (!output.isEmpty()) {
|
||||
if (ItemUtils.isInputEqual("plankWood", output, false, false, false)) {
|
||||
addRecipe(logStack.copy(), output.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static ItemStack findMatchingRecipe(InventoryCrafting inv) {
|
||||
for (IRecipe recipe : CraftingManager.REGISTRY) {
|
||||
if (recipe.canFit(1, 1) && recipe.matches(inv, null)) {
|
||||
return recipe.getCraftingResult(inv);
|
||||
}
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
|
||||
}
|
||||
|
||||
public static void addRecipe(ItemStack log, ItemStack plank) {
|
||||
plank.setCount(plankCount);
|
||||
register(log, WATER, 100, 128, plank, TRContent.Dusts.SAW.getStack(3), getStack(Items.PAPER, 1));
|
||||
}
|
||||
|
||||
static void register(ItemStack input1, FluidStack fluid, int ticks, int euPerTick, ItemStack... outputs) {
|
||||
if (outputs.length == 3) {
|
||||
RecipeHandler.addRecipe(Reference.INDUSTRIAL_SAWMILL_RECIPE, new IndustrialSawmillRecipe(input1, fluid, outputs[0], outputs[1], outputs[2], ticks, euPerTick, false));
|
||||
} else if (outputs.length == 2) {
|
||||
RecipeHandler.addRecipe(Reference.INDUSTRIAL_SAWMILL_RECIPE, new IndustrialSawmillRecipe(input1, fluid, outputs[0], outputs[1], null, ticks, euPerTick, false));
|
||||
} else if (outputs.length == 1) {
|
||||
RecipeHandler.addRecipe(Reference.INDUSTRIAL_SAWMILL_RECIPE, new IndustrialSawmillRecipe(input1, fluid, outputs[0], null, null, ticks, euPerTick, false));
|
||||
} else {
|
||||
throw new InvalidParameterException("Invalid industrial sawmill outputs: " + outputs);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.init.recipes;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import reborncore.api.recipe.RecipeHandler;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.machines.IndustrialSawmillRecipe;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RebornRegister(modID = TechReborn.MOD_ID)
|
||||
public class IndustrialSawmillRecipes extends RecipeMethods {
|
||||
static FluidStack WATER = new FluidStack(FluidRegistry.WATER, 1000);
|
||||
|
||||
@ConfigRegistry(config = "recipes", category = "sawmill", key = "plankCount", comment = "Number of planks the saw mill will ouput")
|
||||
public static int plankCount = 4;
|
||||
|
||||
@ConfigRegistry(config = "recipes", category = "sawmill", key = "disableRecipes", comment = "Set to true to disable sawmill recipes from loading.")
|
||||
public static boolean disableRecipes = false;
|
||||
|
||||
public static void init() {
|
||||
if(disableRecipes){
|
||||
return;
|
||||
}
|
||||
InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() {
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer playerIn) {
|
||||
return false;
|
||||
}
|
||||
}, 1, 1);
|
||||
inventoryCrafting.setInventorySlotContents(0, ItemStack.EMPTY);
|
||||
|
||||
List<ItemStack> logs = OreDictionary.getOres("logWood").stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(ItemStack::copy)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (ItemStack logStack : logs) {
|
||||
if (logStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && logStack.getHasSubtypes()) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
ItemStack newStack = logStack.copy();
|
||||
newStack.setItemDamage(i);
|
||||
inventoryCrafting.setInventorySlotContents(0, newStack);
|
||||
ItemStack output = findMatchingRecipe(inventoryCrafting);
|
||||
if (!output.isEmpty()) {
|
||||
if (ItemUtils.isInputEqual("plankWood", output, false, false, false)) {
|
||||
addRecipe(newStack.copy(), output.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logStack.setItemDamage(0); //Done to remove the wildcard value if the item doesnt have subtypes
|
||||
inventoryCrafting.setInventorySlotContents(0, logStack.copy());
|
||||
ItemStack output = findMatchingRecipe(inventoryCrafting);
|
||||
if (!output.isEmpty()) {
|
||||
if (ItemUtils.isInputEqual("plankWood", output, false, false, false)) {
|
||||
addRecipe(logStack.copy(), output.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static ItemStack findMatchingRecipe(InventoryCrafting inv) {
|
||||
for (IRecipe recipe : CraftingManager.REGISTRY) {
|
||||
if (recipe.canFit(1, 1) && recipe.matches(inv, null)) {
|
||||
return recipe.getCraftingResult(inv);
|
||||
}
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
|
||||
}
|
||||
|
||||
public static void addRecipe(ItemStack log, ItemStack plank) {
|
||||
plank.setCount(plankCount);
|
||||
register(log, WATER, 100, 128, plank, TRContent.Dusts.SAW.getStack(3), getStack(Items.PAPER, 1));
|
||||
}
|
||||
|
||||
static void register(ItemStack input1, FluidStack fluid, int ticks, int euPerTick, ItemStack... outputs) {
|
||||
if (outputs.length == 3) {
|
||||
RecipeHandler.addRecipe(Reference.INDUSTRIAL_SAWMILL_RECIPE, new IndustrialSawmillRecipe(input1, fluid, outputs[0], outputs[1], outputs[2], ticks, euPerTick, false));
|
||||
} else if (outputs.length == 2) {
|
||||
RecipeHandler.addRecipe(Reference.INDUSTRIAL_SAWMILL_RECIPE, new IndustrialSawmillRecipe(input1, fluid, outputs[0], outputs[1], null, ticks, euPerTick, false));
|
||||
} else if (outputs.length == 1) {
|
||||
RecipeHandler.addRecipe(Reference.INDUSTRIAL_SAWMILL_RECIPE, new IndustrialSawmillRecipe(input1, fluid, outputs[0], null, null, ticks, euPerTick, false));
|
||||
} else {
|
||||
throw new InvalidParameterException("Invalid industrial sawmill outputs: " + outputs);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,6 +32,13 @@ import net.minecraftforge.oredict.OreDictionary;
|
|||
import reborncore.common.util.OreUtil;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import techreborn.items.*;
|
||||
import techreborn.items.ingredients.ItemDusts;
|
||||
import techreborn.items.ingredients.ItemDustsSmall;
|
||||
import techreborn.items.ingredients.ItemGems;
|
||||
import techreborn.items.ingredients.ItemIngots;
|
||||
import techreborn.items.ingredients.ItemNuggets;
|
||||
import techreborn.items.ingredients.ItemParts;
|
||||
import techreborn.items.ingredients.ItemPlates;
|
||||
|
||||
/**
|
||||
* Created by Prospector
|
||||
|
|
|
@ -57,7 +57,7 @@ public class ItemDebugTool extends Item {
|
|||
} else {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile != null) {
|
||||
sendMessage(playerIn, worldIn, new TextComponentString(
|
||||
|
|
|
@ -24,18 +24,29 @@
|
|||
|
||||
package techreborn.items.tool.basic;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PoweredItemCapabilityProvider;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.api.TechRebornAPI;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
|
@ -50,6 +61,20 @@ public class ItemElectricTreetap extends Item implements IEnergyItemInfo {
|
|||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
// Item
|
||||
@Override
|
||||
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
IBlockState state = worldIn.getBlockState(pos);
|
||||
IEnergyStorage capEnergy = playerIn.getHeldItem(hand).getCapability(CapabilityEnergy.ENERGY, null);
|
||||
if(TechRebornAPI.ic2Helper != null && capEnergy.getEnergyStored() >= cost){
|
||||
if(TechRebornAPI.ic2Helper.extractSap(playerIn, worldIn, pos, side, state, null) && !worldIn.isRemote){
|
||||
capEnergy.extractEnergy(cost, false);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.client.renderer.block.statemap.StateMap;
|
|||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.util.RecipeBookClient;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
@ -38,31 +39,33 @@ import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
|||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import reborncore.api.tile.IUpgradeable;
|
||||
import reborncore.client.IconSupplier;
|
||||
import reborncore.client.hud.StackInfoHUD;
|
||||
import reborncore.client.multiblock.MultiblockRenderEvent;
|
||||
import techreborn.blocks.BlockRubberLeaves;
|
||||
import techreborn.client.ClientEventHandler;
|
||||
import techreborn.client.IconSupplier;
|
||||
import techreborn.client.gui.GuiBase;
|
||||
import techreborn.client.gui.slot.GuiFluidConfiguration;
|
||||
import techreborn.client.gui.slot.GuiSlotConfiguration;
|
||||
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.builder.slot.GuiFluidConfiguration;
|
||||
import reborncore.client.gui.builder.slot.GuiSlotConfiguration;
|
||||
import techreborn.client.keybindings.KeyBindings;
|
||||
import techreborn.client.render.ModelDynamicCell;
|
||||
import techreborn.client.render.entitys.RenderNukePrimed;
|
||||
import techreborn.entities.EntityNukePrimed;
|
||||
import techreborn.events.StackToolTipEvent;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.DynamicCell;
|
||||
import techreborn.items.ItemFrequencyTransmitter;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
public static MultiblockRenderEvent multiblockRenderEvent;
|
||||
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
super.preInit(event);
|
||||
StackInfoHUD.registerElement(new ItemFrequencyTransmitter.StackInfoFreqTransmitter());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNukePrimed.class, new RenderManagerNuke());
|
||||
MinecraftForge.EVENT_BUS.register(new IconSupplier());
|
||||
ModelDynamicCell.init();
|
||||
MinecraftForge.EVENT_BUS.register(new FluidBlockModelHandler());
|
||||
MinecraftForge.EVENT_BUS.register(ClientEventHandler.class);
|
||||
}
|
||||
|
||||
|
@ -70,14 +73,14 @@ public class ClientProxy extends CommonProxy {
|
|||
public void init(FMLInitializationEvent event) {
|
||||
super.init(event);
|
||||
MinecraftForge.EVENT_BUS.register(new StackToolTipEvent());
|
||||
multiblockRenderEvent = new MultiblockRenderEvent();
|
||||
MinecraftForge.EVENT_BUS.register(GuiSlotConfiguration.class);
|
||||
MinecraftForge.EVENT_BUS.register(GuiFluidConfiguration.class);
|
||||
MinecraftForge.EVENT_BUS.register(multiblockRenderEvent);
|
||||
// TODO FIX ME
|
||||
ClientRegistry.registerKeyBinding(KeyBindings.config);
|
||||
StateMap rubberLeavesStateMap = new StateMap.Builder().ignore(BlockRubberLeaves.CHECK_DECAY, BlockRubberLeaves.DECAYABLE).build();
|
||||
ModelLoader.setCustomStateMapper(TRContent.RUBBER_LEAVES, rubberLeavesStateMap);
|
||||
GuiBase.wrenchStack = new ItemStack(ModItems.WRENCH);
|
||||
GuiBase.fluidCellProvider = DynamicCell::getCellWithFluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,15 +32,17 @@ import net.minecraftforge.energy.IEnergyStorage;
|
|||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.TRContent;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
@RebornRegister(modID = TechReborn.MOD_ID)
|
||||
public class TileChargeOMat extends TilePowerAcceptor
|
||||
|
@ -75,6 +77,8 @@ public class TileChargeOMat extends TilePowerAcceptor
|
|||
if (getEnergy() >= 0.0 && maxReceive > 0) {
|
||||
powerItem.receiveEnergy((int) useEnergy(maxUse) * RebornCoreConfig.euPerFU, false);
|
||||
}
|
||||
} else if (ExternalPowerSystems.isPoweredItem(stack)) {
|
||||
ExternalPowerSystems.chargeItem(this, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,9 +34,9 @@ import reborncore.common.registration.RebornRegister;
|
|||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
@RebornRegister(modID = TechReborn.MOD_ID)
|
||||
|
|
|
@ -28,9 +28,9 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import reborncore.common.registration.RebornRegister;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
|
||||
@RebornRegister(modID = TechReborn.MOD_ID)
|
||||
public class TileDigitalChest extends TileTechStorageBase implements IContainerProvider {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue