From 1b820de08a05070909a267e17f033fcf58ac8710 Mon Sep 17 00:00:00 2001 From: NotAPenguin Date: Mon, 2 Sep 2024 23:17:17 +0200 Subject: The Great Renaming (#3014) * move kekztech to a single root dir * move detrav to a single root dir * move gtnh-lanthanides to a single root dir * move tectech and delete some gross reflection in gt++ * remove more reflection inside gt5u * delete more reflection in gt++ * fix imports * move bartworks and bwcrossmod * fix proxies * move galactigreg and ggfab * move gtneioreplugin * try to fix gt++ bee loader * apply the rename rules to BW * apply rename rules to bwcrossmod * apply rename rules to detrav scanner mod * apply rename rules to galacticgreg * apply rename rules to ggfab * apply rename rules to goodgenerator * apply rename rules to gtnh-lanthanides * apply rename rules to gt++ * apply rename rules to kekztech * apply rename rules to kubatech * apply rename rules to tectech * apply rename rules to gt apply the rename rules to gt * fix tt import * fix mui hopefully * fix coremod except intergalactic * rename assline recipe class * fix a class name i stumbled on * rename StructureUtility to GTStructureUtility to prevent conflict with structurelib * temporary rename of GTTooltipDataCache to old name * fix gt client/server proxy names --- .../api/interfaces/ICleanroomReceiver.java | 4 +- .../interfaces/IConfigurationCircuitSupport.java | 4 +- .../java/gregtech/api/interfaces/IFoodStat.java | 14 +- .../interfaces/IGT_ItemWithMaterialRenderer.java | 10 +- .../gregtech/api/interfaces/IHatchElement.java | 29 +- .../gregtech/api/interfaces/IIconContainer.java | 2 +- .../gregtech/api/interfaces/IItemBehaviour.java | 4 +- .../api/interfaces/INetworkUpdatableItem.java | 4 +- .../java/gregtech/api/interfaces/IRecipeMap.java | 18 +- .../api/interfaces/IRedstoneCircuitBlock.java | 4 +- .../java/gregtech/api/interfaces/IToolStats.java | 4 +- .../gregtech/api/interfaces/fluid/IGTFluid.java | 14 + .../api/interfaces/fluid/IGTFluidBuilder.java | 96 +++++ .../api/interfaces/fluid/IGTRegisteredFluid.java | 60 ++++ .../gregtech/api/interfaces/fluid/IGT_Fluid.java | 14 - .../api/interfaces/fluid/IGT_FluidBuilder.java | 96 ----- .../api/interfaces/fluid/IGT_RegisteredFluid.java | 60 ---- .../api/interfaces/internal/IGTCraftingRecipe.java | 8 + .../gregtech/api/interfaces/internal/IGTMod.java | 50 +++ .../api/interfaces/internal/IGTRecipeAdder.java | 8 + .../interfaces/internal/IGT_CraftingRecipe.java | 8 - .../gregtech/api/interfaces/internal/IGT_Mod.java | 50 --- .../api/interfaces/internal/IGT_RecipeAdder.java | 8 - .../api/interfaces/internal/IThaumcraftCompat.java | 8 +- .../interfaces/metatileentity/IMetaTileEntity.java | 8 +- .../modularui/ControllerWithOptionalFeatures.java | 393 --------------------- .../modularui/IControllerWithOptionalFeatures.java | 393 +++++++++++++++++++++ .../api/interfaces/modularui/IGetTitleColor.java | 4 +- .../interfaces/tileentity/IColoredTileEntity.java | 5 +- .../api/interfaces/tileentity/ICoverable.java | 8 +- .../interfaces/tileentity/IEnergyConnected.java | 14 +- .../interfaces/tileentity/IGregTechTileEntity.java | 4 +- 32 files changed, 705 insertions(+), 701 deletions(-) create mode 100644 src/main/java/gregtech/api/interfaces/fluid/IGTFluid.java create mode 100644 src/main/java/gregtech/api/interfaces/fluid/IGTFluidBuilder.java create mode 100644 src/main/java/gregtech/api/interfaces/fluid/IGTRegisteredFluid.java delete mode 100644 src/main/java/gregtech/api/interfaces/fluid/IGT_Fluid.java delete mode 100644 src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java delete mode 100644 src/main/java/gregtech/api/interfaces/fluid/IGT_RegisteredFluid.java create mode 100644 src/main/java/gregtech/api/interfaces/internal/IGTCraftingRecipe.java create mode 100644 src/main/java/gregtech/api/interfaces/internal/IGTMod.java create mode 100644 src/main/java/gregtech/api/interfaces/internal/IGTRecipeAdder.java delete mode 100644 src/main/java/gregtech/api/interfaces/internal/IGT_CraftingRecipe.java delete mode 100644 src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java delete mode 100644 src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java delete mode 100644 src/main/java/gregtech/api/interfaces/modularui/ControllerWithOptionalFeatures.java create mode 100644 src/main/java/gregtech/api/interfaces/modularui/IControllerWithOptionalFeatures.java (limited to 'src/main/java/gregtech/api/interfaces') diff --git a/src/main/java/gregtech/api/interfaces/ICleanroomReceiver.java b/src/main/java/gregtech/api/interfaces/ICleanroomReceiver.java index b0d42f9aec..b26c7035c7 100644 --- a/src/main/java/gregtech/api/interfaces/ICleanroomReceiver.java +++ b/src/main/java/gregtech/api/interfaces/ICleanroomReceiver.java @@ -4,9 +4,11 @@ import javax.annotation.Nullable; import net.minecraft.tileentity.TileEntity; +import gregtech.common.Pollution; + /** * Implement this interface for TileEntities that can have association to cleanroom. - * Calling {@link gregtech.common.GT_Pollution#addPollution(TileEntity, int)} from this machine + * Calling {@link Pollution#addPollution(TileEntity, int)} from this machine * will pollute associated cleanroom. */ public interface ICleanroomReceiver { diff --git a/src/main/java/gregtech/api/interfaces/IConfigurationCircuitSupport.java b/src/main/java/gregtech/api/interfaces/IConfigurationCircuitSupport.java index 8dde8163c8..5f225b0b4f 100644 --- a/src/main/java/gregtech/api/interfaces/IConfigurationCircuitSupport.java +++ b/src/main/java/gregtech/api/interfaces/IConfigurationCircuitSupport.java @@ -4,7 +4,7 @@ import java.util.List; import net.minecraft.item.ItemStack; -import gregtech.api.GregTech_API; +import gregtech.api.GregTechAPI; /** * Implement this interface if your tileentity (or metatileentity) supports configuration circuits to resolve recipe @@ -24,7 +24,7 @@ public interface IConfigurationCircuitSupport { * This list is unmodifiable. Its elements are not supposed to be modified in any way! */ default List getConfigurationCircuits() { - return GregTech_API.getConfigurationCircuitList(100); + return GregTechAPI.getConfigurationCircuitList(100); } /** diff --git a/src/main/java/gregtech/api/interfaces/IFoodStat.java b/src/main/java/gregtech/api/interfaces/IFoodStat.java index c768c5ca1c..4b1bd121e9 100644 --- a/src/main/java/gregtech/api/interfaces/IFoodStat.java +++ b/src/main/java/gregtech/api/interfaces/IFoodStat.java @@ -4,34 +4,34 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; -import gregtech.api.items.GT_MetaBase_Item; +import gregtech.api.items.MetaBaseItem; public interface IFoodStat { /** * Warning the "aPlayer" Parameter may be null! */ - int getFoodLevel(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); + int getFoodLevel(MetaBaseItem aItem, ItemStack aStack, EntityPlayer aPlayer); /** * Warning the "aPlayer" Parameter may be null! */ - float getSaturation(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); + float getSaturation(MetaBaseItem aItem, ItemStack aStack, EntityPlayer aPlayer); /** * Warning the "aPlayer" Parameter may be null! */ - boolean alwaysEdible(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); + boolean alwaysEdible(MetaBaseItem aItem, ItemStack aStack, EntityPlayer aPlayer); /** * Warning the "aPlayer" Parameter may be null! */ - boolean isRotten(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); + boolean isRotten(MetaBaseItem aItem, ItemStack aStack, EntityPlayer aPlayer); /** * Warning the "aPlayer" Parameter may be null! */ - EnumAction getFoodAction(GT_MetaBase_Item aItem, ItemStack aStack); + EnumAction getFoodAction(MetaBaseItem aItem, ItemStack aStack); - void onEaten(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); + void onEaten(MetaBaseItem aItem, ItemStack aStack, EntityPlayer aPlayer); } diff --git a/src/main/java/gregtech/api/interfaces/IGT_ItemWithMaterialRenderer.java b/src/main/java/gregtech/api/interfaces/IGT_ItemWithMaterialRenderer.java index 4bf0311544..1dc460f3de 100644 --- a/src/main/java/gregtech/api/interfaces/IGT_ItemWithMaterialRenderer.java +++ b/src/main/java/gregtech/api/interfaces/IGT_ItemWithMaterialRenderer.java @@ -6,22 +6,24 @@ import net.minecraft.util.IIcon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import gregtech.common.render.items.GT_GeneratedMaterial_Renderer; +import gregtech.common.render.items.GeneratedItemRenderer; +import gregtech.common.render.items.GeneratedMaterialRenderer; +import gregtech.common.render.items.MetaGeneratedItemRenderer; public interface IGT_ItemWithMaterialRenderer { /** - * @return If allow using {@link gregtech.common.render.items.GT_MetaGenerated_Item_Renderer} to render item + * @return If allow using {@link MetaGeneratedItemRenderer} to render item */ boolean shouldUseCustomRenderer(int aMetaData); /** * @return Custom renderer of the Material with offset < 32000 */ - GT_GeneratedMaterial_Renderer getMaterialRenderer(int aMetaData); + GeneratedMaterialRenderer getMaterialRenderer(int aMetaData); /** - * If this returns false, renderer falls back to {@link gregtech.common.render.items.GT_GeneratedItem_Renderer} + * If this returns false, renderer falls back to {@link GeneratedItemRenderer} */ boolean allowMaterialRenderer(int aMetaData); diff --git a/src/main/java/gregtech/api/interfaces/IHatchElement.java b/src/main/java/gregtech/api/interfaces/IHatchElement.java index 482b7899ab..9618c1ee1b 100644 --- a/src/main/java/gregtech/api/interfaces/IHatchElement.java +++ b/src/main/java/gregtech/api/interfaces/IHatchElement.java @@ -11,18 +11,17 @@ import net.minecraftforge.common.util.ForgeDirection; import com.google.common.collect.ImmutableList; import com.gtnewhorizon.structurelib.structure.IStructureElement; -import com.gtnewhorizon.structurelib.structure.StructureUtility; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_StructureUtility; -import gregtech.api.util.IGT_HatchAdder; +import gregtech.api.util.GTStructureUtility; +import gregtech.api.util.IGTHatchAdder; public interface IHatchElement { List> mteClasses(); - IGT_HatchAdder adder(); + IGTHatchAdder adder(); String name(); @@ -44,7 +43,7 @@ public interface IHatchElement { return new HatchElement<>(aClasses, null, null, null, this); } - default IHatchElement withAdder(IGT_HatchAdder aAdder) { + default IHatchElement withAdder(IGTHatchAdder aAdder) { if (aAdder == null) throw new IllegalArgumentException(); return new HatchElement<>(null, aAdder, null, null, this); } @@ -61,7 +60,7 @@ public interface IHatchElement { default IStructureElement newAny(int aCasingIndex, int aDot) { if (aCasingIndex < 0 || aDot < 0) throw new IllegalArgumentException(); - return GT_StructureUtility.buildHatchAdder() + return GTStructureUtility.buildHatchAdder() .anyOf(this) .casingIndex(aCasingIndex) .dot(aDot) @@ -73,17 +72,17 @@ public interface IHatchElement { default IStructureElement newAnyOrCasing(int aCasingIndex, int aDot, Block casingBlock, int casingMeta) { if (aCasingIndex < 0 || aDot < 0) throw new IllegalArgumentException(); - return GT_StructureUtility.buildHatchAdder() + return GTStructureUtility.buildHatchAdder() .anyOf(this) .casingIndex(aCasingIndex) .dot(aDot) .continueIfSuccess() - .buildAndChain(StructureUtility.ofBlock(casingBlock, casingMeta)); + .buildAndChain(com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock(casingBlock, casingMeta)); } default IStructureElement newAny(int aCasingIndex, int aDot, ForgeDirection... allowedFacings) { if (aCasingIndex < 0 || aDot < 0) throw new IllegalArgumentException(); - return GT_StructureUtility.buildHatchAdder() + return GTStructureUtility.buildHatchAdder() .anyOf(this) .casingIndex(aCasingIndex) .dot(aDot) @@ -96,7 +95,7 @@ public interface IHatchElement { default IStructureElement newAny(int aCasingIndex, int aDot, BiPredicate aShouldSkip) { if (aCasingIndex < 0 || aDot < 0 || aShouldSkip == null) throw new IllegalArgumentException(); - return GT_StructureUtility.buildHatchAdder() + return GTStructureUtility.buildHatchAdder() .anyOf(this) .casingIndex(aCasingIndex) .dot(aDot) @@ -131,7 +130,7 @@ class HatchElementEither implements IHatchElement { } @Override - public IGT_HatchAdder adder() { + public IGTHatchAdder adder() { return ((t, te, i) -> first.adder() .apply(t, te, i) || second.adder() @@ -153,12 +152,12 @@ class HatchElementEither implements IHatchElement { class HatchElement implements IHatchElement { private final List> mClasses; - private final IGT_HatchAdder mAdder; + private final IGTHatchAdder mAdder; private final String mName; private final IHatchElement mBacking; private final ToLongFunction mCount; - public HatchElement(List> aMteClasses, IGT_HatchAdder aAdder, + public HatchElement(List> aMteClasses, IGTHatchAdder aAdder, String aName, ToLongFunction aCount, IHatchElement aBacking) { this.mClasses = aMteClasses; this.mAdder = aAdder; @@ -173,7 +172,7 @@ class HatchElement implements IHatchElement { } @Override - public IGT_HatchAdder adder() { + public IGTHatchAdder adder() { return mAdder == null ? mBacking.adder() : mAdder; } @@ -194,7 +193,7 @@ class HatchElement implements IHatchElement { } @Override - public IHatchElement withAdder(IGT_HatchAdder aAdder) { + public IHatchElement withAdder(IGTHatchAdder aAdder) { if (aAdder == null) throw new IllegalArgumentException(); return new HatchElement<>(mClasses, aAdder, mName, mCount, mBacking); } diff --git a/src/main/java/gregtech/api/interfaces/IIconContainer.java b/src/main/java/gregtech/api/interfaces/IIconContainer.java index 525721bb5c..319615b58d 100644 --- a/src/main/java/gregtech/api/interfaces/IIconContainer.java +++ b/src/main/java/gregtech/api/interfaces/IIconContainer.java @@ -1,6 +1,6 @@ package gregtech.api.interfaces; -import static gregtech.api.enums.GT_Values.UNCOLORED_RGBA; +import static gregtech.api.enums.GTValues.UNCOLORED_RGBA; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/gregtech/api/interfaces/IItemBehaviour.java b/src/main/java/gregtech/api/interfaces/IItemBehaviour.java index 67bb505c6b..d9f8706824 100644 --- a/src/main/java/gregtech/api/interfaces/IItemBehaviour.java +++ b/src/main/java/gregtech/api/interfaces/IItemBehaviour.java @@ -13,7 +13,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.enums.SubTag; -import gregtech.api.items.GT_MetaBase_Item; +import gregtech.api.items.MetaBaseItem; public interface IItemBehaviour { @@ -37,7 +37,7 @@ public interface IItemBehaviour { ItemStack onDispense(E aItem, IBlockSource aSource, ItemStack aStack); - boolean hasProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack); + boolean hasProjectile(MetaBaseItem aItem, SubTag aProjectileType, ItemStack aStack); EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ); diff --git a/src/main/java/gregtech/api/interfaces/INetworkUpdatableItem.java b/src/main/java/gregtech/api/interfaces/INetworkUpdatableItem.java index 1dd36d9998..4af8ec232c 100644 --- a/src/main/java/gregtech/api/interfaces/INetworkUpdatableItem.java +++ b/src/main/java/gregtech/api/interfaces/INetworkUpdatableItem.java @@ -4,8 +4,10 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import gregtech.api.net.GTPacketUpdateItem; + /** - * Together with {@link gregtech.api.net.GT_Packet_UpdateItem} you can request server side to update item in hand with a + * Together with {@link GTPacketUpdateItem} you can request server side to update item in hand with a * NBT tag. *

* Usual NBT tag size limit applies. diff --git a/src/main/java/gregtech/api/interfaces/IRecipeMap.java b/src/main/java/gregtech/api/interfaces/IRecipeMap.java index ce48b29927..c6184bee34 100644 --- a/src/main/java/gregtech/api/interfaces/IRecipeMap.java +++ b/src/main/java/gregtech/api/interfaces/IRecipeMap.java @@ -7,9 +7,9 @@ import java.util.function.Function; import javax.annotation.Nonnull; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_RecipeBuilder; -import gregtech.api.util.GT_Utility; +import gregtech.api.util.GTRecipe; +import gregtech.api.util.GTRecipeBuilder; +import gregtech.api.util.GTUtility; /** * Represents the target of a recipe adding action, usually, but not necessarily, is a recipe map itself. @@ -33,7 +33,7 @@ public interface IRecipeMap { * Actually add the recipe represented by the builder. CAN modify the builder's internal states!!! */ @Nonnull - Collection doAdd(GT_RecipeBuilder builder); + Collection doAdd(GTRecipeBuilder builder); /** * Return a variant of this recipe map that will perform a deep copy on input recipe builder before doing anything @@ -45,7 +45,7 @@ public interface IRecipeMap { return newRecipeMap(b -> doAdd(b.copy())); } - static IRecipeMap newRecipeMap(Function> func) { + static IRecipeMap newRecipeMap(Function> func) { return new IRecipeMap() { private final Collection downstreams = new ArrayList<>(); @@ -57,9 +57,9 @@ public interface IRecipeMap { @Nonnull @Override - public Collection doAdd(GT_RecipeBuilder builder) { - List> ret = new ArrayList<>(); - Collection out = func.apply(builder); + public Collection doAdd(GTRecipeBuilder builder) { + List> ret = new ArrayList<>(); + Collection out = func.apply(builder); ret.add(out); builder.clearInvalid(); if (!out.isEmpty()) { @@ -67,7 +67,7 @@ public interface IRecipeMap { ret.add(downstream.doAdd(builder)); } } - return GT_Utility.concat(ret); + return GTUtility.concat(ret); } }; } diff --git a/src/main/java/gregtech/api/interfaces/IRedstoneCircuitBlock.java b/src/main/java/gregtech/api/interfaces/IRedstoneCircuitBlock.java index 0eea6ca3a4..a0a362c4e5 100644 --- a/src/main/java/gregtech/api/interfaces/IRedstoneCircuitBlock.java +++ b/src/main/java/gregtech/api/interfaces/IRedstoneCircuitBlock.java @@ -5,7 +5,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.util.GT_CoverBehavior; +import gregtech.api.util.CoverBehavior; /** * Implemented by the MetaTileEntity of the Redstone Circuit Block @@ -36,7 +36,7 @@ public interface IRedstoneCircuitBlock { /** * If this Side is Covered up and therefor not doing any Redstone */ - GT_CoverBehavior getCover(ForgeDirection side); + CoverBehavior getCover(ForgeDirection side); int getCoverID(ForgeDirection side); diff --git a/src/main/java/gregtech/api/interfaces/IToolStats.java b/src/main/java/gregtech/api/interfaces/IToolStats.java index 9d8da63b6c..6f506a6ee1 100644 --- a/src/main/java/gregtech/api/interfaces/IToolStats.java +++ b/src/main/java/gregtech/api/interfaces/IToolStats.java @@ -16,7 +16,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.event.world.BlockEvent; -import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.api.items.MetaGeneratedTool; /** * The Stats for GT Tools. Not including any Material Modifiers. @@ -33,7 +33,7 @@ public interface IToolStats { /** * Called when this gets added to a Tool Item */ - void onStatsAddedToTool(GT_MetaGenerated_Tool aItem, int aID); + void onStatsAddedToTool(MetaGeneratedTool aItem, int aID); /** * @implNote if you are only modifying drops, override diff --git a/src/main/java/gregtech/api/interfaces/fluid/IGTFluid.java b/src/main/java/gregtech/api/interfaces/fluid/IGTFluid.java new file mode 100644 index 0000000000..b3765d37db --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/fluid/IGTFluid.java @@ -0,0 +1,14 @@ +package gregtech.api.interfaces.fluid; + +import net.minecraftforge.fluids.FluidRegistry; + +@SuppressWarnings("unused") // API might legitimately expose unused methods within this local project's scope +public interface IGTFluid { + + /** + * Adds this {@link IGTFluid} to the {@link FluidRegistry} and internally-implemented registrations + * + * @return {@link IGTRegisteredFluid} The GregTech registered fluid + */ + IGTRegisteredFluid addFluid(); +} diff --git a/src/main/java/gregtech/api/interfaces/fluid/IGTFluidBuilder.java b/src/main/java/gregtech/api/interfaces/fluid/IGTFluidBuilder.java new file mode 100644 index 0000000000..2902824873 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/fluid/IGTFluidBuilder.java @@ -0,0 +1,96 @@ +package gregtech.api.interfaces.fluid; + +import javax.annotation.Nonnull; + +import net.minecraft.block.Block; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; + +import gregtech.api.enums.FluidState; + +@SuppressWarnings("unused") // API might legitimately expose unused methods within this local project's scope +public interface IGTFluidBuilder { + + /** + * @param colorRGBA The {@code short[]} RGBA color of the {@link Fluid} or {@code null} for no defined RGBA color + * @return {@link IGTFluidBuilder} self for call chaining + */ + @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value + IGTFluidBuilder withColorRGBA(final short[] colorRGBA); + + /** + * @param localizedName The localized name of this {@link IGTFluidBuilder} + * @return {@link IGTFluidBuilder} self for call chaining + */ + @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value + IGTFluidBuilder withLocalizedName(final String localizedName); + + /** + * @param fluidState The {@link FluidState} of this {@link IGTFluidBuilder} + * @param temperature The Kelvin temperature of this {@link IGTFluidBuilder} + * @return {@link IGTFluidBuilder} self for call chaining + */ + @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value + IGTFluidBuilder withStateAndTemperature(final FluidState fluidState, final int temperature); + + /** + * @param stillIconResourceLocation the {@link ResourceLocation} of the still fluid icon + * @return {@link IGTFluidBuilder} self for call chaining + */ + @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value + IGTFluidBuilder withStillIconResourceLocation(final ResourceLocation stillIconResourceLocation); + + /** + * @param flowingIconResourceLocation the {@link ResourceLocation} of the flowing fluid icon + * @return {@link IGTFluidBuilder} self for call chaining + */ + @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value + IGTFluidBuilder withFlowingIconResourceLocation(final ResourceLocation flowingIconResourceLocation); + + /** + * @param textureName The name of the GregTech mod texture of this {@link IGTFluidBuilder} + * @return {@link IGTFluidBuilder} self for call chaining + */ + @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value + IGTFluidBuilder withTextureName(final String textureName); + + /** + * @param fluidBlock the {@link Block} implementation of the {@link IGTFluid} + * @return {@link IGTFluidBuilder} self for call chaining + */ + @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value + IGTFluidBuilder withFluidBlock(final Block fluidBlock); + + /** + * @param fromFluid the {@link Fluid} to copy the icons from + * @return {@link IGTFluidBuilder} self for call chaining + */ + @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value + IGTFluidBuilder withIconsFrom(@Nonnull final Fluid fromFluid); + + /** + * @param stillIconResourceLocation The {@link ResourceLocation} of the still fluid texture + * @param flowingIconResourceLocation The {@link ResourceLocation} of the flowing fluid texture + * @return {@link IGTFluidBuilder} self for call chaining + */ + @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value + IGTFluidBuilder withTextures(final ResourceLocation stillIconResourceLocation, + final ResourceLocation flowingIconResourceLocation); + + /** + * Builds the {@link IGTFluid} + * + * @return the built {@link IGTFluid} + */ + IGTFluid build(); + + /** + * Builds, then adds the {@link IGTFluid} to the {@link FluidRegistry} + * + * @return the {@link IGTFluid} + * @see #build() + * @see IGTFluid#addFluid() + */ + IGTRegisteredFluid buildAndRegister(); +} diff --git a/src/main/java/gregtech/api/interfaces/fluid/IGTRegisteredFluid.java b/src/main/java/gregtech/api/interfaces/fluid/IGTRegisteredFluid.java new file mode 100644 index 0000000000..b2796ed3f7 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/fluid/IGTRegisteredFluid.java @@ -0,0 +1,60 @@ +package gregtech.api.interfaces.fluid; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; + +import gregtech.api.enums.FluidState; +import gregtech.api.enums.Materials; + +public interface IGTRegisteredFluid { + + /** + * Registers the containers in the {@link FluidContainerRegistry} for this {@link IGTRegisteredFluid} + * + * @param fullContainer The full fluid container + * @param emptyContainer The empty fluid container + * @param containerSize The size of the container + * @return The {@link IGTRegisteredFluid} for call chaining + */ + @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value + IGTRegisteredFluid registerContainers(final ItemStack fullContainer, final ItemStack emptyContainer, + final int containerSize); + + /** + * Registers the bucket-sized 1000L containers in the {@link FluidContainerRegistry} for this + * {@link IGTRegisteredFluid} + * + * @param fullContainer The full container to associate with this {@link IGTRegisteredFluid} + * @param emptyContainer The empty container associate with this {@link IGTRegisteredFluid} + * @return {@link IGTRegisteredFluid} for call chaining + */ + @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value + IGTRegisteredFluid registerBContainers(final ItemStack fullContainer, final ItemStack emptyContainer); + + /** + * Registers the potion-sized 250L containers in the {@link FluidContainerRegistry} for this + * {@link IGTRegisteredFluid} + * + * @param fullContainer The full container to associate with this {@link IGTRegisteredFluid} + * @param emptyContainer The empty container associate with this {@link IGTRegisteredFluid} + * @return {@link IGTRegisteredFluid} self for call chaining + */ + @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value + IGTRegisteredFluid registerPContainers(final ItemStack fullContainer, final ItemStack emptyContainer); + + /** + * Updates the {@link Materials}'s fluids from this {@link IGTRegisteredFluid}'s state + * + * @param material the {@link Materials} to configure based on this {@link IGTRegisteredFluid} and + * {@link FluidState} + * @return The {@link IGTRegisteredFluid} for call chaining + */ + @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value + IGTRegisteredFluid configureMaterials(final Materials material); + + /** + * @return this {@link IGTRegisteredFluid} cast to {@link Fluid} + */ + Fluid asFluid(); +} diff --git a/src/main/java/gregtech/api/interfaces/fluid/IGT_Fluid.java b/src/main/java/gregtech/api/interfaces/fluid/IGT_Fluid.java deleted file mode 100644 index 7c8b2b3f11..0000000000 --- a/src/main/java/gregtech/api/interfaces/fluid/IGT_Fluid.java +++ /dev/null @@ -1,14 +0,0 @@ -package gregtech.api.interfaces.fluid; - -import net.minecraftforge.fluids.FluidRegistry; - -@SuppressWarnings("unused") // API might legitimately expose unused methods within this local project's scope -public interface IGT_Fluid { - - /** - * Adds this {@link IGT_Fluid} to the {@link FluidRegistry} and internally-implemented registrations - * - * @return {@link IGT_RegisteredFluid} The GregTech registered fluid - */ - IGT_RegisteredFluid addFluid(); -} diff --git a/src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java b/src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java deleted file mode 100644 index f15b148fcb..0000000000 --- a/src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java +++ /dev/null @@ -1,96 +0,0 @@ -package gregtech.api.interfaces.fluid; - -import javax.annotation.Nonnull; - -import net.minecraft.block.Block; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; - -import gregtech.api.enums.FluidState; - -@SuppressWarnings("unused") // API might legitimately expose unused methods within this local project's scope -public interface IGT_FluidBuilder { - - /** - * @param colorRGBA The {@code short[]} RGBA color of the {@link Fluid} or {@code null} for no defined RGBA color - * @return {@link IGT_FluidBuilder} self for call chaining - */ - @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value - IGT_FluidBuilder withColorRGBA(final short[] colorRGBA); - - /** - * @param localizedName The localized name of this {@link IGT_FluidBuilder} - * @return {@link IGT_FluidBuilder} self for call chaining - */ - @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value - IGT_FluidBuilder withLocalizedName(final String localizedName); - - /** - * @param fluidState The {@link FluidState} of this {@link IGT_FluidBuilder} - * @param temperature The Kelvin temperature of this {@link IGT_FluidBuilder} - * @return {@link IGT_FluidBuilder} self for call chaining - */ - @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value - IGT_FluidBuilder withStateAndTemperature(final FluidState fluidState, final int temperature); - - /** - * @param stillIconResourceLocation the {@link ResourceLocation} of the still fluid icon - * @return {@link IGT_FluidBuilder} self for call chaining - */ - @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value - IGT_FluidBuilder withStillIconResourceLocation(final ResourceLocation stillIconResourceLocation); - - /** - * @param flowingIconResourceLocation the {@link ResourceLocation} of the flowing fluid icon - * @return {@link IGT_FluidBuilder} self for call chaining - */ - @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value - IGT_FluidBuilder withFlowingIconResourceLocation(final ResourceLocation flowingIconResourceLocation); - - /** - * @param textureName The name of the GregTech mod texture of this {@link IGT_FluidBuilder} - * @return {@link IGT_FluidBuilder} self for call chaining - */ - @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value - IGT_FluidBuilder withTextureName(final String textureName); - - /** - * @param fluidBlock the {@link Block} implementation of the {@link IGT_Fluid} - * @return {@link IGT_FluidBuilder} self for call chaining - */ - @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value - IGT_FluidBuilder withFluidBlock(final Block fluidBlock); - - /** - * @param fromFluid the {@link Fluid} to copy the icons from - * @return {@link IGT_FluidBuilder} self for call chaining - */ - @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value - IGT_FluidBuilder withIconsFrom(@Nonnull final Fluid fromFluid); - - /** - * @param stillIconResourceLocation The {@link ResourceLocation} of the still fluid texture - * @param flowingIconResourceLocation The {@link ResourceLocation} of the flowing fluid texture - * @return {@link IGT_FluidBuilder} self for call chaining - */ - @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value - IGT_FluidBuilder withTextures(final ResourceLocation stillIconResourceLocation, - final ResourceLocation flowingIconResourceLocation); - - /** - * Builds the {@link IGT_Fluid} - * - * @return the built {@link IGT_Fluid} - */ - IGT_Fluid build(); - - /** - * Builds, then adds the {@link IGT_Fluid} to the {@link FluidRegistry} - * - * @return the {@link IGT_Fluid} - * @see #build() - * @see IGT_Fluid#addFluid() - */ - IGT_RegisteredFluid buildAndRegister(); -} diff --git a/src/main/java/gregtech/api/interfaces/fluid/IGT_RegisteredFluid.java b/src/main/java/gregtech/api/interfaces/fluid/IGT_RegisteredFluid.java deleted file mode 100644 index 181824874c..0000000000 --- a/src/main/java/gregtech/api/interfaces/fluid/IGT_RegisteredFluid.java +++ /dev/null @@ -1,60 +0,0 @@ -package gregtech.api.interfaces.fluid; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; - -import gregtech.api.enums.FluidState; -import gregtech.api.enums.Materials; - -public interface IGT_RegisteredFluid { - - /** - * Registers the containers in the {@link FluidContainerRegistry} for this {@link IGT_RegisteredFluid} - * - * @param fullContainer The full fluid container - * @param emptyContainer The empty fluid container - * @param containerSize The size of the container - * @return The {@link IGT_RegisteredFluid} for call chaining - */ - @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value - IGT_RegisteredFluid registerContainers(final ItemStack fullContainer, final ItemStack emptyContainer, - final int containerSize); - - /** - * Registers the bucket-sized 1000L containers in the {@link FluidContainerRegistry} for this - * {@link IGT_RegisteredFluid} - * - * @param fullContainer The full container to associate with this {@link IGT_RegisteredFluid} - * @param emptyContainer The empty container associate with this {@link IGT_RegisteredFluid} - * @return {@link IGT_RegisteredFluid} for call chaining - */ - @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value - IGT_RegisteredFluid registerBContainers(final ItemStack fullContainer, final ItemStack emptyContainer); - - /** - * Registers the potion-sized 250L containers in the {@link FluidContainerRegistry} for this - * {@link IGT_RegisteredFluid} - * - * @param fullContainer The full container to associate with this {@link IGT_RegisteredFluid} - * @param emptyContainer The empty container associate with this {@link IGT_RegisteredFluid} - * @return {@link IGT_RegisteredFluid} self for call chaining - */ - @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value - IGT_RegisteredFluid registerPContainers(final ItemStack fullContainer, final ItemStack emptyContainer); - - /** - * Updates the {@link Materials}'s fluids from this {@link IGT_RegisteredFluid}'s state - * - * @param material the {@link Materials} to configure based on this {@link IGT_RegisteredFluid} and - * {@link FluidState} - * @return The {@link IGT_RegisteredFluid} for call chaining - */ - @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value - IGT_RegisteredFluid configureMaterials(final Materials material); - - /** - * @return this {@link IGT_RegisteredFluid} cast to {@link Fluid} - */ - Fluid asFluid(); -} diff --git a/src/main/java/gregtech/api/interfaces/internal/IGTCraftingRecipe.java b/src/main/java/gregtech/api/interfaces/internal/IGTCraftingRecipe.java new file mode 100644 index 0000000000..beacd71f95 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/internal/IGTCraftingRecipe.java @@ -0,0 +1,8 @@ +package gregtech.api.interfaces.internal; + +import net.minecraft.item.crafting.IRecipe; + +public interface IGTCraftingRecipe extends IRecipe { + + boolean isRemovable(); +} diff --git a/src/main/java/gregtech/api/interfaces/internal/IGTMod.java b/src/main/java/gregtech/api/interfaces/internal/IGTMod.java new file mode 100644 index 0000000000..f47a7ef645 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/internal/IGTMod.java @@ -0,0 +1,50 @@ +package gregtech.api.interfaces.internal; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * Interface used by the Mods Main Class to reference to internals. + *

+ * Don't even think about including this File in your Mod. + */ +public interface IGTMod { + + /** + * This means that Server specific Basefiles are definitely existing! Not if the World is actually server side or + * not! + */ + boolean isServerSide(); + + /** + * This means that Client specific Basefiles are definitely existing! Not if the World is actually client side or + * not! + */ + boolean isClientSide(); + + /** + * This means that Bukkit specific Basefiles are definitely existing! Not if the World is actually bukkit server or + * not! + */ + boolean isBukkitSide(); + + /** + * works only ClientSide otherwise returns null + */ + EntityPlayer getThePlayer(); + + // ---------- Internal Usage Only ---------- + + /** + * works only ClientSide otherwise returns 0 + * + * @return the Index of the added Armor + */ + int addArmor(String aArmorPrefix); + + /** + * Plays the Sonictron Sound for the ItemStack on the Client Side + */ + void doSonictronSound(ItemStack aStack, World aWorld, double aX, double aY, double aZ); +} diff --git a/src/main/java/gregtech/api/interfaces/internal/IGTRecipeAdder.java b/src/main/java/gregtech/api/interfaces/internal/IGTRecipeAdder.java new file mode 100644 index 0000000000..a4d554428e --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/internal/IGTRecipeAdder.java @@ -0,0 +1,8 @@ +package gregtech.api.interfaces.internal; + +import gregtech.api.util.GTRecipeBuilder; + +public interface IGTRecipeAdder { + + GTRecipeBuilder stdBuilder(); +} diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_CraftingRecipe.java b/src/main/java/gregtech/api/interfaces/internal/IGT_CraftingRecipe.java deleted file mode 100644 index 3f29736470..0000000000 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_CraftingRecipe.java +++ /dev/null @@ -1,8 +0,0 @@ -package gregtech.api.interfaces.internal; - -import net.minecraft.item.crafting.IRecipe; - -public interface IGT_CraftingRecipe extends IRecipe { - - boolean isRemovable(); -} diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java b/src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java deleted file mode 100644 index dbf888ef96..0000000000 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java +++ /dev/null @@ -1,50 +0,0 @@ -package gregtech.api.interfaces.internal; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * Interface used by the Mods Main Class to reference to internals. - *

- * Don't even think about including this File in your Mod. - */ -public interface IGT_Mod { - - /** - * This means that Server specific Basefiles are definitely existing! Not if the World is actually server side or - * not! - */ - boolean isServerSide(); - - /** - * This means that Client specific Basefiles are definitely existing! Not if the World is actually client side or - * not! - */ - boolean isClientSide(); - - /** - * This means that Bukkit specific Basefiles are definitely existing! Not if the World is actually bukkit server or - * not! - */ - boolean isBukkitSide(); - - /** - * works only ClientSide otherwise returns null - */ - EntityPlayer getThePlayer(); - - // ---------- Internal Usage Only ---------- - - /** - * works only ClientSide otherwise returns 0 - * - * @return the Index of the added Armor - */ - int addArmor(String aArmorPrefix); - - /** - * Plays the Sonictron Sound for the ItemStack on the Client Side - */ - void doSonictronSound(ItemStack aStack, World aWorld, double aX, double aY, double aZ); -} diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java deleted file mode 100644 index e3c3a8cbaa..0000000000 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java +++ /dev/null @@ -1,8 +0,0 @@ -package gregtech.api.interfaces.internal; - -import gregtech.api.util.GT_RecipeBuilder; - -public interface IGT_RecipeAdder { - - GT_RecipeBuilder stdBuilder(); -} diff --git a/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java b/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java index 5d99f83689..2cb2e6fd84 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java +++ b/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java @@ -6,8 +6,8 @@ import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.item.ItemStack; -import gregtech.api.enums.TC_Aspects; -import gregtech.api.enums.TC_Aspects.TC_AspectStack; +import gregtech.api.enums.TCAspects; +import gregtech.api.enums.TCAspects.TC_AspectStack; public interface IThaumcraftCompat { @@ -35,10 +35,10 @@ public interface IThaumcraftCompat { Object addCrucibleRecipe(String aResearch, Object aInput, ItemStack aOutput, List aAspects); Object addInfusionRecipe(String aResearch, ItemStack aMainInput, ItemStack[] aSideInputs, ItemStack aOutput, - int aInstability, List aAspects); + int aInstability, List aAspects); Object addInfusionEnchantmentRecipe(String aResearch, Enchantment aEnchantment, int aInstability, - List aAspects, ItemStack[] aSideInputs); + List aAspects, ItemStack[] aSideInputs); Object addResearch(String aResearch, String aName, String aText, String[] aParentResearches, String aCategory, ItemStack aIcon, int aComplexity, int aType, int aX, int aY, List aAspects, diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java index 4959f8b060..824925f928 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java @@ -34,8 +34,8 @@ import gregtech.api.interfaces.tileentity.IGearEnergyTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IGregtechWailaProvider; import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.util.GT_Util; +import gregtech.api.objects.GTItemStack; +import gregtech.api.util.GTUtil; /** * Warning, this Interface has just been made to be able to add multiple kinds of MetaTileEntities (Cables, Pipes, @@ -127,7 +127,7 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand * If a Cover of that Type can be placed on this Side. Also Called when the Facing of the Block Changes and a Cover * is on said Side. */ - boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aStack); + boolean allowCoverOnSide(ForgeDirection side, GTItemStack aStack); /** * When a Player right-clicks the Facing with a Screwdriver. @@ -400,7 +400,7 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand if (getBaseMetaTileEntity() != null) { return getBaseMetaTileEntity().getGUIColorization(); } else { - return GT_Util.getRGBInt(Dyes.MACHINE_METAL.getRGBA()); + return GTUtil.getRGBInt(Dyes.MACHINE_METAL.getRGBA()); } } diff --git a/src/main/java/gregtech/api/interfaces/modularui/ControllerWithOptionalFeatures.java b/src/main/java/gregtech/api/interfaces/modularui/ControllerWithOptionalFeatures.java deleted file mode 100644 index 8574de7007..0000000000 --- a/src/main/java/gregtech/api/interfaces/modularui/ControllerWithOptionalFeatures.java +++ /dev/null @@ -1,393 +0,0 @@ -package gregtech.api.interfaces.modularui; - -import static gregtech.api.metatileentity.BaseTileEntity.BUTTON_FORBIDDEN_TOOLTIP; -import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Set; - -import net.minecraft.util.StatCollector; - -import com.gtnewhorizons.modularui.api.drawable.IDrawable; -import com.gtnewhorizons.modularui.api.drawable.UITexture; -import com.gtnewhorizons.modularui.api.math.Pos2d; -import com.gtnewhorizons.modularui.api.widget.IWidgetBuilder; -import com.gtnewhorizons.modularui.api.widget.Widget; -import com.gtnewhorizons.modularui.common.widget.ButtonWidget; -import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; - -import gregtech.api.enums.SoundResource; -import gregtech.api.enums.VoidingMode; -import gregtech.api.gui.modularui.GT_UITextures; -import gregtech.api.interfaces.tileentity.IRecipeLockable; -import gregtech.api.interfaces.tileentity.IVoidable; - -/** - * Machines implementing this interface can have logic and GUI buttons - * to configure various behaviors regarding multiblock. - *

    - *
  • Power switch
  • - *
  • Void protection
  • - *
  • Separated input buses
  • - *
  • Batch mode
  • - *
  • Recipe locking
  • - *
  • Multiple machine modes
  • - *
- */ -public interface ControllerWithOptionalFeatures extends IVoidable, IRecipeLockable { - - boolean isAllowedToWork(); - - void disableWorking(); - - void enableWorking(); - - Pos2d getPowerSwitchButtonPos(); - - default ButtonWidget createPowerSwitchButton(IWidgetBuilder builder) { - Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { - if (isAllowedToWork()) { - disableWorking(); - } else { - enableWorking(); - } - }) - .setPlayClickSoundResource( - () -> isAllowedToWork() ? SoundResource.GUI_BUTTON_UP.resourceLocation - : SoundResource.GUI_BUTTON_DOWN.resourceLocation) - .setBackground(() -> { - if (isAllowedToWork()) { - return new IDrawable[] { GT_UITextures.BUTTON_STANDARD_PRESSED, - GT_UITextures.OVERLAY_BUTTON_POWER_SWITCH_ON }; - } else { - return new IDrawable[] { GT_UITextures.BUTTON_STANDARD, - GT_UITextures.OVERLAY_BUTTON_POWER_SWITCH_OFF }; - } - }) - .attachSyncer(new FakeSyncWidget.BooleanSyncer(this::isAllowedToWork, val -> { - if (val) enableWorking(); - else disableWorking(); - }), builder) - .addTooltip(StatCollector.translateToLocal("GT5U.gui.button.power_switch")) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(getPowerSwitchButtonPos()) - .setSize(16, 16); - return (ButtonWidget) button; - } - - Pos2d getVoidingModeButtonPos(); - - default ButtonWidget createVoidExcessButton(IWidgetBuilder builder) { - Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { - if (supportsVoidProtection()) { - Set allowed = getAllowedVoidingModes(); - switch (clickData.mouseButton) { - case 0 -> setVoidingMode(getVoidingMode().nextInCollection(allowed)); - case 1 -> setVoidingMode(getVoidingMode().previousInCollection(allowed)); - } - widget.notifyTooltipChange(); - } - }) - .setPlayClickSound(supportsVoidProtection()) - .setBackground(() -> { - List ret = new ArrayList<>(); - ret.add(getVoidingMode().buttonTexture); - ret.add(getVoidingMode().buttonOverlay); - if (!supportsVoidProtection()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_FORBIDDEN); - } - return ret.toArray(new IDrawable[0]); - }) - .attachSyncer( - new FakeSyncWidget.IntegerSyncer( - () -> getVoidingMode().ordinal(), - val -> setVoidingMode(VoidingMode.fromOrdinal(val))), - builder) - .dynamicTooltip( - () -> Arrays.asList( - StatCollector.translateToLocal("GT5U.gui.button.voiding_mode"), - StatCollector.translateToLocal(getVoidingMode().getTransKey()))) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(getVoidingModeButtonPos()) - .setSize(16, 16); - if (!supportsVoidProtection()) { - button.addTooltip(StatCollector.translateToLocal(BUTTON_FORBIDDEN_TOOLTIP)); - } - return (ButtonWidget) button; - } - - /** - * @return if the multi has more than 1 mode - */ - default boolean supportsMachineModeSwitch() { - return false; - } - - /** - * @return the current mode number. This is a getter is used for displaying the icon in the GUI - */ - default int getMachineMode() { - return 0; - } - - /** - * @return name for the current machine mode on this machine. Defaults "Unknown Mode" - */ - default String getMachineModeName() { - return "Unknown Mode"; - } - - /** - * @param index Index of machineModeIcons to pull from - * @return UITexture associated with that machineMode - */ - default UITexture getMachineModeIcon(int index) { - return null; - } - - /** - * @param index Number to set machineMode to - */ - default void setMachineMode(int index) {} - - /** - * @return Returns the next machineMode number in the sequence - */ - default int nextMachineMode() { - return 0; - } - - /** - * @return Returns whether machine supports mode switch by default - */ - default boolean getDefaultModeSwitch() { - return supportsMachineModeSwitch(); - } - - Pos2d getMachineModeSwitchButtonPos(); - - /** - * Called when the mode switch button is clicked - */ - default void onMachineModeSwitchClick() {} - - default ButtonWidget createModeSwitchButton(IWidgetBuilder builder) { - if (!supportsMachineModeSwitch()) return null; - Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { - if (supportsMachineModeSwitch()) { - onMachineModeSwitchClick(); - setMachineMode(nextMachineMode()); - } - }) - .setPlayClickSound(supportsMachineModeSwitch()) - .setBackground(() -> { - List ret = new ArrayList<>(); - if (supportsMachineModeSwitch()) { - ret.add(GT_UITextures.BUTTON_STANDARD); - ret.add(getMachineModeIcon(getMachineMode())); - } else return null; - return ret.toArray(new IDrawable[0]); - }) - .attachSyncer(new FakeSyncWidget.IntegerSyncer(this::getMachineMode, this::setMachineMode), builder) - .addTooltip(StatCollector.translateToLocal("GT5U.gui.button.mode_switch")) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(getMachineModeSwitchButtonPos()) - .setSize(16, 16); - return (ButtonWidget) button; - } - - /** - * @return if the multi supports input separation. - */ - boolean supportsInputSeparation(); - - /** - * @return true if input separation is enabled, else false. This is getter is used for displaying the icon in the - * GUI - */ - boolean isInputSeparationEnabled(); - - void setInputSeparation(boolean enabled); - - default boolean getDefaultInputSeparationMode() { - return supportsInputSeparation(); - } - - Pos2d getInputSeparationButtonPos(); - - default ButtonWidget createInputSeparationButton(IWidgetBuilder builder) { - Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { - if (supportsInputSeparation()) { - setInputSeparation(!isInputSeparationEnabled()); - } - }) - .setPlayClickSound(supportsInputSeparation()) - .setBackground(() -> { - List ret = new ArrayList<>(); - if (isInputSeparationEnabled()) { - ret.add(GT_UITextures.BUTTON_STANDARD_PRESSED); - if (supportsInputSeparation()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_ON); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_ON_DISABLED); - } - } else { - ret.add(GT_UITextures.BUTTON_STANDARD); - if (supportsInputSeparation()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF_DISABLED); - } - } - if (!supportsInputSeparation()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_FORBIDDEN); - } - return ret.toArray(new IDrawable[0]); - }) - .attachSyncer( - new FakeSyncWidget.BooleanSyncer(this::isInputSeparationEnabled, this::setInputSeparation), - builder) - .addTooltip(StatCollector.translateToLocal("GT5U.gui.button.input_separation")) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(getInputSeparationButtonPos()) - .setSize(16, 16); - if (!supportsInputSeparation()) { - button.addTooltip(StatCollector.translateToLocal(BUTTON_FORBIDDEN_TOOLTIP)); - } - return (ButtonWidget) button; - } - - /** - * @return if the multi supports batch mode. - */ - boolean supportsBatchMode(); - - /** - * @return true if batch mode is enabled, else false. This is getter is used for displaying the icon in the GUI - */ - boolean isBatchModeEnabled(); - - void setBatchMode(boolean enabled); - - default boolean getDefaultBatchMode() { - return false; - } - - Pos2d getBatchModeButtonPos(); - - default ButtonWidget createBatchModeButton(IWidgetBuilder builder) { - Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { - if (supportsBatchMode()) { - setBatchMode(!isBatchModeEnabled()); - } - }) - .setPlayClickSound(supportsBatchMode()) - .setBackground(() -> { - List ret = new ArrayList<>(); - if (isBatchModeEnabled()) { - ret.add(GT_UITextures.BUTTON_STANDARD_PRESSED); - if (supportsBatchMode()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_ON); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_ON_DISABLED); - } - } else { - ret.add(GT_UITextures.BUTTON_STANDARD); - if (supportsBatchMode()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_OFF); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_OFF_DISABLED); - } - } - if (!supportsBatchMode()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_FORBIDDEN); - } - return ret.toArray(new IDrawable[0]); - }) - .attachSyncer(new FakeSyncWidget.BooleanSyncer(this::isBatchModeEnabled, this::setBatchMode), builder) - .addTooltip(StatCollector.translateToLocal("GT5U.gui.button.batch_mode")) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(getBatchModeButtonPos()) - .setSize(16, 16); - if (!supportsBatchMode()) { - button.addTooltip(StatCollector.translateToLocal(BUTTON_FORBIDDEN_TOOLTIP)); - } - return (ButtonWidget) button; - } - - Pos2d getRecipeLockingButtonPos(); - - default ButtonWidget createLockToSingleRecipeButton(IWidgetBuilder builder) { - Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { - if (supportsSingleRecipeLocking()) { - setRecipeLocking(!isRecipeLockingEnabled()); - } - }) - .setPlayClickSound(supportsSingleRecipeLocking()) - .setBackground(() -> { - List ret = new ArrayList<>(); - if (isRecipeLockingEnabled()) { - ret.add(GT_UITextures.BUTTON_STANDARD_PRESSED); - if (supportsSingleRecipeLocking()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_LOCKED); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_LOCKED_DISABLED); - } - } else { - ret.add(GT_UITextures.BUTTON_STANDARD); - if (supportsSingleRecipeLocking()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED_DISABLED); - } - } - if (!supportsSingleRecipeLocking()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_FORBIDDEN); - } - return ret.toArray(new IDrawable[0]); - }) - .attachSyncer( - new FakeSyncWidget.BooleanSyncer(this::isRecipeLockingEnabled, this::setRecipeLocking), - builder) - .addTooltip(StatCollector.translateToLocal("GT5U.gui.button.lock_recipe")) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(getRecipeLockingButtonPos()) - .setSize(16, 16); - if (!supportsSingleRecipeLocking()) { - button.addTooltip(StatCollector.translateToLocal(BUTTON_FORBIDDEN_TOOLTIP)); - } - return (ButtonWidget) button; - } - - Pos2d getStructureUpdateButtonPos(); - - int getStructureUpdateTime(); - - void setStructureUpdateTime(int time); - - default ButtonWidget createStructureUpdateButton(IWidgetBuilder builder) { - Widget button = new ButtonWidget() - .setOnClick((clickData, widget) -> { if (getStructureUpdateTime() <= -20) setStructureUpdateTime(1); }) - .setPlayClickSound(true) - .setBackground(() -> { - List ret = new ArrayList<>(); - if (getStructureUpdateTime() > -20) { - ret.add(GT_UITextures.BUTTON_STANDARD_PRESSED); - } else { - ret.add(GT_UITextures.BUTTON_STANDARD); - } - ret.add(GT_UITextures.OVERLAY_BUTTON_STRUCTURE_UPDATE); - return ret.toArray(new IDrawable[0]); - }) - .attachSyncer( - new FakeSyncWidget.IntegerSyncer(this::getStructureUpdateTime, this::setStructureUpdateTime), - builder) - .addTooltip(StatCollector.translateToLocal("GT5U.gui.button.structure_update")) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(getStructureUpdateButtonPos()) - .setSize(16, 16); - return (ButtonWidget) button; - } -} diff --git a/src/main/java/gregtech/api/interfaces/modularui/IControllerWithOptionalFeatures.java b/src/main/java/gregtech/api/interfaces/modularui/IControllerWithOptionalFeatures.java new file mode 100644 index 0000000000..d203d9fc87 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/modularui/IControllerWithOptionalFeatures.java @@ -0,0 +1,393 @@ +package gregtech.api.interfaces.modularui; + +import static gregtech.api.metatileentity.BaseTileEntity.BUTTON_FORBIDDEN_TOOLTIP; +import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Set; + +import net.minecraft.util.StatCollector; + +import com.gtnewhorizons.modularui.api.drawable.IDrawable; +import com.gtnewhorizons.modularui.api.drawable.UITexture; +import com.gtnewhorizons.modularui.api.math.Pos2d; +import com.gtnewhorizons.modularui.api.widget.IWidgetBuilder; +import com.gtnewhorizons.modularui.api.widget.Widget; +import com.gtnewhorizons.modularui.common.widget.ButtonWidget; +import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; + +import gregtech.api.enums.SoundResource; +import gregtech.api.enums.VoidingMode; +import gregtech.api.gui.modularui.GTUITextures; +import gregtech.api.interfaces.tileentity.IRecipeLockable; +import gregtech.api.interfaces.tileentity.IVoidable; + +/** + * Machines implementing this interface can have logic and GUI buttons + * to configure various behaviors regarding multiblock. + *
    + *
  • Power switch
  • + *
  • Void protection
  • + *
  • Separated input buses
  • + *
  • Batch mode
  • + *
  • Recipe locking
  • + *
  • Multiple machine modes
  • + *
+ */ +public interface IControllerWithOptionalFeatures extends IVoidable, IRecipeLockable { + + boolean isAllowedToWork(); + + void disableWorking(); + + void enableWorking(); + + Pos2d getPowerSwitchButtonPos(); + + default ButtonWidget createPowerSwitchButton(IWidgetBuilder builder) { + Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { + if (isAllowedToWork()) { + disableWorking(); + } else { + enableWorking(); + } + }) + .setPlayClickSoundResource( + () -> isAllowedToWork() ? SoundResource.GUI_BUTTON_UP.resourceLocation + : SoundResource.GUI_BUTTON_DOWN.resourceLocation) + .setBackground(() -> { + if (isAllowedToWork()) { + return new IDrawable[] { GTUITextures.BUTTON_STANDARD_PRESSED, + GTUITextures.OVERLAY_BUTTON_POWER_SWITCH_ON }; + } else { + return new IDrawable[] { GTUITextures.BUTTON_STANDARD, + GTUITextures.OVERLAY_BUTTON_POWER_SWITCH_OFF }; + } + }) + .attachSyncer(new FakeSyncWidget.BooleanSyncer(this::isAllowedToWork, val -> { + if (val) enableWorking(); + else disableWorking(); + }), builder) + .addTooltip(StatCollector.translateToLocal("GT5U.gui.button.power_switch")) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(getPowerSwitchButtonPos()) + .setSize(16, 16); + return (ButtonWidget) button; + } + + Pos2d getVoidingModeButtonPos(); + + default ButtonWidget createVoidExcessButton(IWidgetBuilder builder) { + Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { + if (supportsVoidProtection()) { + Set allowed = getAllowedVoidingModes(); + switch (clickData.mouseButton) { + case 0 -> setVoidingMode(getVoidingMode().nextInCollection(allowed)); + case 1 -> setVoidingMode(getVoidingMode().previousInCollection(allowed)); + } + widget.notifyTooltipChange(); + } + }) + .setPlayClickSound(supportsVoidProtection()) + .setBackground(() -> { + List ret = new ArrayList<>(); + ret.add(getVoidingMode().buttonTexture); + ret.add(getVoidingMode().buttonOverlay); + if (!supportsVoidProtection()) { + ret.add(GTUITextures.OVERLAY_BUTTON_FORBIDDEN); + } + return ret.toArray(new IDrawable[0]); + }) + .attachSyncer( + new FakeSyncWidget.IntegerSyncer( + () -> getVoidingMode().ordinal(), + val -> setVoidingMode(VoidingMode.fromOrdinal(val))), + builder) + .dynamicTooltip( + () -> Arrays.asList( + StatCollector.translateToLocal("GT5U.gui.button.voiding_mode"), + StatCollector.translateToLocal(getVoidingMode().getTransKey()))) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(getVoidingModeButtonPos()) + .setSize(16, 16); + if (!supportsVoidProtection()) { + button.addTooltip(StatCollector.translateToLocal(BUTTON_FORBIDDEN_TOOLTIP)); + } + return (ButtonWidget) button; + } + + /** + * @return if the multi has more than 1 mode + */ + default boolean supportsMachineModeSwitch() { + return false; + } + + /** + * @return the current mode number. This is a getter is used for displaying the icon in the GUI + */ + default int getMachineMode() { + return 0; + } + + /** + * @return name for the current machine mode on this machine. Defaults "Unknown Mode" + */ + default String getMachineModeName() { + return "Unknown Mode"; + } + + /** + * @param index Index of machineModeIcons to pull from + * @return UITexture associated with that machineMode + */ + default UITexture getMachineModeIcon(int index) { + return null; + } + + /** + * @param index Number to set machineMode to + */ + default void setMachineMode(int index) {} + + /** + * @return Returns the next machineMode number in the sequence + */ + default int nextMachineMode() { + return 0; + } + + /** + * @return Returns whether machine supports mode switch by default + */ + default boolean getDefaultModeSwitch() { + return supportsMachineModeSwitch(); + } + + Pos2d getMachineModeSwitchButtonPos(); + + /** + * Called when the mode switch button is clicked + */ + default void onMachineModeSwitchClick() {} + + default ButtonWidget createModeSwitchButton(IWidgetBuilder builder) { + if (!supportsMachineModeSwitch()) return null; + Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { + if (supportsMachineModeSwitch()) { + onMachineModeSwitchClick(); + setMachineMode(nextMachineMode()); + } + }) + .setPlayClickSound(supportsMachineModeSwitch()) + .setBackground(() -> { + List ret = new ArrayList<>(); + if (supportsMachineModeSwitch()) { + ret.add(GTUITextures.BUTTON_STANDARD); + ret.add(getMachineModeIcon(getMachineMode())); + } else return null; + return ret.toArray(new IDrawable[0]); + }) + .attachSyncer(new FakeSyncWidget.IntegerSyncer(this::getMachineMode, this::setMachineMode), builder) + .addTooltip(StatCollector.translateToLocal("GT5U.gui.button.mode_switch")) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(getMachineModeSwitchButtonPos()) + .setSize(16, 16); + return (ButtonWidget) button; + } + + /** + * @return if the multi supports input separation. + */ + boolean supportsInputSeparation(); + + /** + * @return true if input separation is enabled, else false. This is getter is used for displaying the icon in the + * GUI + */ + boolean isInputSeparationEnabled(); + + void setInputSeparation(boolean enabled); + + default boolean getDefaultInputSeparationMode() { + return supportsInputSeparation(); + } + + Pos2d getInputSeparationButtonPos(); + + default ButtonWidget createInputSeparationButton(IWidgetBuilder builder) { + Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { + if (supportsInputSeparation()) { + setInputSeparation(!isInputSeparationEnabled()); + } + }) + .setPlayClickSound(supportsInputSeparation()) + .setBackground(() -> { + List ret = new ArrayList<>(); + if (isInputSeparationEnabled()) { + ret.add(GTUITextures.BUTTON_STANDARD_PRESSED); + if (supportsInputSeparation()) { + ret.add(GTUITextures.OVERLAY_BUTTON_INPUT_SEPARATION_ON); + } else { + ret.add(GTUITextures.OVERLAY_BUTTON_INPUT_SEPARATION_ON_DISABLED); + } + } else { + ret.add(GTUITextures.BUTTON_STANDARD); + if (supportsInputSeparation()) { + ret.add(GTUITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF); + } else { + ret.add(GTUITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF_DISABLED); + } + } + if (!supportsInputSeparation()) { + ret.add(GTUITextures.OVERLAY_BUTTON_FORBIDDEN); + } + return ret.toArray(new IDrawable[0]); + }) + .attachSyncer( + new FakeSyncWidget.BooleanSyncer(this::isInputSeparationEnabled, this::setInputSeparation), + builder) + .addTooltip(StatCollector.translateToLocal("GT5U.gui.button.input_separation")) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(getInputSeparationButtonPos()) + .setSize(16, 16); + if (!supportsInputSeparation()) { + button.addTooltip(StatCollector.translateToLocal(BUTTON_FORBIDDEN_TOOLTIP)); + } + return (ButtonWidget) button; + } + + /** + * @return if the multi supports batch mode. + */ + boolean supportsBatchMode(); + + /** + * @return true if batch mode is enabled, else false. This is getter is used for displaying the icon in the GUI + */ + boolean isBatchModeEnabled(); + + void setBatchMode(boolean enabled); + + default boolean getDefaultBatchMode() { + return false; + } + + Pos2d getBatchModeButtonPos(); + + default ButtonWidget createBatchModeButton(IWidgetBuilder builder) { + Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { + if (supportsBatchMode()) { + setBatchMode(!isBatchModeEnabled()); + } + }) + .setPlayClickSound(supportsBatchMode()) + .setBackground(() -> { + List ret = new ArrayList<>(); + if (isBatchModeEnabled()) { + ret.add(GTUITextures.BUTTON_STANDARD_PRESSED); + if (supportsBatchMode()) { + ret.add(GTUITextures.OVERLAY_BUTTON_BATCH_MODE_ON); + } else { + ret.add(GTUITextures.OVERLAY_BUTTON_BATCH_MODE_ON_DISABLED); + } + } else { + ret.add(GTUITextures.BUTTON_STANDARD); + if (supportsBatchMode()) { + ret.add(GTUITextures.OVERLAY_BUTTON_BATCH_MODE_OFF); + } else { + ret.add(GTUITextures.OVERLAY_BUTTON_BATCH_MODE_OFF_DISABLED); + } + } + if (!supportsBatchMode()) { + ret.add(GTUITextures.OVERLAY_BUTTON_FORBIDDEN); + } + return ret.toArray(new IDrawable[0]); + }) + .attachSyncer(new FakeSyncWidget.BooleanSyncer(this::isBatchModeEnabled, this::setBatchMode), builder) + .addTooltip(StatCollector.translateToLocal("GT5U.gui.button.batch_mode")) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(getBatchModeButtonPos()) + .setSize(16, 16); + if (!supportsBatchMode()) { + button.addTooltip(StatCollector.translateToLocal(BUTTON_FORBIDDEN_TOOLTIP)); + } + return (ButtonWidget) button; + } + + Pos2d getRecipeLockingButtonPos(); + + default ButtonWidget createLockToSingleRecipeButton(IWidgetBuilder builder) { + Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { + if (supportsSingleRecipeLocking()) { + setRecipeLocking(!isRecipeLockingEnabled()); + } + }) + .setPlayClickSound(supportsSingleRecipeLocking()) + .setBackground(() -> { + List ret = new ArrayList<>(); + if (isRecipeLockingEnabled()) { + ret.add(GTUITextures.BUTTON_STANDARD_PRESSED); + if (supportsSingleRecipeLocking()) { + ret.add(GTUITextures.OVERLAY_BUTTON_RECIPE_LOCKED); + } else { + ret.add(GTUITextures.OVERLAY_BUTTON_RECIPE_LOCKED_DISABLED); + } + } else { + ret.add(GTUITextures.BUTTON_STANDARD); + if (supportsSingleRecipeLocking()) { + ret.add(GTUITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED); + } else { + ret.add(GTUITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED_DISABLED); + } + } + if (!supportsSingleRecipeLocking()) { + ret.add(GTUITextures.OVERLAY_BUTTON_FORBIDDEN); + } + return ret.toArray(new IDrawable[0]); + }) + .attachSyncer( + new FakeSyncWidget.BooleanSyncer(this::isRecipeLockingEnabled, this::setRecipeLocking), + builder) + .addTooltip(StatCollector.translateToLocal("GT5U.gui.button.lock_recipe")) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(getRecipeLockingButtonPos()) + .setSize(16, 16); + if (!supportsSingleRecipeLocking()) { + button.addTooltip(StatCollector.translateToLocal(BUTTON_FORBIDDEN_TOOLTIP)); + } + return (ButtonWidget) button; + } + + Pos2d getStructureUpdateButtonPos(); + + int getStructureUpdateTime(); + + void setStructureUpdateTime(int time); + + default ButtonWidget createStructureUpdateButton(IWidgetBuilder builder) { + Widget button = new ButtonWidget() + .setOnClick((clickData, widget) -> { if (getStructureUpdateTime() <= -20) setStructureUpdateTime(1); }) + .setPlayClickSound(true) + .setBackground(() -> { + List ret = new ArrayList<>(); + if (getStructureUpdateTime() > -20) { + ret.add(GTUITextures.BUTTON_STANDARD_PRESSED); + } else { + ret.add(GTUITextures.BUTTON_STANDARD); + } + ret.add(GTUITextures.OVERLAY_BUTTON_STRUCTURE_UPDATE); + return ret.toArray(new IDrawable[0]); + }) + .attachSyncer( + new FakeSyncWidget.IntegerSyncer(this::getStructureUpdateTime, this::setStructureUpdateTime), + builder) + .addTooltip(StatCollector.translateToLocal("GT5U.gui.button.structure_update")) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(getStructureUpdateButtonPos()) + .setSize(16, 16); + return (ButtonWidget) button; + } +} diff --git a/src/main/java/gregtech/api/interfaces/modularui/IGetTitleColor.java b/src/main/java/gregtech/api/interfaces/modularui/IGetTitleColor.java index 76d94ee299..442ad05efd 100644 --- a/src/main/java/gregtech/api/interfaces/modularui/IGetTitleColor.java +++ b/src/main/java/gregtech/api/interfaces/modularui/IGetTitleColor.java @@ -1,11 +1,11 @@ package gregtech.api.interfaces.modularui; import gregtech.api.enums.Dyes; -import gregtech.api.util.GT_Util; +import gregtech.api.util.GTUtil; public interface IGetTitleColor { default int getTitleColor() { - return GT_Util.getRGBaInt(Dyes.dyeWhite.getRGBA()); + return GTUtil.getRGBaInt(Dyes.dyeWhite.getRGBA()); } } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java index ec760dd346..852817add2 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java @@ -1,7 +1,7 @@ package gregtech.api.interfaces.tileentity; import gregtech.api.enums.Dyes; -import gregtech.api.util.GT_Util; +import gregtech.api.util.GTUtil; public interface IColoredTileEntity { @@ -21,7 +21,6 @@ public interface IColoredTileEntity { * @return Actual color shown on GUI */ default int getGUIColorization() { - return GT_Util - .getRGBInt((getColorization() != -1 ? Dyes.get(getColorization()) : Dyes.MACHINE_METAL).getRGBA()); + return GTUtil.getRGBInt((getColorization() != -1 ? Dyes.get(getColorization()) : Dyes.MACHINE_METAL).getRGBA()); } } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java b/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java index 8834678984..00ae2db9bd 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java @@ -4,8 +4,8 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; -import gregtech.api.util.GT_CoverBehavior; -import gregtech.api.util.GT_CoverBehaviorBase; +import gregtech.api.util.CoverBehavior; +import gregtech.api.util.CoverBehaviorBase; import gregtech.api.util.ISerializableObject; import gregtech.common.covers.CoverInfo; @@ -49,9 +49,9 @@ public interface ICoverable extends IRedstoneTileEntity, IHasInventory, IBasicEn ItemStack getCoverItemAtSide(ForgeDirection side); @Deprecated - GT_CoverBehavior getCoverBehaviorAtSide(ForgeDirection side); + CoverBehavior getCoverBehaviorAtSide(ForgeDirection side); - default GT_CoverBehaviorBase getCoverBehaviorAtSideNew(ForgeDirection side) { + default CoverBehaviorBase getCoverBehaviorAtSideNew(ForgeDirection side) { return getCoverBehaviorAtSide(side); } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index 91a9759e47..6dbc6bd5b8 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -8,10 +8,10 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; import cofh.api.energy.IEnergyReceiver; -import gregtech.api.GregTech_API; +import gregtech.api.GregTechAPI; import gregtech.api.logic.PowerLogic; import gregtech.api.logic.interfaces.PowerLogicHost; -import gregtech.api.util.GT_Utility; +import gregtech.api.util.GTUtility; import ic2.api.energy.tile.IEnergySink; /** @@ -97,8 +97,8 @@ public interface IEnergyConnected extends IColoredTileEntity { while (amperage > usedAmperes && sink.getDemandedEnergy() > 0 && sink.injectEnergy(oppositeSide, voltage, voltage) < voltage) usedAmperes++; } - } else if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver receiver) { - final int rfOut = GT_Utility.safeInt(voltage * GregTech_API.mEUtoRF / 100); + } else if (GregTechAPI.mOutputRF && tTileEntity instanceof IEnergyReceiver receiver) { + final int rfOut = GTUtility.safeInt(voltage * GregTechAPI.mEUtoRF / 100); if (receiver.receiveEnergy(oppositeSide, rfOut, true) == rfOut) { receiver.receiveEnergy(oppositeSide, rfOut, false); usedAmperes++; @@ -152,7 +152,7 @@ public interface IEnergyConnected extends IColoredTileEntity { emitterLogic.removeEnergyUnsafe(usedAmperes * voltage); return; } - + if (tileEntity instanceof IEnergySink sink) { if (sink.acceptsEnergyFrom((TileEntity) emitter, oppositeSide)) { while (amperage > usedAmperes && sink.getDemandedEnergy() > 0 @@ -164,8 +164,8 @@ public interface IEnergyConnected extends IColoredTileEntity { } } - if (GregTech_API.mOutputRF && tileEntity instanceof IEnergyReceiver receiver) { - final int rfOut = GT_Utility.safeInt(voltage * GregTech_API.mEUtoRF / 100); + if (GregTechAPI.mOutputRF && tileEntity instanceof IEnergyReceiver receiver) { + final int rfOut = GTUtility.safeInt(voltage * GregTechAPI.mEUtoRF / 100); if (receiver.receiveEnergy(oppositeSide, rfOut, true) == rfOut) { receiver.receiveEnergy(oppositeSide, rfOut, false); usedAmperes++; diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java index d8231ee544..9e6b4c57c0 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java @@ -22,7 +22,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.modularui.IAddInventorySlots; import gregtech.api.interfaces.modularui.IGetGUITextureSet; import gregtech.api.util.shutdown.ShutDownReason; -import gregtech.common.blocks.GT_Block_Machines; +import gregtech.common.blocks.BlockMachines; /** * A simple compound Interface for all my TileEntities. @@ -186,7 +186,7 @@ public interface IGregTechTileEntity extends ITexturedTileEntity, IGearEnergyTil /** * A randomly called display update to be able to add particles or other items for display The event is proxied by - * the {@link GT_Block_Machines#randomDisplayTick} + * the {@link BlockMachines#randomDisplayTick} */ @SideOnly(Side.CLIENT) default void onRandomDisplayTick() { -- cgit